示例#1
0
 public WeaponWrapper(TankBlock block)
 {
     this.block  = block;
     this.weapon = block.gameObject.GetComponent <ModuleWeapon>();
     this.drill  = block.gameObject.GetComponent <ModuleDrill>();
     this.hammer = block.gameObject.GetComponent <ModuleHammer>();
 }
示例#2
0
 internal static void RemoveGroupForHammer(ModuleHammer hammer, WeaponGroup group)
 {
     if (ModuleWeaponGroupController.groups_for_hammer.TryGetValue(hammer, out var groups))
     {
         groups.Remove(group);
     }
 }
示例#3
0
            static bool Prefix(ModuleHammer __instance, int aim, bool fire)
            {
                if (aim != ModuleWeaponGroupController.aim_ID && !fire)
                {
                    if (ModuleWeaponGroupController.groups_for_hammer.TryGetValue(__instance, out var groups))
                    {
                        if (groups.Any(g => g.fireNextFrame))
                        {
                            return false;
                        }
                    }
                }

                return true;
            }
示例#4
0
                //Hook by replacing method body of ModuleHammer.ControlInput()
                internal static void ControlInput(ModuleHammer module, int aim, int fire)
                {
                    bool shouldFireDefault = (fire != 0);
                    var  shouldFireEvent   = new CanFireEvent <ModuleHammer>(module, shouldFireDefault);

                    CanFire?.Invoke(shouldFireEvent);

                    bool performBehaviour = true;

                    if (shouldFireEvent.Fire)
                    {
                        var fireEvent = new FireEvent <ModuleHammer>(module);
                        OnFire?.Invoke(fireEvent);
                        performBehaviour = fireEvent.PerformVanillaBehaviour;
#warning Remove duplicate versions of this
                    }
                    if (performBehaviour)
                    {
                        //module.state.enabled = shouldFireEvent.Fire;
                    }
                }