public void AddBlock(TankBlock block, IntVector3 pos, OrthoRotation rot) { blocks.Add(block); block.trans.parent = transform; block.trans.localPosition = pos; block.trans.localRotation = rot; Dirty = true; for (int ap = 0; ap < block.attachPoints.Length; ap++) { IntVector3 filledCellForAPIndex = block.GetFilledCellForAPIndex(ap); IntVector3 v3 = block.attachPoints[ap] * 2f - filledCellForAPIndex - filledCellForAPIndex; IntVector3 index = pos + rot * filledCellForAPIndex; byte b = (rot * v3).APHalfBits(); ClusterAPBitField.TryGetValue(index, out byte ptr); ptr |= b; ClusterAPBitField[index] = ptr; } ModuleWeapon weapon = block.GetComponent <ModuleWeapon>(); if (weapon != null) { blockWeapons.Add(weapon); } ModuleDrill drill = block.GetComponent <ModuleDrill>(); if (drill != null) { blockDrills.Add(drill); } return; }
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>(); }
static bool Prefix(ref ModuleDrill __instance) { BuffController buff = BuffController.MakeNewIfNone(__instance.block.tank); buff.RemoveDrill(__instance); return(true); }
public void RemoveDrill(ModuleDrill drill) { this.allSegments["DrillDps"].ManipulateObj(new List <object> { drill }, "CLEAN"); this.drillListGeneric.Remove(drill); }
public void AddDrill(ModuleDrill drill) { this.drillListGeneric.Add(drill); this.allSegments["DrillDps"].ManipulateObj(new List <object> { drill }, "SAVE"); }
//Hook by replacing method body of ModuleDrill.ControlInput() internal static void ControlInput(ModuleDrill module, int aim, int fire) { bool shouldFireDefault = (fire != 0); var shouldFireEvent = new CanFireEvent <ModuleDrill>(module, shouldFireDefault); CanFire?.Invoke(shouldFireEvent); bool performBehaviour = true; if (shouldFireEvent.Fire) { var fireEvent = new FireEvent <ModuleDrill>(module); OnFire?.Invoke(fireEvent); performBehaviour = fireEvent.PerformVanillaBehaviour; } if (performBehaviour) { module.m_Spinning = shouldFireEvent.Fire; } }