// Function from file: control.dm public void check_core_stability( ) { Obj_Machinery_AmShielding AMS = null; if (this.stored_core_stability_delay || this.linked_cores.len <= 0) { return; } this.stored_core_stability_delay = true; this.stored_core_stability = 0; foreach (dynamic _a in Lang13.Enumerate(this.linked_cores, typeof(Obj_Machinery_AmShielding))) { AMS = _a; this.stored_core_stability += AMS.stability; } this.stored_core_stability /= this.linked_cores.len; Task13.Schedule(40, (Task13.Closure)(() => { this.stored_core_stability_delay = false; return; })); return; }
// Function from file: control.dm public override dynamic Destroy( ) { Obj_Machinery_AmShielding AMS = null; foreach (dynamic _a in Lang13.Enumerate(this.linked_shielding, typeof(Obj_Machinery_AmShielding))) { AMS = _a; GlobalFuncs.qdel(AMS); } return(base.Destroy()); }
// Function from file: control.dm public bool produce_power( ) { double core_power = 0; int core_damage = 0; double fuel = 0; Obj_Machinery_AmShielding AMS = null; GlobalFuncs.playsound(this.loc, "sound/effects/bang.ogg", 25, 1); core_power = this.reported_core_efficiency; if (core_power <= 0) { return(false); } core_damage = 0; fuel = ((Obj_Item_Weapon_AmContainment)this.fueljar).usefuel(this.fuel_injection); this.stored_power = fuel / core_power * fuel * 200000; if (fuel > core_power * 2) { if (Rand13.PercentChance(50)) { core_damage = 1; } if (fuel - core_power > 5) { core_damage = 5; } if (fuel - core_power > 10) { core_damage = 20; } if (core_damage == 0) { return(false); } foreach (dynamic _a in Lang13.Enumerate(this.linked_cores, typeof(Obj_Machinery_AmShielding))) { AMS = _a; AMS.stability -= core_damage; AMS.check_stability(true); } GlobalFuncs.playsound(this.loc, "sound/effects/bang.ogg", 50, 1); } return(false); }
// Function from file: control.dm public bool remove_shielding(Obj_Machinery_AmShielding AMS = null) { if (!(AMS is Obj_Machinery_AmShielding)) { return(false); } this.linked_shielding.Remove(AMS); this.update_shield_icons = 2; if (this.active) { this.toggle_power(); } return(true); }
// Function from file: control.dm public void check_shield_icons( ) { Obj_Machinery_AmShielding AMS = null; Obj_Machinery_AmShielding AMS2 = null; if (this.shield_icon_delay) { return; } this.shield_icon_delay = true; if (this.update_shield_icons == 2) { foreach (dynamic _a in Lang13.Enumerate(this.linked_shielding, typeof(Obj_Machinery_AmShielding))) { AMS = _a; if (AMS.processing) { AMS.shutdown_core(); } AMS.control_unit = null; Task13.Schedule(10, (Task13.Closure)(() => { AMS.controllerscan(); return; })); } this.linked_shielding = new ByTable(); } else { foreach (dynamic _b in Lang13.Enumerate(this.linked_shielding, typeof(Obj_Machinery_AmShielding))) { AMS2 = _b; AMS2.update_icon(); } } Task13.Schedule(20, (Task13.Closure)(() => { this.shield_icon_delay = false; return; })); return; }
// Function from file: control.dm public override bool blob_act(dynamic severity = null) { Obj_Machinery_AmShielding AMS = null; this.stability -= 20; if (Rand13.PercentChance(((int)(100 - this.stability)))) { foreach (dynamic _a in Lang13.Enumerate(this.linked_shielding, typeof(Obj_Machinery_AmShielding))) { AMS = _a; AMS.blob_act(); } GlobalFuncs.qdel(this); return(false); } this.check_stability(); return(false); }
// Function from file: control.dm public bool add_shielding(Obj_Machinery_AmShielding AMS = null, bool?AMS_linking = null) { AMS_linking = AMS_linking ?? false; if (!(AMS is Obj_Machinery_AmShielding)) { return(false); } if (!Lang13.Bool(this.anchored)) { return(false); } if (!(AMS_linking == true) && !AMS.link_control(this)) { return(false); } this.linked_shielding.Add(AMS); this.update_shield_icons = 1; return(true); }
// Function from file: shielding.dm public void controllerscan(bool?priorscan = null) { priorscan = priorscan ?? false; Obj_Machinery_AmShielding AMS = null; Obj_Machinery_AmShielding AMS2 = null; dynamic direction = null; Obj_Machinery_Power_AmControlUnit AMC = null; if (!(this.loc is Tile)) { GlobalFuncs.qdel(this); return; } foreach (dynamic _a in Lang13.Enumerate(this.loc.contents, typeof(Obj_Machinery_AmShielding))) { AMS = _a; if (AMS == this) { continue; } GlobalFuncs.qdel(this); return; } foreach (dynamic _b in Lang13.Enumerate(GlobalFuncs.cardinalrange(this), typeof(Obj_Machinery_AmShielding))) { AMS2 = _b; if (AMS2 != null && AMS2.control_unit != null && this.link_control(AMS2.control_unit)) { break; } } if (!(this.control_unit != null)) { foreach (dynamic _c in Lang13.Enumerate(GlobalVars.cardinal)) { direction = _c; } foreach (dynamic _d in Lang13.Enumerate(GlobalFuncs.cardinalrange(this), typeof(Obj_Machinery_Power_AmControlUnit))) { AMC = _d; if (AMC.add_shielding(this)) { break; } } } if (!(this.control_unit != null)) { if (!(priorscan == true)) { Task13.Schedule(20, (Task13.Closure)(() => { this.controllerscan(true); return; })); return; } GlobalFuncs.qdel(this); } return; }