// Function from file: mecha_pilot.dm public bool exit_mecha(Obj_Mecha M = null) { int search_aggressiveness = 0; Obj_Mecha_Combat C = null; if (!(M != null)) { return(false); } this.mecha.aimob_exit_mech(this); this.allow_movement_on_non_turfs = GlobalVars.FALSE; this.targets_from = this; this.wanted_objects = Lang13.GetTypes(typeof(Obj_Mecha_Combat)) - typeof(Obj_Mecha_Combat); search_aggressiveness = 2; foreach (dynamic _a in Lang13.Enumerate(Map13.FetchInRange(this, this.vision_range), typeof(Obj_Mecha_Combat))) { C = _a; if (this.is_valid_mecha(C)) { this.target = C; search_aggressiveness = 3; break; } } this.search_objects = search_aggressiveness; this.ranged = false; this.minimum_distance = 1; return(false); }
// Function from file: mecha_pilot.dm public override bool handle_automated_action( ) { Obj_Mecha_Combat C = null; ByTable L = null; int threat_count = 0; if (base.handle_automated_action()) { if (!(this.mecha != null)) { foreach (dynamic _a in Lang13.Enumerate(Map13.FetchInRange(this.vision_range, this), typeof(Obj_Mecha_Combat))) { C = _a; if (this.is_valid_mecha(C)) { this.target = C; this.minimum_distance = 1; this.ranged = false; break; } } } if (this.mecha != null) { L = this.PossibleThreats(); threat_count = L.len; if (!this.mecha.has_charge(this.mecha_charge_evacuate)) { this.exit_mecha(this.mecha); return(false); } if (this.mecha.health < Convert.ToDouble(Lang13.Initial(this.mecha, "health") * 0.1)) { this.exit_mecha(this.mecha); return(false); } if (threat_count >= this.threat_use_mecha_smoke && Rand13.PercentChance(this.smoke_chance)) { if (this.mecha.smoke_action != null && Lang13.Bool(this.mecha.smoke_action.owner) && this.mecha.smoke != 0) { this.mecha.smoke_action.Activate(); } } if (this.mecha.health < Convert.ToDouble(Lang13.Initial(this.mecha, "health") * 0.25)) { if (Rand13.PercentChance(this.defence_mode_chance)) { if (this.mecha.defense_action != null && Lang13.Bool(this.mecha.defense_action.owner) && !Lang13.Bool(this.mecha.defence_mode)) { this.mecha.leg_overload_mode = 0; this.mecha.defense_action.Activate(GlobalVars.TRUE); GlobalFuncs.addtimer(this.mecha.defense_action, "Activate", 100, GlobalVars.FALSE, GlobalVars.FALSE); } } else if (Rand13.PercentChance(this.retreat_chance)) { if (this.mecha.overload_action != null && Lang13.Bool(this.mecha.overload_action.owner) && !Lang13.Bool(this.mecha.leg_overload_mode)) { this.mecha.overload_action.Activate(GlobalVars.TRUE); GlobalFuncs.addtimer(this.mecha.overload_action, "Activate", 100, GlobalVars.FALSE, GlobalVars.FALSE); } this.retreat_distance = 50; Task13.Schedule(100, (Task13.Closure)(() => { this.retreat_distance = 0; return; })); } } } } return(false); }