public static BuffController MakeNewIfNone(Tank objTank) { foreach (BuffController element in BuffController.allControllers) { if (element.tank == objTank) { return(element); } } BuffController newObject = new BuffController { tank = objTank }; foreach (KeyValuePair <string, string[]> entry in BuffController.allEffects) { BuffSegment newSegment = new BuffSegment { tank = newObject.tank, controller = newObject, effectType = entry.Key, effectPaths = entry.Value }; newObject.allSegments.Add(entry.Key, newSegment); //Console.WriteLine("FFW: Entry Key Type: " + entry.Key.GetType().Name + " / Entry Value Length: " + entry.Value.Length); } BuffController.AddObject(newObject); Console.WriteLine("FFW: Active BuffControls: " + BuffController.allControllers.Count); return(newObject); }
private void OnAttach() { BuffController buff = BuffController.MakeNewIfNone(this.block.tank); buff.AddBuff(this); base.block.tank.AnchorEvent.Subscribe(new Action <ModuleAnchor, bool, bool>(this.OnAnchor)); }
static bool Prefix(ref ModuleBooster __instance) { BuffController buff = BuffController.MakeNewIfNone(__instance.block.tank); buff.AddBooster(__instance); return(true); }
static bool Prefix(ref ModuleWheels __instance) { BuffController buff = BuffController.MakeNewIfNone(__instance.block.tank); buff.RemoveWheels(__instance); return(true); }
static bool Prefix(ref ModuleWeaponGun __instance) { BuffController buff = BuffController.MakeNewIfNone(__instance.block.tank); buff.AddWeapon(__instance); return(true); }
static bool Prefix(ref ModuleItemStore __instance) { BuffController buff = BuffController.MakeNewIfNone(__instance.block.tank); buff.AddItemStore(__instance); return(true); }
static bool Prefix(ref ModuleItemProducer __instance) { BuffController buff = BuffController.MakeNewIfNone(__instance.block.tank); buff.RemoveItemPro(__instance); return(true); }
private void OnAnchor(ModuleAnchor anchor, bool anchored, bool fromAfterTechPopulate) { BuffController buff = BuffController.MakeNewIfNone(this.block.tank); List <string> list = new List <string>(); list.AddRange(m_BuffType); list.Add("Anchor"); buff.Update(list.ToArray()); }
private void OnDetach() { BuffController buff = BuffController.MakeNewIfNone(this.block.tank); if (this.pointer.GetType() == typeof(ModuleRemoteCharger)) { buff.RemoveCharger((ModuleRemoteCharger)this.pointer); } }
private void OnDetach() { BuffController buff = BuffController.MakeNewIfNone(this.block.tank); buff.RemoveBuff(this); if (base.block.tank != null) { base.block.tank.AnchorEvent.Unsubscribe(new Action <ModuleAnchor, bool, bool>(this.OnAnchor)); } }
public static void RemoveObject(BuffController obj) // Todo: Make "cleaning" function { BuffController.allControllers.Remove(obj); }
public static void AddObject(BuffController obj) { BuffController.allControllers.Add(obj); }
static void Postfix(ref ModuleWeaponGun __instance) { BuffController buff = BuffController.MakeNewIfNone(__instance.block.tank); buff.RemoveWeapon(__instance); }