// Function from file: atmos_control.dm public override int?process_atmos( ) { Signal signal = null; GasMixture air_sample = null; double total_moles = 0; dynamic gas_id = null; dynamic gas_name = null; if (this.on) { signal = new Signal(); air_sample = this.return_air(); signal.transmission_method = 1; signal.data = new ByTable() .Set("sigtype", "status") .Set("id_tag", this.id_tag) .Set("timestamp", Game13.time) .Set("pressure", air_sample.return_pressure()) .Set("temperature", air_sample.temperature) .Set("gases", new ByTable()) ; total_moles = air_sample.total_moles(); foreach (dynamic _a in Lang13.Enumerate(air_sample.gases)) { gas_id = _a; gas_name = air_sample.gases[gas_id][3][2]; signal.data["gases"][gas_name] = air_sample.gases[gas_id][1] / total_moles * 100; } this.radio_connection.post_signal(this, signal, GlobalVars.RADIO_ATMOSIA); } return(null); }
// Function from file: volume_pump.dm public override int?process_atmos( ) { GasMixture air1 = null; dynamic air2 = null; dynamic input_starting_pressure = null; dynamic output_starting_pressure = null; double? transfer_ratio = null; GasMixture removed = null; if ((this.stat & 3) != 0) { return(null); } if (!Lang13.Bool(this.on)) { return(0); } air1 = this.airs[1]; air2 = this.airs[2]; input_starting_pressure = air1.return_pressure(); output_starting_pressure = air2.return_pressure(); if (Convert.ToDouble(input_starting_pressure) < 0.01 || Convert.ToDouble(output_starting_pressure) > 9000) { return(1); } transfer_ratio = Num13.MinInt(1, ((int)(this.transfer_rate / (air1.volume ?? 0)))); removed = air1.remove_ratio(transfer_ratio); air2.merge(removed); this.update_parents(); return(1); }
// Function from file: meter.dm public string status( ) { string t = null; GasMixture environment = null; t = ""; if (Lang13.Bool(this.target)) { environment = ((Ent_Static)this.target).return_air(); if (environment != null) { t += "The pressure gauge reads " + Num13.Round(environment.return_pressure(), 0.01) + " kPa; " + Num13.Round(Convert.ToDouble(environment.temperature), 0.01) + " K (" + Num13.Round(Convert.ToDouble(environment.temperature - 273.41), 0.01) + "°C)"; } else { t += "The sensor error light is blinking."; } } else { t += "The connect error light is blinking."; } return(t); }
// Function from file: atmosmachinery.dm public virtual void unsafe_pressure_release(dynamic user = null, double?pressures = null) { GasMixture int_air = null; GasMixture env_air = null; dynamic fuck_you_dir = null; dynamic target = null; double? range = null; double speed = 0; if (!Lang13.Bool(user)) { return; } if (!Lang13.Bool(pressures)) { int_air = this.return_air(); env_air = this.loc.return_air(); pressures = int_air.return_pressure() - env_air.return_pressure(); } fuck_you_dir = Map13.GetDistance(this, user); if (!Lang13.Bool(fuck_you_dir)) { fuck_you_dir = Rand13.PickFromTable(GlobalVars.cardinal); } target = GlobalFuncs.get_edge_target_turf(user, fuck_you_dir); range = (pressures ?? 0) / 250; speed = (range ?? 0) / 5; ((Ent_Static)user).visible_message("<span class='danger'>" + user + " is sent flying by pressure!</span>", "<span class='userdanger'>The pressure sends you flying!</span>"); ((Ent_Dynamic)user).throw_at(target, range, speed); return; }
// Function from file: transit_tube_pod.dm public void mix_air( ) { GasMixture environment = null; double env_pressure = 0; double int_pressure = 0; double total_pressure = 0; int transfer_in = 0; int transfer_out = 0; dynamic from_env = null; GasMixture from_int = null; environment = this.loc.return_air(); env_pressure = environment.return_pressure(); int_pressure = this.air_contents.return_pressure(); total_pressure = env_pressure + int_pressure; if (total_pressure == 0) { return; } transfer_in = Num13.MaxInt(((int)(0.1)), ((int)((env_pressure - int_pressure) * 0.5 / total_pressure))); transfer_out = Num13.MaxInt(((int)(0.1)), ((int)((int_pressure - env_pressure) * 0.3 / total_pressure))); from_env = this.loc.remove_air(environment.total_moles() * transfer_in); from_int = this.air_contents.remove(this.air_contents.total_moles() * transfer_out); this.loc.assume_air(from_int); this.air_contents.merge(from_env); return; }
// Function from file: special.dm public Obj_Item_Projectile_Plasma(dynamic loc = null) : base((object)(loc)) { dynamic proj_turf = null; GasMixture environment = null; double pressure = 0; proj_turf = GlobalFuncs.get_turf(this); if (!(proj_turf is Tile)) { return; } environment = ((Ent_Static)proj_turf).return_air(); if (environment != null) { pressure = environment.return_pressure(); if (pressure < 30) { this.name = "full strength plasma blast"; this.damage *= 3; } } // Warning: Super call was HERE! If anything above HERE is needed by the super call, it might break!; return; }
// Function from file: atmosmachinery.dm public override dynamic attackby(dynamic A = null, dynamic user = null, string _params = null, bool?silent = null, bool?replace_spent = null) { dynamic T = null; GasMixture int_air = null; GasMixture env_air = null; int? unsafe_wrenching = null; double? internal_pressure = null; if (this.can_unwrench && A is Obj_Item_Weapon_Wrench) { T = GlobalFuncs.get_turf(this); if (this.level == 1 && T is Tile && T.intact) { user.WriteMsg("<span class='warning'>You must remove the plating first!</span>"); return(1); } int_air = this.return_air(); env_air = this.loc.return_air(); this.add_fingerprint(user); unsafe_wrenching = GlobalVars.FALSE; internal_pressure = int_air.return_pressure() - env_air.return_pressure(); GlobalFuncs.playsound(this.loc, "sound/items/ratchet.ogg", 50, 1); user.WriteMsg(new Txt("<span class='notice'>You begin to unfasten ").the(this).item().str("...</span>").ToString()); if ((internal_pressure ?? 0) > 202.41) { user.WriteMsg(new Txt("<span class='warning'>As you begin unwrenching ").the(this).item().str(" a gush of air blows in your face... maybe you should reconsider?</span>").ToString()); unsafe_wrenching = GlobalVars.TRUE; } if (GlobalFuncs.do_after(user, 20 / A.toolspeed, null, this) && !Lang13.Bool(this.gc_destroyed)) { ((Ent_Static)user).visible_message(new Txt().item(user).str(" unfastens ").the(this).item().str(".").ToString(), new Txt("<span class='notice'>You unfasten ").the(this).item().str(".</span>").ToString(), "<span class='italics'>You hear ratchet.</span>"); this.investigate_log("was <span class='warning'>REMOVED</span> by " + GlobalFuncs.key_name(Task13.User), "atmos"); if (Lang13.Bool(unsafe_wrenching)) { this.unsafe_pressure_release(user, internal_pressure); } this.Deconstruct(); } } else { return(base.attackby((object)(A), (object)(user), _params, silent, replace_spent)); } return(null); }
// Function from file: honker.dm public override string get_stats_part( ) { double integrity = 0; int? cell_charge = null; GasMixture int_tank_air = null; dynamic tank_pressure = null; dynamic tank_temperature = null; double cabin_pressure = 0; string output = null; integrity = this.health / Convert.ToDouble(Lang13.Initial(this, "health")) * 100; cell_charge = this.get_charge(); int_tank_air = this.internal_tank.return_air(); tank_pressure = (this.internal_tank != null ? ((dynamic)(Num13.Round(int_tank_air.return_pressure(), 0.01))) : ((dynamic)("None"))); tank_temperature = (this.internal_tank != null ? int_tank_air.temperature : ((dynamic)("Unknown"))); cabin_pressure = Num13.Round(this.return_pressure(), 0.01); output = "" + this.report_internal_damage() + "\n "+ (integrity < 30 ? "<font color='red'><b>DAMAGE LEVEL CRITICAL</b></font><br>" : null) + "\n "+ ((this.internal_damage & 2) != 0 ? "<font color='red'><b>CLOWN SUPPORT SYSTEM MALFUNCTION</b></font><br>" : null) + "\n "+ ((this.internal_damage & 8) != 0 ? "<font color='red'><b>GAS TANK HONK</b></font><br>" : null) + "\n "+ ((this.internal_damage & 16) != 0 ? new Txt("<font color='red'><b>HONK-A-DOODLE</b></font> - <a href='?src=").Ref(this).str(";repair_int_control_lost=1'>Recalibrate</a><br>").ToString() : null) + "\n <b>IntegriHONK: </b> "+ integrity + "%<br>\n <b>PowerHONK charge: </b>"+ (cell_charge == null ? "No powercell installed" : "" + ((Obj_Item_Weapon_StockParts_Cell)this.cell).percent() + "%") + "<br>\n <b>Air source: </b>"+ (this.use_internal_tank ? "Internal Airtank" : "Environment") + "<br>\n <b>AirHONK pressure: </b>"+ tank_pressure + "kPa<br>\n <b>AirHONK temperature: </b>"+ tank_temperature + "°K|" + (tank_temperature - 273.41) + "°C<br>\n <b>HONK pressure: </b>"+ (cabin_pressure > 325 ? ((dynamic)("<font color='red'>" + cabin_pressure + "</font>")) : ((dynamic)(cabin_pressure))) + "kPa<br>\n <b>HONK temperature: </b> "+ this.return_temperature() + "°K|" + (this.return_temperature() - 273.41) + "°C<br>\n <b>Lights: </b>"+ (this.lights ? "on" : "off") + "<br>\n "+ (Lang13.Bool(this.dna_lock) ? new Txt("<b>DNA-locked:</b><br> <span style='font-size:10px;letter-spacing:-1px;'>").item(this.dna_lock).str("</span> [<a href='?src=").Ref(this).str(";reset_dna=1'>Reset</a>]<br>").ToString() : null) + "\n "; return(output); }
// Function from file: unsorted.dm public void atmosanalyzer_scan(GasMixture air_contents = null, dynamic user = null, dynamic target = null) { target = target ?? this; dynamic icon = null; double pressure = 0; double total_moles = 0; ByTable cached_gases = null; dynamic id = null; double gas_concentration = 0; icon = target; ((Ent_Static)user).visible_message(new Txt().item(user).str(" has used the analyzer on ").icon(icon).str(" ").item(target).str(".").ToString(), new Txt("<span class='notice'>You use the analyzer on ").icon(icon).str(" ").item(target).str(".</span>").ToString()); pressure = air_contents.return_pressure(); total_moles = air_contents.total_moles(); user.WriteMsg(new Txt("<span class='notice'>Results of analysis of ").icon(icon).str(" ").item(target).str(".</span>").ToString()); if (total_moles > 0) { user.WriteMsg("<span class='notice'>Pressure: " + Num13.Round(pressure, 0.1) + " kPa</span>"); cached_gases = air_contents.gases; foreach (dynamic _a in Lang13.Enumerate(cached_gases)) { id = _a; gas_concentration = Convert.ToDouble(cached_gases[id][1] / total_moles); if (Lang13.Bool(((dynamic)(GlobalVars.hardcoded_gases != null || gas_concentration > 0.01)).Contains(id))) { user.WriteMsg("<span class='notice'>" + cached_gases[id][3][2] + ": " + Num13.Floor(gas_concentration * 100) + " %</span>"); } } user.WriteMsg("<span class='notice'>Temperature: " + Num13.Floor(Convert.ToDouble(air_contents.temperature - 273.41)) + " °C</span>"); } else { user.WriteMsg("<span class='notice'>" + target + " is empty!</span>"); } return; }
// Function from file: airlock_control.dm public override int?process(dynamic seconds = null) { Signal signal = null; GasMixture air_sample = null; double pressure = 0; if (this.on) { signal = new Signal(); signal.transmission_method = 1; signal.data["tag"] = this.id_tag; signal.data["timestamp"] = Game13.time; air_sample = this.return_air(); pressure = Num13.Round(air_sample.return_pressure(), 0.1); this.alert = pressure < 81.51; signal.data["pressure"] = String13.NumberToString(pressure); this.radio_connection.post_signal(this, signal, GlobalVars.RADIO_AIRLOCK, 5); } this.update_icon(); return(null); }
// Function from file: passive_gate.dm public override int?process_atmos( ) { GasMixture air1 = null; dynamic air2 = null; dynamic output_starting_pressure = null; dynamic input_starting_pressure = null; int pressure_delta = 0; double transfer_moles = 0; GasMixture removed = null; base.process_atmos(); if (!Lang13.Bool(this.on)) { return(0); } air1 = this.airs[1]; air2 = this.airs[2]; output_starting_pressure = air2.return_pressure(); input_starting_pressure = air1.return_pressure(); if (Convert.ToDouble(output_starting_pressure) >= Num13.MinInt(((int)(this.target_pressure)), Convert.ToInt32(input_starting_pressure - 10))) { return(1); } if (air1.total_moles() > 0 && Convert.ToDouble(air1.temperature) > 0) { pressure_delta = Num13.MinInt(((int)(this.target_pressure - Convert.ToDouble(output_starting_pressure))), Convert.ToInt32((input_starting_pressure - output_starting_pressure) / 2)); transfer_moles = pressure_delta * Convert.ToDouble(air2.volume) / Convert.ToDouble(air1.temperature * 8.31); removed = air1.remove(transfer_moles); air2.merge(removed); this.update_parents(); } return(null); }
// Function from file: ripley.dm public void update_pressure( ) { dynamic T = null; GasMixture environment = null; double pressure = 0; Obj_Item_MechaParts_MechaEquipment_Drill drill = null; Obj_Item_MechaParts_MechaEquipment_Drill drill2 = null; T = GlobalFuncs.get_turf(this.loc); environment = ((Ent_Static)T).return_air(); pressure = environment.return_pressure(); if (pressure < 20) { this.step_in = 3; foreach (dynamic _a in Lang13.Enumerate(this.equipment, typeof(Obj_Item_MechaParts_MechaEquipment_Drill))) { drill = _a; drill.equip_cooldown = Lang13.Initial(drill, "equip_cooldown") / 2; } } else { this.step_in = 5; foreach (dynamic _b in Lang13.Enumerate(this.equipment, typeof(Obj_Item_MechaParts_MechaEquipment_Drill))) { drill2 = _b; drill2.equip_cooldown = Lang13.Initial(drill2, "equip_cooldown"); } } return; }
// Function from file: airalarm.dm public override ByTable ui_data(dynamic user = null) { ByTable data = null; dynamic A = null; dynamic T = null; GasMixture environment = null; Tlv cur_tlv = null; double pressure = 0; dynamic temperature = null; double total_moles = 0; dynamic partial_pressure = null; dynamic gas_id = null; dynamic id_tag = null; dynamic long_name = null; dynamic info = null; dynamic id_tag2 = null; dynamic long_name2 = null; dynamic info2 = null; Tlv selected = null; ByTable thresholds = null; dynamic gas_id2 = null; data = new ByTable().Set("locked", this.locked).Set("siliconUser", user.has_unlimited_silicon_privilege).Set("emagged", this.emagged).Set("danger_level", this.danger_level); A = GlobalFuncs.get_area(this); data["atmos_alarm"] = A.atmosalm; data["fire_alarm"] = A.fire; T = GlobalFuncs.get_turf(this); environment = ((Ent_Static)T).return_air(); data["environment_data"] = new ByTable(); pressure = environment.return_pressure(); cur_tlv = this.TLV["pressure"]; data["environment_data"] += new ByTable(new object [] { new ByTable().Set("name", "Pressure").Set("value", pressure).Set("unit", "kPa").Set("danger_level", cur_tlv.get_danger_level(pressure)) }); temperature = environment.temperature; cur_tlv = this.TLV["temperature"]; data["environment_data"] += new ByTable(new object [] { new ByTable() .Set("name", "Temperature") .Set("value", temperature) .Set("unit", "K (" + Num13.Round(Convert.ToDouble(temperature - 273.41), 0.1) + "C)") .Set("danger_level", cur_tlv.get_danger_level(temperature)) }); total_moles = environment.total_moles(); partial_pressure = environment.temperature * 8.31 / environment.volume; foreach (dynamic _a in Lang13.Enumerate(environment.gases)) { gas_id = _a; if (!this.TLV.Contains(gas_id)) { continue; } cur_tlv = this.TLV[gas_id]; data["environment_data"] += new ByTable(new object [] { new ByTable() .Set("name", environment.gases[gas_id][3][2]) .Set("value", environment.gases[gas_id][1] / total_moles * 100) .Set("unit", "%") .Set("danger_level", cur_tlv.get_danger_level(environment.gases[gas_id][1] * partial_pressure)) }); } if (!this.locked || user.has_unlimited_silicon_privilege) { data["vents"] = new ByTable(); foreach (dynamic _b in Lang13.Enumerate(A.air_vent_names)) { id_tag = _b; long_name = A.air_vent_names[id_tag]; info = A.air_vent_info[id_tag]; if (!Lang13.Bool(info) || Convert.ToDouble(info["frequency"]) != this.frequency) { continue; } data["vents"] += new ByTable(new object [] { new ByTable() .Set("id_tag", id_tag) .Set("long_name", GlobalFuncs.sanitize(long_name)) .Set("power", info["power"]) .Set("checks", info["checks"]) .Set("excheck", info["checks"] & 1) .Set("incheck", info["checks"] & 2) .Set("direction", info["direction"]) .Set("external", info["external"]) .Set("extdefault", Convert.ToDouble(info["external"]) == 101.32499694824219) }); } data["scrubbers"] = new ByTable(); foreach (dynamic _c in Lang13.Enumerate(A.air_scrub_names)) { id_tag2 = _c; long_name2 = A.air_scrub_names[id_tag2]; info2 = A.air_scrub_info[id_tag2]; if (!Lang13.Bool(info2) || Convert.ToDouble(info2["frequency"]) != this.frequency) { continue; } data["scrubbers"] += new ByTable(new object [] { new ByTable() .Set("id_tag", id_tag2) .Set("long_name", GlobalFuncs.sanitize(long_name2)) .Set("power", info2["power"]) .Set("scrubbing", info2["scrubbing"]) .Set("widenet", info2["widenet"]) .Set("filter_co2", info2["filter_co2"]) .Set("filter_toxins", info2["filter_toxins"]) .Set("filter_n2o", info2["filter_n2o"]) }); } data["mode"] = this.mode; data["modes"] = new ByTable(); data["modes"] += new ByTable(new object [] { new ByTable().Set("name", "Filtering - Scrubs out contaminants").Set("mode", 1).Set("selected", this.mode == 1).Set("danger", 0) }); data["modes"] += new ByTable(new object [] { new ByTable().Set("name", "Contaminated - Scrubs out ALL contaminants quickly").Set("mode", 8).Set("selected", this.mode == 8).Set("danger", 0) }); data["modes"] += new ByTable(new object [] { new ByTable().Set("name", "Draught - Siphons out air while replacing").Set("mode", 2).Set("selected", this.mode == 2).Set("danger", 0) }); data["modes"] += new ByTable(new object [] { new ByTable().Set("name", "Refill - Triple vent output").Set("mode", 9).Set("selected", this.mode == 9).Set("danger", 0) }); data["modes"] += new ByTable(new object [] { new ByTable().Set("name", "Cycle - Siphons air before replacing").Set("mode", 4).Set("selected", this.mode == 4).Set("danger", 1) }); data["modes"] += new ByTable(new object [] { new ByTable().Set("name", "Siphon - Siphons air out of the room").Set("mode", 7).Set("selected", this.mode == 7).Set("danger", 1) }); data["modes"] += new ByTable(new object [] { new ByTable().Set("name", "Panic Siphon - Siphons air out of the room quickly").Set("mode", 3).Set("selected", this.mode == 3).Set("danger", 1) }); data["modes"] += new ByTable(new object [] { new ByTable().Set("name", "Off - Shuts off vents and scrubbers").Set("mode", 5).Set("selected", this.mode == 5).Set("danger", 0) }); if (Lang13.Bool(this.emagged)) { data["modes"] += new ByTable(new object [] { new ByTable().Set("name", "Flood - Shuts off scrubbers and opens vents").Set("mode", 6).Set("selected", this.mode == 6).Set("danger", 1) }); } selected = null; thresholds = new ByTable(); selected = this.TLV["pressure"]; thresholds.Add(new ByTable(new object [] { new ByTable().Set("name", "Pressure").Set("settings", new ByTable()) })); thresholds[thresholds.len]["settings"] += new ByTable(new object [] { new ByTable().Set("env", "pressure").Set("val", "min2").Set("selected", selected.min2) }); thresholds[thresholds.len]["settings"] += new ByTable(new object [] { new ByTable().Set("env", "pressure").Set("val", "min1").Set("selected", selected.min1) }); thresholds[thresholds.len]["settings"] += new ByTable(new object [] { new ByTable().Set("env", "pressure").Set("val", "max1").Set("selected", selected.max1) }); thresholds[thresholds.len]["settings"] += new ByTable(new object [] { new ByTable().Set("env", "pressure").Set("val", "max2").Set("selected", selected.max2) }); selected = this.TLV["temperature"]; thresholds.Add(new ByTable(new object [] { new ByTable().Set("name", "Temperature").Set("settings", new ByTable()) })); thresholds[thresholds.len]["settings"] += new ByTable(new object [] { new ByTable().Set("env", "temperature").Set("val", "min2").Set("selected", selected.min2) }); thresholds[thresholds.len]["settings"] += new ByTable(new object [] { new ByTable().Set("env", "temperature").Set("val", "min1").Set("selected", selected.min1) }); thresholds[thresholds.len]["settings"] += new ByTable(new object [] { new ByTable().Set("env", "temperature").Set("val", "max1").Set("selected", selected.max1) }); thresholds[thresholds.len]["settings"] += new ByTable(new object [] { new ByTable().Set("env", "temperature").Set("val", "max2").Set("selected", selected.max2) }); foreach (dynamic _d in Lang13.Enumerate(GlobalVars.meta_gas_info)) { gas_id2 = _d; if (!this.TLV.Contains(gas_id2)) { continue; } selected = this.TLV[gas_id2]; thresholds.Add(new ByTable(new object [] { new ByTable().Set("name", GlobalVars.meta_gas_info[gas_id2][2]).Set("settings", new ByTable()) })); thresholds[thresholds.len]["settings"] += new ByTable(new object [] { new ByTable().Set("env", gas_id2).Set("val", "min2").Set("selected", selected.min2) }); thresholds[thresholds.len]["settings"] += new ByTable(new object [] { new ByTable().Set("env", gas_id2).Set("val", "min1").Set("selected", selected.min1) }); thresholds[thresholds.len]["settings"] += new ByTable(new object [] { new ByTable().Set("env", gas_id2).Set("val", "max1").Set("selected", selected.max1) }); thresholds[thresholds.len]["settings"] += new ByTable(new object [] { new ByTable().Set("env", gas_id2).Set("val", "max2").Set("selected", selected.max2) }); } data["thresholds"] = thresholds; } return(data); }
// Function from file: airalarm.dm public override int?process(dynamic seconds = null) { dynamic location = null; Tlv cur_tlv = null; GasMixture environment = null; ByTable env_gases = null; dynamic partial_pressure = null; double environment_pressure = 0; int pressure_dangerlevel = 0; int temperature_dangerlevel = 0; int gas_dangerlevel = 0; dynamic gas_id = null; int old_danger_level = 0; if ((this.stat & 3) != 0 || Lang13.Bool(this.shorted)) { return(null); } location = GlobalFuncs.get_turf(this); if (!Lang13.Bool(location)) { return(null); } environment = ((Ent_Static)location).return_air(); env_gases = environment.gases; partial_pressure = environment.temperature * 8.31 / environment.volume; cur_tlv = this.TLV["pressure"]; environment_pressure = environment.return_pressure(); pressure_dangerlevel = cur_tlv.get_danger_level(environment_pressure); cur_tlv = this.TLV["temperature"]; temperature_dangerlevel = cur_tlv.get_danger_level(environment.temperature); gas_dangerlevel = 0; foreach (dynamic _a in Lang13.Enumerate(env_gases)) { gas_id = _a; if (!this.TLV.Contains(gas_id)) { continue; } cur_tlv = this.TLV[gas_id]; gas_dangerlevel = Num13.MaxInt(gas_dangerlevel, cur_tlv.get_danger_level(env_gases[gas_id][1] * partial_pressure)); } environment.garbage_collect(); old_danger_level = this.danger_level; this.danger_level = Num13.MaxInt(pressure_dangerlevel, temperature_dangerlevel, gas_dangerlevel); if (old_danger_level != this.danger_level) { this.apply_danger_level(); } if (this.mode == 4 && environment_pressure < 5.066249847412109) { this.mode = 1; this.apply_mode(); } return(null); }
// Function from file: equipment_locker.dm public Obj_Effect_Resonance(dynamic loc = null, dynamic creator = null, int timetoburst = 0) : base((object)(loc)) { dynamic proj_turf = null; dynamic M = null; GasMixture environment = null; double pressure = 0; Mob_Living L = null; Mob_Living L2 = null; proj_turf = GlobalFuncs.get_turf(this); if (!(proj_turf is Tile)) { return; } if (proj_turf is Tile_Simulated_Mineral) { M = proj_turf; Task13.Schedule(timetoburst, (Task13.Closure)(() => { GlobalFuncs.playsound(this, "sound/weapons/resonator_blast.ogg", 50, 1); M.gets_drilled(creator); GlobalFuncs.qdel(this); return; })); } else { environment = ((Ent_Static)proj_turf).return_air(); pressure = environment.return_pressure(); if (pressure < 50) { this.name = "strong resonance field"; this.resonance_damage = 50; } Task13.Schedule(timetoburst, (Task13.Closure)(() => { GlobalFuncs.playsound(this, "sound/weapons/resonator_blast.ogg", 50, 1); if (Lang13.Bool(creator)) { foreach (dynamic _a in Lang13.Enumerate(this.loc, typeof(Mob_Living))) { L = _a; GlobalFuncs.add_logs(creator, L, "used a resonator field on", "resonator"); L.WriteMsg("<span class='danger'>The " + this.name + " ruptured with you in it!</span>"); L.adjustBruteLoss(this.resonance_damage); } } else { foreach (dynamic _b in Lang13.Enumerate(this.loc, typeof(Mob_Living))) { L2 = _b; L2.WriteMsg("<span class='danger'>The " + this.name + " ruptured with you in it!</span>"); L2.adjustBruteLoss(this.resonance_damage); } } GlobalFuncs.qdel(this); return; })); } return; }
// Function from file: dp_vent_pump.dm public override int?process_atmos( ) { dynamic air1 = null; dynamic air2 = null; GasMixture environment = null; double environment_pressure = 0; int pressure_delta = 0; double transfer_moles = 0; dynamic removed = null; dynamic parent1 = null; int pressure_delta2 = 0; double transfer_moles2 = 0; dynamic removed2 = null; dynamic parent2 = null; base.process_atmos(); if (!Lang13.Bool(this.on)) { return(0); } air1 = this.airs[1]; air2 = this.airs[2]; environment = this.loc.return_air(); environment_pressure = environment.return_pressure(); if (Lang13.Bool(this.pump_direction)) { pressure_delta = 10000; if ((((int)(this.pressure_checks ?? 0)) & 1) != 0) { pressure_delta = Num13.MinInt(pressure_delta, ((int)(this.external_pressure_bound - environment_pressure))); } if ((((int)(this.pressure_checks ?? 0)) & 2) != 0) { pressure_delta = Num13.MinInt(pressure_delta, Convert.ToInt32(air1.return_pressure() - this.input_pressure_min)); } if (pressure_delta > 0) { if (Convert.ToDouble(air1.temperature) > 0) { transfer_moles = pressure_delta * (environment.volume ?? 0) / Convert.ToDouble(air1.temperature * 8.31); removed = air1.remove(transfer_moles); this.loc.assume_air(removed); this.air_update_turf(); parent1 = this.parents[1]; parent1.update = 1; } } } else { pressure_delta2 = 10000; if ((((int)(this.pressure_checks ?? 0)) & 1) != 0) { pressure_delta2 = Num13.MinInt(pressure_delta2, ((int)(environment_pressure - this.external_pressure_bound))); } if ((((int)(this.pressure_checks ?? 0)) & 2) != 0) { pressure_delta2 = Num13.MinInt(pressure_delta2, ((int)(this.output_pressure_max - Convert.ToDouble(air2.return_pressure())))); } if (pressure_delta2 > 0) { if (Convert.ToDouble(environment.temperature) > 0) { transfer_moles2 = pressure_delta2 * Convert.ToDouble(air2.volume) / Convert.ToDouble(environment.temperature * 8.31); removed2 = this.loc.remove_air(transfer_moles2); air2.merge(removed2); this.air_update_turf(); parent2 = this.parents[2]; parent2.update = 1; } } } return(1); }
// Function from file: life.dm public override void handle_environment(GasMixture environment = null) { dynamic loc_temp = null; dynamic pressure = null; dynamic adjusted_pressure = null; if (!(environment != null)) { return; } loc_temp = this.get_temperature(environment); if (this.stat != 2) { this.natural_bodytemperature_stabilization(); } if (!this.on_fire) { if (Convert.ToDouble(loc_temp) < Convert.ToDouble(this.bodytemperature)) { this.bodytemperature += Num13.MinInt(Convert.ToInt32((loc_temp - this.bodytemperature) / 6), 30); } else { this.bodytemperature += Num13.MinInt(Convert.ToInt32((loc_temp - this.bodytemperature) / 6), 30); } } if (Convert.ToDouble(this.bodytemperature) > 360.41) { dynamic _a = this.bodytemperature; // Was a switch-case, sorry for the mess. if (360 <= _a && _a <= 400) { this.throw_alert("temp", typeof(Obj_Screen_Alert_Hot), 1); this.adjustFireLoss(2); } else if (400 <= _a && _a <= 460) { this.throw_alert("temp", typeof(Obj_Screen_Alert_Hot), 2); this.adjustFireLoss(3); } else if (460 <= _a && _a <= Double.PositiveInfinity) { this.throw_alert("temp", typeof(Obj_Screen_Alert_Hot), 3); if (this.on_fire) { this.adjustFireLoss(8); } else { this.adjustFireLoss(3); } } } else if (Convert.ToDouble(this.bodytemperature) < 260.41) { if (!(this.loc is Obj_Machinery_Atmospherics_Components_Unary_CryoCell)) { dynamic _b = this.bodytemperature; // Was a switch-case, sorry for the mess. if (200 <= _b && _b <= 260) { this.throw_alert("temp", typeof(Obj_Screen_Alert_Cold), 1); this.adjustFireLoss(0.5); } else if (120 <= _b && _b <= 200) { this.throw_alert("temp", typeof(Obj_Screen_Alert_Cold), 2); this.adjustFireLoss(1.5); } else if (Double.NegativeInfinity <= _b && _b <= 120) { this.throw_alert("temp", typeof(Obj_Screen_Alert_Cold), 3); this.adjustFireLoss(3); } } else { this.clear_alert("temp"); } } else { this.clear_alert("temp"); } pressure = environment.return_pressure(); adjusted_pressure = this.calculate_affecting_pressure(pressure); dynamic _c = adjusted_pressure; // Was a switch-case, sorry for the mess. if (550 <= _c && _c <= Double.PositiveInfinity) { this.adjustBruteLoss(Num13.MinInt(Convert.ToInt32((adjusted_pressure / 550 - 1) * 4), 4)); this.throw_alert("pressure", typeof(Obj_Screen_Alert_Highpressure), 2); } else if (325 <= _c && _c <= 550) { this.throw_alert("pressure", typeof(Obj_Screen_Alert_Highpressure), 1); } else if (50 <= _c && _c <= 325) { this.clear_alert("pressure"); } else if (20 <= _c && _c <= 50) { this.throw_alert("pressure", typeof(Obj_Screen_Alert_Lowpressure), 1); } else { this.adjustBruteLoss(2); this.throw_alert("pressure", typeof(Obj_Screen_Alert_Lowpressure), 2); } return; }
// Function from file: scanners.dm public override dynamic attack_self(dynamic user = null, dynamic flag = null, bool?emp = null) { Ent_Static location = null; GasMixture environment = null; double pressure = 0; double total_moles = 0; ByTable env_gases = null; dynamic o2_concentration = null; dynamic n2_concentration = null; double co2_concentration = 0; double plasma_concentration = 0; dynamic id = null; dynamic gas_concentration = null; this.add_fingerprint(user); if (Lang13.Bool(user.stat) || user.eye_blind != 0) { return(null); } location = user.loc; if (!(location is Tile)) { return(null); } environment = location.return_air(); pressure = environment.return_pressure(); total_moles = environment.total_moles(); user.WriteMsg("<span class='info'><B>Results:</B></span>"); if (Math.Abs(pressure - 101.32499694824219) < 10) { user.WriteMsg("<span class='info'>Pressure: " + Num13.Round(pressure, 0.1) + " kPa</span>"); } else { user.WriteMsg("<span class='alert'>Pressure: " + Num13.Round(pressure, 0.1) + " kPa</span>"); } if (total_moles != 0) { env_gases = environment.gases; GlobalVars.hardcoded_gases.Apply(Lang13.BindFunc(environment, "assert_gases")); o2_concentration = env_gases["o2"][1] / total_moles; n2_concentration = env_gases["n2"][1] / total_moles; co2_concentration = Convert.ToDouble(env_gases["co2"][1] / total_moles); plasma_concentration = Convert.ToDouble(env_gases["plasma"][1] / total_moles); environment.garbage_collect(); if (Math.Abs(Convert.ToDouble(n2_concentration - 0.79)) < 20) { user.WriteMsg("<span class='info'>Nitrogen: " + Num13.Floor(Convert.ToDouble(n2_concentration * 100)) + " %</span>"); } else { user.WriteMsg("<span class='alert'>Nitrogen: " + Num13.Floor(Convert.ToDouble(n2_concentration * 100)) + " %</span>"); } if (Math.Abs(Convert.ToDouble(o2_concentration - 0.01)) < 2) { user.WriteMsg("<span class='info'>Oxygen: " + Num13.Floor(Convert.ToDouble(o2_concentration * 100)) + " %</span>"); } else { user.WriteMsg("<span class='alert'>Oxygen: " + Num13.Floor(Convert.ToDouble(o2_concentration * 100)) + " %</span>"); } if (co2_concentration > 0.01) { user.WriteMsg("<span class='alert'>CO2: " + Num13.Floor(co2_concentration * 100) + " %</span>"); } else { user.WriteMsg("<span class='info'>CO2: " + Num13.Floor(co2_concentration * 100) + " %</span>"); } if (plasma_concentration > 0.01) { user.WriteMsg("<span class='info'>Plasma: " + Num13.Floor(plasma_concentration * 100) + " %</span>"); } foreach (dynamic _a in Lang13.Enumerate(env_gases)) { id = _a; if (GlobalVars.hardcoded_gases.Contains(id)) { continue; } gas_concentration = env_gases[id][1] / total_moles; user.WriteMsg("<span class='alert'>" + env_gases[id][3][2] + ": " + Num13.Floor(Convert.ToDouble(gas_concentration * 100)) + " %</span>"); } user.WriteMsg("<span class='info'>Temperature: " + Num13.Floor(Convert.ToDouble(environment.temperature - 273.41)) + " °C</span>"); } return(null); }
// Function from file: swarmer.dm public void DisperseTarget(Mob_Living target = null) { int cycle = 0; Tile random_location = null; Tile F = null; GasMixture A = null; ByTable A_gases = null; int? trace_gases = null; dynamic id = null; double pressure = 0; Obj_Item_Weapon_Restraints_Handcuffs_Cable_Zipties Z = null; Mob_Living H = null; if (target != this) { this.WriteMsg("<span class='info'>Attempting to remove this being from our presence.</span>"); if (this.z != 1) { this.WriteMsg("<span class='warning'>Our bluespace transceiver cannot locate a viable bluespace link, our teleportation abilities are useless in this area.</span>"); return; } if (GlobalFuncs.do_mob(this, target, 30)) { cycle = 0; while (cycle < 100) { random_location = Map13.GetTile(Rand13.Int(37, 202), Rand13.Int(75, 192), 1); if (random_location is Tile_Simulated_Floor) { F = random_location; if (Lang13.Bool(((dynamic)F).air)) { A = ((dynamic)F).air; A_gases = A.gases; trace_gases = null; foreach (dynamic _a in Lang13.Enumerate(A_gases)) { id = _a; if (GlobalVars.hardcoded_gases.Contains(id)) { continue; } trace_gases = GlobalVars.TRUE; break; } if (Lang13.Bool(A_gases["o2"]) && Convert.ToDouble(A_gases["o2"][1]) >= 16 && !Lang13.Bool(A_gases["plasma"]) && (!Lang13.Bool(A_gases["co2"]) || Convert.ToDouble(A_gases["co2"][1]) < 10) && !Lang13.Bool(trace_gases)) { if (Convert.ToDouble(A.temperature) > 270 && Convert.ToDouble(A.temperature) < 360) { pressure = A.return_pressure(); if (pressure > 20 && pressure < 550) { if (target is Mob_Living_Carbon_Human) { Z = new Obj_Item_Weapon_Restraints_Handcuffs_Cable_Zipties(this); H = target; Z.apply_cuffs(H, this); } GlobalFuncs.do_teleport(target, F, 0); GlobalFuncs.playsound(this, "sound/effects/sparks4.ogg", 50, 1); break; } } } } } cycle++; } return; } } return; }
// Function from file: vent_pump.dm public override int?process_atmos( ) { dynamic air_contents = null; GasMixture environment = null; double environment_pressure = 0; int pressure_delta = 0; double transfer_moles = 0; dynamic removed = null; int pressure_delta2 = 0; double transfer_moles2 = 0; dynamic removed2 = null; base.process_atmos(); if ((this.stat & 3) != 0) { return(null); } if (!Lang13.Bool(this.nodes[1])) { this.on = 0; } if (!Lang13.Bool(this.on) || this.welded == true) { return(0); } air_contents = this.airs[1]; environment = this.loc.return_air(); environment_pressure = environment.return_pressure(); if ((((int)(this.pump_direction ?? 0)) & 1) != 0) { pressure_delta = 10000; if ((((int)(this.pressure_checks ?? 0)) & 1) != 0) { pressure_delta = Num13.MinInt(pressure_delta, ((int)(this.external_pressure_bound - environment_pressure))); } if ((((int)(this.pressure_checks ?? 0)) & 2) != 0) { pressure_delta = Num13.MinInt(pressure_delta, Convert.ToInt32(air_contents.return_pressure() - this.internal_pressure_bound)); } if (pressure_delta > 0) { if (Convert.ToDouble(air_contents.temperature) > 0) { transfer_moles = pressure_delta * (environment.volume ?? 0) / Convert.ToDouble(air_contents.temperature * 8.31); removed = air_contents.remove(transfer_moles); this.loc.assume_air(removed); this.air_update_turf(); } } } else { pressure_delta2 = 10000; if ((((int)(this.pressure_checks ?? 0)) & 1) != 0) { pressure_delta2 = Num13.MinInt(pressure_delta2, ((int)(environment_pressure - this.external_pressure_bound))); } if ((((int)(this.pressure_checks ?? 0)) & 2) != 0) { pressure_delta2 = Num13.MinInt(pressure_delta2, ((int)(this.internal_pressure_bound - Convert.ToDouble(air_contents.return_pressure())))); } if (pressure_delta2 > 0) { if (Convert.ToDouble(environment.temperature) > 0) { transfer_moles2 = pressure_delta2 * Convert.ToDouble(air_contents.volume) / Convert.ToDouble(environment.temperature * 8.31); removed2 = this.loc.remove_air(transfer_moles2); if (removed2 == null) { return(null); } air_contents.merge(removed2); this.air_update_turf(); } } } this.update_parents(); return(1); }
// Function from file: meter.dm public override int?process_atmos( ) { GasMixture environment = null; double env_pressure = 0; int val = 0; int val2 = 0; int val3 = 0; RadioFrequency radio_connection = null; Signal signal = null; if (!Lang13.Bool(this.target)) { this.icon_state = "meterX"; return(0); } if ((this.stat & 3) != 0) { this.icon_state = "meter0"; return(0); } this.f_use_power(5); environment = ((Ent_Static)this.target).return_air(); if (!(environment != null)) { this.icon_state = "meterX"; return(0); } env_pressure = environment.return_pressure(); if (env_pressure <= 15.198750495910645) { this.icon_state = "meter0"; } else if (env_pressure <= 182.38499450683594) { val = Num13.Floor(env_pressure / 30.39750099182129 + 0.5); this.icon_state = "meter1_" + val; } else if (env_pressure <= 3039.75) { val2 = Num13.Floor(env_pressure / 506.625 - 0.41) + 1; this.icon_state = "meter2_" + val2; } else if (env_pressure <= 5978.1748046875) { val3 = Num13.Floor(env_pressure / 506.625 - 6) + 1; this.icon_state = "meter3_" + val3; } else { this.icon_state = "meter4"; } if (this.frequency != 0) { radio_connection = GlobalVars.SSradio.return_frequency(this.frequency); if (!(radio_connection != null)) { return(null); } signal = new Signal(); signal.source = this; signal.transmission_method = 1; signal.data = new ByTable().Set("id_tag", this.id_tag).Set("device", "AM").Set("pressure", Num13.Floor(env_pressure)).Set("sigtype", "status"); radio_connection.post_signal(this, signal); } return(null); }
// Function from file: guardian.dm public override void AltClickOn(Ent_Static A = null) { GasMixture Z = null; ByTable Z_gases = null; int? trace_gases = null; dynamic id = null; double pressure = 0; if (!(A is Ent_Dynamic)) { return; } if (this.loc == this.summoner) { this.WriteMsg("<span class='danger'><B>You must be manifested to warp a target!</span></B>"); return; } if (!Lang13.Bool(this.beacon)) { this.WriteMsg("<span class='danger'><B>You need a beacon placed to warp things!</span></B>"); return; } if (!this.Adjacent(A)) { this.WriteMsg("<span class='danger'><B>You must be adjacent to your target!</span></B>"); return; } if (Lang13.Bool(((dynamic)A).anchored)) { this.WriteMsg("<span class='danger'><B>Your target cannot be anchored!</span></B>"); return; } this.WriteMsg("<span class='danger'><B>You begin to warp " + A + "</span></B>"); if (GlobalFuncs.do_mob(this, A, 50)) { if (!Lang13.Bool(((dynamic)A).anchored)) { if (Lang13.Bool(this.beacon)) { if (Lang13.Bool(this.beacon.air)) { Z = this.beacon.air; Z_gases = Z.gases; trace_gases = GlobalVars.FALSE; foreach (dynamic _a in Lang13.Enumerate(Z_gases)) { id = _a; if (GlobalVars.hardcoded_gases.Contains(id)) { continue; } trace_gases = GlobalVars.TRUE; break; } if (Lang13.Bool(Z_gases["o2"]) && Convert.ToDouble(Z_gases["o2"][1]) >= 16 && !Lang13.Bool(Z_gases["plasma"]) && (!Lang13.Bool(Z_gases["co2"]) || Convert.ToDouble(Z_gases["co2"][1]) < 10) && !Lang13.Bool(trace_gases)) { if (Convert.ToDouble(Z.temperature) > 270 && Convert.ToDouble(Z.temperature) < 360) { pressure = Z.return_pressure(); if (pressure > 20 && pressure < 550) { GlobalFuncs.PoolOrNew(typeof(Obj_Effect_Overlay_Temp_Guardian_Phase_Out), GlobalFuncs.get_turf(A)); GlobalFuncs.do_teleport(A, this.beacon, 0); GlobalFuncs.PoolOrNew(typeof(Obj_Effect_Overlay_Temp_Guardian_Phase), GlobalFuncs.get_turf(A)); } } else { this.WriteMsg("<span class='danger'><B>The beacon isn't in a safe location!</span></B>"); } } else { this.WriteMsg("<span class='danger'><B>The beacon isn't in a safe location!</span></B>"); } } } else { this.WriteMsg("<span class='danger'><B>You need a beacon to warp things!</span></B>"); } } } else { this.WriteMsg("<span class='danger'><B>You need to hold still!</span></B>"); } return; }