// Function from file: reagent_containers.dm public override dynamic attack_self(dynamic user = null, dynamic flag = null, bool?emp = null) { int i = 0; dynamic A = null; if (this.possible_transfer_amounts.len != 0) { i = 0; foreach (dynamic _a in Lang13.Enumerate(this.possible_transfer_amounts)) { A = _a; i++; if (A == this.amount_per_transfer_from_this) { if (i < this.possible_transfer_amounts.len) { this.amount_per_transfer_from_this = Lang13.DoubleNullable(this.possible_transfer_amounts[i + 1]); } else { this.amount_per_transfer_from_this = Lang13.DoubleNullable(this.possible_transfer_amounts[1]); } user.WriteMsg("<span class='notice'>" + this + "'s transfer amount is now " + this.amount_per_transfer_from_this + " units.</span>"); return(null); } } } return(null); }
// Function from file: material_container.dm public double?insert_stack(dynamic S = null, double?amt = null) { amt = amt ?? 0; double material_amt = 0; if ((amt ?? 0) <= 0) { return(0); } if ((amt ?? 0) > Convert.ToDouble(S.amount)) { amt = Lang13.DoubleNullable(S.amount); } material_amt = this.get_item_material_amount(S); if (!(material_amt != 0)) { return(0); } amt = Num13.MinInt(((int)(amt ?? 0)), Num13.Floor(Convert.ToDouble((this.max_amount - this.total_amount) / material_amt))); if (!Lang13.Bool(amt)) { return(0); } this.insert_materials(S, amt); ((Obj_Item_Stack)S).use(amt); return(amt); }
// Function from file: material_container.dm public double?insert_item(dynamic I = null, double?multiplier = null) { multiplier = multiplier ?? 1; dynamic S = null; double? material_amount = null; if (!Lang13.Bool(I)) { return(0); } if (I is Obj_Item_Stack) { S = I; return(this.insert_stack(I, Lang13.DoubleNullable(S.amount))); } material_amount = this.get_item_material_amount(I); if (!Lang13.Bool(material_amount) || !this.has_space(material_amount)) { return(0); } this.insert_materials(I, multiplier); return(material_amount); }
// Function from file: experimentor.dm public double?matchReaction(dynamic matching = null, string reaction = null) { dynamic D = null; double? tor = null; D = matching; if (Lang13.Bool(D)) { if (this.item_reactions.Find("" + D.type) != 0) { tor = Lang13.DoubleNullable(this.item_reactions["" + D.type]); if (tor == String13.ParseNumber(reaction)) { return(tor); } else { return(8); } } else { return(8); } } else { return(8); } return(null); }
// Function from file: bananashoes.dm public override dynamic attackby(dynamic A = null, dynamic user = null, string _params = null, bool?silent = null, bool?replace_spent = null) { dynamic S = null; double? sheet_amount = null; if (!(A is Obj_Item_Stack_Sheet)) { return(null); } if (!(this.bananium.get_item_material_amount(A) != 0)) { user.WriteMsg("<span class='notice'>This item has no bananium!</span>"); return(null); } if (!((Mob)user).unEquip(A)) { user.WriteMsg("<span class='notice'>You can't drop " + A + "!</span>"); return(null); } S = A; sheet_amount = this.bananium.insert_stack(A, Lang13.DoubleNullable(S.amount)); if (Lang13.Bool(sheet_amount)) { user.WriteMsg("<span class='notice'>You insert " + sheet_amount + " bananium sheets into the prototype shoes.</span>"); } else { user.WriteMsg("<span class='notice'>You are unable to insert more bananium!</span>"); } return(null); }
// Function from file: snacks.dm public virtual void initialize_cooked_food(dynamic S = null, bool?cooking_efficiency = null) { cooking_efficiency = cooking_efficiency ?? true; dynamic r_id = null; double? amount = null; ((Ent_Static)S).create_reagents(S.volume); if (this.reagents != null) { this.reagents.trans_to(S, this.reagents.total_volume); } if (S.bonus_reagents.len != 0) { foreach (dynamic _a in Lang13.Enumerate(S.bonus_reagents)) { r_id = _a; amount = Lang13.DoubleNullable(S.bonus_reagents[r_id] * cooking_efficiency); S.reagents.add_reagent(r_id, amount); } } return; }
// Function from file: RCD.dm public bool loadwithsheets(dynamic S = null, int value = 0, dynamic user = null) { double?maxsheets = null; maxsheets = Num13.Floor((this.max_matter - this.matter) / value); if ((maxsheets ?? 0) > 0) { if (Convert.ToDouble(S.amount) > (maxsheets ?? 0)) { ((Obj_Item_Stack)S).use(maxsheets); this.matter += value * (maxsheets ?? 0); GlobalFuncs.playsound(this.loc, "sound/machines/click.ogg", 50, 1); user.WriteMsg("<span class='notice'>You insert " + maxsheets + " " + S.name + " sheets into the RCD. </span>"); } else { this.matter += value * Convert.ToDouble(S.amount); ((Mob)user).unEquip(); ((Obj_Item_Stack)S).use(Lang13.DoubleNullable(S.amount)); GlobalFuncs.playsound(this.loc, "sound/machines/click.ogg", 50, 1); user.WriteMsg("<span class='notice'>You insert " + S.amount + " " + S.name + " sheets into the RCD. </span>"); } return(true); } user.WriteMsg("<span class='warning'>You can't insert any more " + S.name + " sheets into the RCD!"); return(false); }
// Function from file: disposal-structures.dm public void init(Obj_Machinery_Disposal D = null) { Mob_Living M = null; Obj O = null; Mob_Living M2 = null; Ent_Dynamic AM = null; Ent_Dynamic T = null; Ent_Dynamic T2 = null; this.gas = D.air_contents; foreach (dynamic _a in Lang13.Enumerate(D, typeof(Mob_Living))) { M = _a; if (M.client != null) { M.reset_perspective(this); } this.hasmob = true; } foreach (dynamic _c in Lang13.Enumerate(D, typeof(Obj))) { O = _c; if (O.contents != null) { foreach (dynamic _b in Lang13.Enumerate(O.contents, typeof(Mob_Living))) { M2 = _b; this.hasmob = true; } } } foreach (dynamic _d in Lang13.Enumerate(D, typeof(Ent_Dynamic))) { AM = _d; AM.loc = this; if (AM is Obj_Structure_BigDelivery && !this.hasmob) { T = AM; this.destinationTag = Lang13.DoubleNullable(((dynamic)T).sortTag); } if (AM is Obj_Item_SmallDelivery && !this.hasmob) { T2 = AM; this.destinationTag = Lang13.DoubleNullable(((dynamic)T2).sortTag); } } return; }
// Function from file: holder.dm public void reaction(dynamic A = null, int?method = null, double?volume_modifier = null, bool?show_message = null) { method = method ?? GlobalVars.TOUCH; volume_modifier = volume_modifier ?? 1; show_message = show_message ?? true; dynamic touch_protection = null; dynamic L = null; dynamic reagent = null; dynamic R = null; dynamic reagent2 = null; dynamic R2 = null; dynamic reagent3 = null; dynamic R3 = null; if (A is Mob_Living) { touch_protection = 0; if (method == GlobalVars.VAPOR) { L = A; touch_protection = ((Mob_Living)L).get_permeability_protection(); } foreach (dynamic _a in Lang13.Enumerate(this.reagent_list)) { reagent = _a; R = reagent; ((Reagent)R).reaction_mob(A, method, Lang13.DoubleNullable(R.volume * volume_modifier), show_message, touch_protection); } } else if (A is Tile) { foreach (dynamic _b in Lang13.Enumerate(this.reagent_list)) { reagent2 = _b; R2 = reagent2; ((Reagent)R2).reaction_turf(A, Lang13.DoubleNullable(R2.volume * volume_modifier)); } } else if (A is Obj) { foreach (dynamic _c in Lang13.Enumerate(this.reagent_list)) { reagent3 = _c; R3 = reagent3; ((Reagent)R3).reaction_obj(A, Lang13.DoubleNullable(R3.volume * volume_modifier)); } } return; }
// Function from file: dna_console.dm public void on_scanner_close( ) { this.connected.occupant.WriteMsg("<span class='notice'>" + this + " activates!</span>"); if (this.delayed_action != null) { this.apply_buffer(Convert.ToInt32(this.delayed_action["action"]), Lang13.DoubleNullable(this.delayed_action["buffer"])); this.delayed_action = null; } return; }
// Function from file: objective_items.dm public override bool check_special_completion(Obj T = null) { double?target_amount = null; double?found_amount = null; target_amount = String13.ParseNumber(this.name); found_amount = 0; if (Lang13.Bool(((dynamic)this.targetitem).IsInstanceOfType(T))) { found_amount = Lang13.DoubleNullable(((dynamic)T).amount); } return((found_amount ?? 0) >= (target_amount ?? 0)); }
// Function from file: radio.dm public override void initialize( ) { dynamic ch_name = null; this.frequency = GlobalFuncs.sanitize_frequency(this.frequency, this.freerange); this.set_frequency(this.frequency); foreach (dynamic _a in Lang13.Enumerate(this.channels)) { ch_name = _a; this.secure_radio_connections[ch_name] = GlobalFuncs.add_radio(this, Lang13.DoubleNullable(GlobalVars.radiochannels[ch_name])); } return; }
// Function from file: holder.dm public void add_reagent_list(ByTable list_reagents = null, dynamic data = null) { dynamic r_id = null; double? amt = null; foreach (dynamic _a in Lang13.Enumerate(list_reagents)) { r_id = _a; amt = Lang13.DoubleNullable(list_reagents[r_id]); this.add_reagent(r_id, amt, data); } return; }
// Function from file: transfer_valve.dm public void split_gases( ) { double? ratio1 = null; GasMixture temp = null; if (!this.valve_open || !Lang13.Bool(this.tank_one) || !Lang13.Bool(this.tank_two)) { return; } ratio1 = Lang13.DoubleNullable(this.tank_one.air_contents.volume / this.tank_two.air_contents.volume); temp = ((GasMixture)this.tank_two.air_contents).remove_ratio(ratio1); this.tank_one.air_contents.merge(temp); this.tank_two.air_contents.volume -= this.tank_one.air_contents.volume; return; }
// Function from file: __main.dm public void mergeAt2(int i = 0) { double? cursor1 = null; double? cursor2 = null; double? end1 = null; double? end2 = null; dynamic val1 = null; dynamic val2 = null; cursor1 = Lang13.DoubleNullable(this.runBases[i]); cursor2 = Lang13.DoubleNullable(this.runBases[i + 1]); end1 = (cursor1 ?? 0) + Convert.ToDouble(this.runLens[i]); end2 = (cursor2 ?? 0) + Convert.ToDouble(this.runLens[i + 1]); val1 = (this.associative ? this.L[this.L[cursor1]] : this.L[cursor1]); val2 = (this.associative ? this.L[this.L[cursor2]] : this.L[cursor2]); while (true) { if (Convert.ToDouble(Lang13.Call(this.cmp, val1, val2)) < 0) { if ((++cursor1 ?? 0) >= (end1 ?? 0)) { break; } val1 = (this.associative ? this.L[this.L[cursor1]] : this.L[cursor1]); } else { GlobalFuncs.moveElement(this.L, cursor2, cursor1); cursor2++; if ((++cursor2 ?? 0) >= (end2 ?? 0)) { break; } end1++; cursor1++; val2 = (this.associative ? this.L[this.L[cursor2]] : this.L[cursor2]); } } this.runLens[i] += this.runLens[i + 1]; this.runLens.Cut(i + 1, i + 2); this.runBases.Cut(i + 1, i + 2); return; }
// Function from file: observer.dm public void ManualFollow(dynamic target = null) { Icon I = null; double?orbitsize = null; int? rot_seg = null; if (!(target is Ent_Dynamic)) { return; } I = new Icon(target.icon, target.icon_state, Lang13.DoubleNullable(target.dir)); orbitsize = (I.Width() + I.Height()) * 0.5; orbitsize -= (orbitsize ?? 0) / Game13.icon_size * Game13.icon_size * 0.25; if (this.orbiting != target) { this.WriteMsg("<span class='notice'>Now orbiting " + target + ".</span>"); } dynamic _a = this.ghost_orbit; // Was a switch-case, sorry for the mess. if (_a == "triangle") { rot_seg = 3; } else if (_a == "square") { rot_seg = 4; } else if (_a == "pentagon") { rot_seg = 5; } else if (_a == "hexagon") { rot_seg = 6; } else { rot_seg = 36; } this.orbit(target, orbitsize, GlobalVars.FALSE, 20, rot_seg); return; }
// Function from file: snacks.dm public override void CheckParts(Game_Data holder = null) { dynamic r_id = null; double? amount = null; if (this.bonus_reagents.len != 0) { foreach (dynamic _a in Lang13.Enumerate(this.bonus_reagents)) { r_id = _a; amount = Lang13.DoubleNullable(this.bonus_reagents[r_id]); this.reagents.add_reagent(r_id, amount); } } return; }
// Function from file: __main.dm public void mergeAt(int i = 0) { double?base1 = null; double?base2 = null; double?len1 = null; double?len2 = null; double k = 0; base1 = Lang13.DoubleNullable(this.runBases[i]); base2 = Lang13.DoubleNullable(this.runBases[i + 1]); len1 = Lang13.DoubleNullable(this.runLens[i]); len2 = Lang13.DoubleNullable(this.runLens[i + 1]); this.runLens[i] += this.runLens[i + 1]; this.runLens.Cut(i + 1, i + 2); this.runBases.Cut(i + 1, i + 2); k = this.gallopRight((this.associative ? this.L[this.L[base2]] : this.L[base2]), base1, len1, 0); base1 += k; len1 -= k; if (len1 == 0) { return; } len2 = this.gallopLeft((this.associative ? this.L[this.L[(base1 ?? 0) + (len1 ?? 0) - 1]] : this.L[(base1 ?? 0) + (len1 ?? 0) - 1]), base2, len2, (len2 ?? 0) - 1); if (len2 == 0) { return; } if ((len1 ?? 0) <= (len2 ?? 0)) { this.mergeLo(base1, len1, base2, len2); } else { this.mergeHi(base1, len1, base2, len2); } return; }
// Function from file: circuitprinter.dm public bool check_mat(Design being_built = null, dynamic M = null) { dynamic _a = M; // Was a switch-case, sorry for the mess. if (_a == "$glass") { return(this.g_amount - Convert.ToDouble(being_built.materials[M] / this.efficiency_coeff) >= 0); } else if (_a == "$gold") { return(this.gold_amount - Convert.ToDouble(being_built.materials[M] / this.efficiency_coeff) >= 0); } else if (_a == "$diamond") { return(this.diamond_amount - Convert.ToDouble(being_built.materials[M] / this.efficiency_coeff) >= 0); } else { return(this.reagents.has_reagent(M, Lang13.DoubleNullable(being_built.materials[M] / this.efficiency_coeff)) != 0); } return(false); }
// Function from file: objects.dm public override double Initialize(int start_timeofday = 0, double?zlevel = null) { double _default = 0; dynamic V = null; dynamic A = null; this.setupGenetics(); foreach (dynamic _a in Lang13.Enumerate(typeof(Game13))) { V = _a; A = V; if (Lang13.Bool(zlevel) && Lang13.DoubleNullable(A.z) != zlevel) { continue; } A.initialize(); } _default = base.Initialize(start_timeofday, zlevel); return(_default); }
// Function from file: holidays.dm public override bool shouldCelebrate(double?dd = null, double?mm = null, double?yy = null) { string yy_string = null; ByTable easters = null; if (!Lang13.Bool(this.begin_month)) { yy_string = "" + yy; easters = new ByTable() .Set("15", 14) .Set("16", 6) .Set("17", 25) .Set("18", 10) .Set("19", 30) .Set("20", 22) .Set("21", 13) .Set("22", 26) .Set("23", 18) .Set("24", 9) .Set("25", 29) .Set("26", 14) .Set("27", 6) .Set("28", 25) .Set("29", 10) .Set("30", 30) .Set("31", 23) .Set("32", 6) .Set("33", 26) .Set("34", 18) .Set("35", 3) .Set("36", 22) .Set("37", 14) .Set("38", 34) .Set("39", 19) .Set("40", 9) ; this.begin_day = Lang13.DoubleNullable(easters[yy_string]); if ((this.begin_day ?? 0) <= 9) { this.begin_day += 22; this.begin_month = 3; } else { this.begin_day -= 9; this.begin_month = 4; } this.end_day = (this.begin_day ?? 0) + 1; this.end_month = this.begin_month; if ((this.end_day ?? 0) >= 32 && this.end_month == 3) { this.end_day -= 31; this.end_month++; } if ((this.end_day ?? 0) >= 31 && this.end_month == 4) { this.end_day -= 30; this.end_month++; } this.begin_day -= GlobalVars.days_early ?1:0; if ((this.begin_day ?? 0) <= 0) { if (this.begin_month == 4) { this.begin_day += 31; this.begin_month--; } } } return(base.shouldCelebrate(dd, mm, yy)); }
// Function from file: radio.dm public virtual double?receive_range(dynamic freq = null, dynamic level = null, bool?AIuser = null) { dynamic position = null; bool accept = false; dynamic ch_name = null; if (((Wires)this.wires).is_cut("recieve")) { return(-1); } if (!this.listening) { return(-1); } if (!Lang13.Bool(level.Contains(0))) { position = GlobalFuncs.get_turf(this); if (!Lang13.Bool(position) || !Lang13.Bool(level.Contains(position.z))) { return(-1); } } if (freq == GlobalVars.SYND_FREQ) { if (!this.syndie) { return(-1); } } if (freq == GlobalVars.CENTCOM_FREQ) { if (!this.centcom) { return(-1); } } if (!Lang13.Bool(this.on)) { return(-1); } if (!Lang13.Bool(freq)) { if (!this.listening) { return(-1); } } else { accept = freq == this.frequency && this.listening; if (!accept) { foreach (dynamic _a in Lang13.Enumerate(this.channels)) { ch_name = _a; if (Lang13.Bool(this.channels[ch_name] & 1)) { if (Lang13.DoubleNullable(GlobalVars.radiochannels[ch_name]) == String13.ParseNumber(freq) || this.syndie) { accept = true; break; } } } } if (!accept) { return(-1); } } return(this.canhear_range); }
// Function from file: martial.dm public override bool attack(dynamic M = null, dynamic user = null, bool?def_zone = null) { dynamic H = null; dynamic C = null; dynamic H2 = null; ByTable fluffmessages = null; double? total_health = null; this.add_fingerprint(user); if (Lang13.Bool(user.disabilities.Contains(256)) && Rand13.PercentChance(50)) { user.WriteMsg("<span class ='warning'>You club yourself over the head with " + this + ".</span>"); ((Mob)user).Weaken(3); if (user is Mob_Living_Carbon_Human) { H = user; H.apply_damage(this.force * 2, "brute", "head"); } else { ((Mob_Living)user).take_organ_damage(this.force * 2); } return(false); } if (M is Mob_Living_Silicon_Robot) { return(base.attack((object)(M), (object)(user), def_zone)); } if (!(M is Mob_Living)) { return(base.attack((object)(M), (object)(user), def_zone)); } C = M; if (Lang13.Bool(C.stat)) { user.WriteMsg("<span class='warning'>It would be dishonorable to attack a foe while they cannot retaliate.</span>"); return(false); } dynamic _a = user.a_intent; // Was a switch-case, sorry for the mess. if (_a == "disarm") { if (!this.wielded) { return(base.attack((object)(M), (object)(user), def_zone)); } if (!(M is Mob_Living_Carbon_Human)) { return(base.attack((object)(M), (object)(user), def_zone)); } H2 = M; fluffmessages = new ByTable(new object [] { "" + user + " clubs " + H2 + " with " + this + "!", "" + user + " smacks " + H2 + " with the butt of " + this + "!", "" + user + " broadsides " + H2 + " with " + this + "!", "" + user + " smashes " + H2 + "'s head with " + this + "!", "" + user + " beats " + H2 + " with front of " + this + "!", "" + user + " twirls and slams " + H2 + " with " + this + "!" }); ((Ent_Static)H2).visible_message("<span class='warning'>" + Rand13.PickFromTable(fluffmessages) + "</span>", "<span class='userdanger'>" + Rand13.PickFromTable(fluffmessages) + "</span>"); GlobalFuncs.playsound(GlobalFuncs.get_turf(user), "sound/effects/woodhit.ogg", 75, 1, -1); ((Mob_Living)H2).adjustStaminaLoss(Rand13.Int(13, 20)); if (Rand13.PercentChance(10)) { ((Ent_Static)H2).visible_message("<span class='warning'>" + H2 + " collapses!</span>", "<span class='userdanger'>Your legs give out!</span>"); ((Mob)H2).Weaken(4); } if (Lang13.Bool(H2.staminaloss) && !(H2.sleeping != 0)) { total_health = Lang13.DoubleNullable(H2.health - H2.staminaloss); if ((total_health ?? 0) <= (GlobalVars.config.health_threshold_crit ?? 0) && !Lang13.Bool(H2.stat)) { ((Ent_Static)H2).visible_message("<span class='warning'>" + user + " delivers a heavy hit to " + H2 + "'s head, knocking them out cold!</span>", "<span class='userdanger'>" + user + " knocks you unconscious!</span>"); ((Mob)H2).SetSleeping(30); ((Mob_Living)H2).adjustBrainLoss(25); } } return(false); } else { return(base.attack((object)(M), (object)(user), def_zone)); } return(base.attack((object)(M), (object)(user), def_zone)); }
// Function from file: mech_fabricator.dm public override dynamic attackby(dynamic A = null, dynamic user = null, string _params = null, bool?silent = null, bool?replace_spent = null) { dynamic material = null; string material2 = null; dynamic stack = null; string sname = null; int transfer_amount = 0; if (this.default_deconstruction_screwdriver(user, "fab-o", "fab-idle", A)) { return(null); } if (this.exchange_parts(user, A)) { return(null); } if (Lang13.Bool(this.panel_open)) { if (A is Obj_Item_Weapon_Crowbar) { foreach (dynamic _a in Lang13.Enumerate(this.resources)) { material = _a; this.remove_material(material, Lang13.DoubleNullable(this.resources[material] / 2000)); } this.default_deconstruction_crowbar(A); return(1); } else { user.WriteMsg(new Txt("<span class='warning'>You can't load ").the(this.name).item().str(" while it's opened!</span>").ToString()); return(1); } } if (A is Obj_Item_Stack) { material2 = null; dynamic _b = A.type; // Was a switch-case, sorry for the mess. if (_b == typeof(Obj_Item_Stack_Sheet_Mineral_Gold)) { material2 = "$gold"; } else if (_b == typeof(Obj_Item_Stack_Sheet_Mineral_Silver)) { material2 = "$silver"; } else if (_b == typeof(Obj_Item_Stack_Sheet_Mineral_Diamond)) { material2 = "$diamond"; } else if (_b == typeof(Obj_Item_Stack_Sheet_Mineral_Plasma)) { material2 = "$plasma"; } else if (_b == typeof(Obj_Item_Stack_Sheet_Metal)) { material2 = "$metal"; } else if (_b == typeof(Obj_Item_Stack_Sheet_Glass)) { material2 = "$glass"; } else if (_b == typeof(Obj_Item_Stack_Sheet_Mineral_Bananium)) { material2 = "$bananium"; } else if (_b == typeof(Obj_Item_Stack_Sheet_Mineral_Uranium)) { material2 = "$uranium"; } else { return(base.attackby((object)(A), (object)(user), _params, silent, replace_spent)); } if (this.being_built != null) { user.WriteMsg(new Txt("<span class='warning'>").The(this).item().str(" is currently processing! Please wait until completion.</span>").ToString()); return(null); } if (this.res_max_amount - Convert.ToDouble(this.resources[material2]) < 2000) { user.WriteMsg(new Txt("<span class='warning'>").The(this).item().str(" ").item(this.material2name(material2)).str(" storage is full!</span>").ToString()); return(null); } stack = A; sname = "" + stack.name; if (Convert.ToDouble(this.resources[material2]) < this.res_max_amount) { this.overlays.Add("fab-load-" + this.material2name(material2)); transfer_amount = Num13.MinInt(Convert.ToInt32(stack.amount), ((int)(Num13.Round((this.res_max_amount - Convert.ToDouble(this.resources[material2])) / 2000, 1)))); this.resources[material2] += transfer_amount * 2000; stack.use(transfer_amount); user.WriteMsg(new Txt("<span class='notice'>You insert ").item(transfer_amount).str(" ").item(sname).str(" sheet").s().str(" into ").the(this).item().str(".</span>").ToString()); Task13.Sleep(10); this.updateUsrDialog(); this.overlays.Remove("fab-load-" + this.material2name(material2)); } else { user.WriteMsg(new Txt("<span class='warning'>").The(this).item().str(" cannot hold any more ").item(sname).str(" sheet").s().str("!</span>").ToString()); } return(null); } return(null); }
// Function from file: radio.dm public virtual void recalculateChannels( ) { dynamic ch_name = null; dynamic ch_name2 = null; this.channels = new ByTable(); this.translate_binary = false; this.translate_hive = false; this.syndie = false; this.centcom = false; if (Lang13.Bool(this.keyslot)) { foreach (dynamic _a in Lang13.Enumerate(this.keyslot.channels)) { ch_name = _a; if (this.channels.Contains(ch_name)) { continue; } this.channels.Add(ch_name); this.channels[ch_name] = this.keyslot.channels[ch_name]; } if (Lang13.Bool(this.keyslot.translate_binary)) { this.translate_binary = true; } if (Lang13.Bool(this.keyslot.translate_hive)) { this.translate_hive = true; } if (Lang13.Bool(this.keyslot.syndie)) { this.syndie = true; } if (Lang13.Bool(this.keyslot.centcom)) { this.centcom = true; } } foreach (dynamic _b in Lang13.Enumerate(this.channels)) { ch_name2 = _b; this.secure_radio_connections[ch_name2] = GlobalFuncs.add_radio(this, Lang13.DoubleNullable(GlobalVars.radiochannels[ch_name2])); } return; }
// Function from file: microwave.dm public override dynamic attackby(dynamic A = null, dynamic user = null, string _params = null, bool?silent = null, bool?replace_spent = null) { dynamic clean_spray = null; dynamic P = null; dynamic T = null; int loaded = 0; Obj_Item_Weapon_ReagentContainers_Food_Snacks S = null; if (this.operating) { return(null); } if (!(this.broken != 0) && this.dirty < 100) { if (this.default_deconstruction_screwdriver(user, "mw-o", "mw", A)) { return(null); } if (this.default_unfasten_wrench(user, A)) { return(null); } if (this.exchange_parts(user, A)) { return(null); } } if (this.default_deconstruction_crowbar(A)) { return(null); } if (this.broken > 0) { if (this.broken == 2 && A is Obj_Item_Weapon_Wirecutters) { ((Ent_Static)user).visible_message("" + user + " starts to fix part of the microwave.", "<span class='notice'>You start to fix part of the microwave...</span>"); if (GlobalFuncs.do_after(user, 20 / A.toolspeed, null, this)) { ((Ent_Static)user).visible_message("" + user + " fixes part of the microwave.", "<span class='notice'>You fix part of the microwave.</span>"); this.broken = 1; } } else if (this.broken == 1 && A is Obj_Item_Weapon_Weldingtool) { ((Ent_Static)user).visible_message("" + user + " starts to fix part of the microwave.", "<span class='notice'>You start to fix part of the microwave...</span>"); if (GlobalFuncs.do_after(user, 20 / A.toolspeed, null, this)) { ((Ent_Static)user).visible_message("" + user + " fixes the microwave.", "<span class='notice'>You fix the microwave.</span>"); this.icon_state = "mw"; this.broken = 0; this.dirty = 0; this.flags = 4096; return(0); } } else { user.WriteMsg("<span class='warning'>It's broken!</span>"); return(1); } } else if (A is Obj_Item_Weapon_ReagentContainers_Spray) { clean_spray = A; if (Lang13.Bool(((Reagents)clean_spray.reagents).has_reagent("cleaner", Lang13.DoubleNullable(clean_spray.amount_per_transfer_from_this)))) { ((Reagents)clean_spray.reagents).remove_reagent("cleaner", clean_spray.amount_per_transfer_from_this, true); GlobalFuncs.playsound(this.loc, "sound/effects/spray3.ogg", 50, 1, -6); ((Ent_Static)user).visible_message("" + user + " has cleaned the microwave.", "<span class='notice'>You clean the microwave.</span>"); this.dirty = 0; this.broken = 0; this.icon_state = "mw"; this.flags = 4096; this.updateUsrDialog(); return(1); } else { user.WriteMsg("<span class='warning'>You need more space cleaner!<span>"); return(1); } } else if (A is Obj_Item_Weapon_Soap) { P = A; ((Ent_Static)user).visible_message("" + user + " starts to clean the microwave.", "<span class='notice'>You start to clean the microwave...</span>"); if (GlobalFuncs.do_after(user, P.cleanspeed, null, this)) { ((Ent_Static)user).visible_message("" + user + " has cleaned the microwave.", "<span class='notice'>You clean the microwave.</span>"); this.dirty = 0; this.broken = 0; this.icon_state = "mw"; this.flags = 4096; } } else if (this.dirty == 100) { user.WriteMsg("<span class='warning'>It's dirty!</span>"); return(1); } else if (A is Obj_Item_Weapon_Storage_Bag_Tray) { T = A; loaded = 0; foreach (dynamic _a in Lang13.Enumerate(T.contents, typeof(Obj_Item_Weapon_ReagentContainers_Food_Snacks))) { S = _a; if (this.contents.len >= Convert.ToDouble(this.max_n_of_items)) { user.WriteMsg("<span class='warning'>" + this + " is full, you cannot put more!</span>"); return(1); } ((Obj_Item_Weapon_Storage)T).remove_from_storage(S, this); loaded++; } if (loaded != 0) { user.WriteMsg("<span class='notice'>You insert " + loaded + " items into " + this + ".</span>"); } } else if (A is Obj_Item_Weapon_ReagentContainers_Food_Snacks) { if (this.contents.len >= Convert.ToDouble(this.max_n_of_items)) { user.WriteMsg("<span class='warning'>" + this + " is full, you cannot put more!</span>"); return(1); } else { if (!Lang13.Bool(user.drop_item())) { user.WriteMsg(new Txt("<span class='warning'>").the(A).item().str(" is stuck to your hand, you cannot put it in ").the(this).item().str("!</span>").ToString()); return(0); } A.loc = this; ((Ent_Static)user).visible_message(new Txt().item(user).str(" has added ").the(A).item().str(" to ").the(this).item().str(".").ToString(), new Txt("<span class='notice'>You add ").the(A).item().str(" to ").the(this).item().str(".</span>").ToString()); } } else { base.attackby((object)(A), (object)(user), _params, silent, replace_spent); } this.updateUsrDialog(); return(null); }
// Function from file: cable.dm public void place_turf(Ent_Static T = null, dynamic user = null) { double?dirn = null; Obj_Structure_Cable LC = null; dynamic C = null; Powernet PN = null; if (!(user.loc is Tile)) { return; } if (!Lang13.Bool(((dynamic)T).can_have_cabling())) { user.WriteMsg("<span class='warning'>You can only lay cables on catwalks and plating!</span>"); return; } if ((this.get_amount() ?? 0) < 1) { user.WriteMsg("<span class='warning'>There is no cable left!</span>"); return; } if (Map13.GetDistance(T, user) > 1) { user.WriteMsg("<span class='warning'>You can't lay cable at a place that far away!</span>"); return; } else { if (user.loc == T) { dirn = Lang13.DoubleNullable(user.dir); } else { dirn = Map13.GetDistance(T, user); } foreach (dynamic _a in Lang13.Enumerate(T, typeof(Obj_Structure_Cable))) { LC = _a; if (LC.d2 == dirn && LC.d1 == 0) { user.WriteMsg("<span class='warning'>There's already a cable at that position!</span>"); return; } } C = this.get_new_cable(T); C.d1 = 0; C.d2 = dirn; ((Ent_Static)C).add_fingerprint(user); C.updateicon(); PN = new Powernet(); PN.add_cable(C); ((Obj_Structure_Cable)C).mergeConnectedNetworks(C.d2); ((Obj_Structure_Cable)C).mergeConnectedNetworksOnTurf(); if ((((int)(C.d2 ?? 0)) & ((int)((C.d2 ?? 0) - 1))) != 0) { ((Obj_Structure_Cable)C).mergeDiagonalsNetworks(C.d2); } this.use(1); if (((Obj_Structure_Cable)C).shock(user, 50)) { if (Rand13.PercentChance(50)) { ((Obj)C).Deconstruct(); } } } return; }
// Function from file: crew.dm public int?hiIsValidClient(dynamic hclient = null, dynamic hi = null) { dynamic z = null; foreach (dynamic _a in Lang13.Enumerate(this.interfaces)) { z = _a; if (this.interfaces[z] == hi) { break; } } if (Lang13.Bool(hclient.client.mob) && Lang13.Bool(hclient.client.mob.stat) == false && Lang13.DoubleNullable(hclient.client.mob.z) == String13.ParseNumber(z)) { if (hclient.client.mob is Mob_Living_Silicon_Ai) { return(GlobalVars.TRUE); } else if (hclient.client.mob is Mob_Living_Silicon_Robot) { return(Lang13.Bool(Lang13.FindIn(typeof(Obj_Machinery_Computer_Crew), Map13.FetchInRange(hclient.client.mob, Game13.view))) || Lang13.Bool(Lang13.FindIn(typeof(Obj_Item_Device_SensorDevice), hclient.client.mob.contents)) ?1:0); } else { return(Lang13.Bool(Lang13.FindIn(typeof(Obj_Machinery_Computer_Crew), Map13.FetchInRange(hclient.client.mob, 1))) || Lang13.Bool(Lang13.FindIn(typeof(Obj_Item_Device_SensorDevice), hclient.client.mob.contents)) ?1:0); } } else { return(GlobalVars.FALSE); } return(null); }
// Function from file: minimap.dm public void generate(dynamic z = null, int?x1 = null, int?y1 = null, int?x2 = null, int?y2 = null) { z = z ?? 1; x1 = x1 ?? 1; y1 = y1 ?? 1; x2 = x2 ?? Game13.map_size_x; y2 = y2 ?? Game13.map_size_y; Icon minimap = null; ByTable obj_icons = null; int counter = 0; dynamic T = null; dynamic tile = null; Icon tile_icon = null; dynamic obj = null; dynamic I = null; dynamic obj_icon = null; Icon flatten = null; Icon final = null; minimap = new Icon("icons/minimap.dmi"); minimap.Scale(GlobalVars.MINIMAP_SIZE, GlobalVars.MINIMAP_SIZE); obj_icons = new ByTable(); counter = 128; foreach (dynamic _b in Lang13.Enumerate(Map13.FetchInBlock(Map13.GetTile(x1 ?? 0, y1 ?? 0, Convert.ToInt32(z)), Map13.GetTile(x2 ?? 0, y2 ?? 0, Convert.ToInt32(z))))) { T = _b; tile = T; tile_icon = null; obj = null; if (tile is Tile_Space) { obj = Lang13.FindIn(typeof(Obj_Structure_Lattice_Catwalk), tile); if (Lang13.Bool(obj)) { tile_icon = new Icon("icons/obj/smooth_structures/catwalk.dmi", "catwalk", GlobalVars.SOUTH); } obj = Lang13.FindIn(typeof(Obj_Structure_Lattice), tile); if (Lang13.Bool(obj)) { tile_icon = new Icon("icons/obj/smooth_structures/lattice.dmi", "lattice", GlobalVars.SOUTH); } obj = Lang13.FindIn(typeof(Obj_Structure_Grille), tile); if (Lang13.Bool(obj)) { tile_icon = new Icon("icons/obj/structures.dmi", "grille", GlobalVars.SOUTH); } obj = Lang13.FindIn(typeof(Obj_Structure_TransitTube), tile); if (Lang13.Bool(obj)) { tile_icon = new Icon("icons/obj/atmospherics/pipes/transit_tube.dmi", obj.icon_state, Lang13.DoubleNullable(obj.dir)); } } else { tile_icon = new Icon(tile.icon, tile.icon_state, Lang13.DoubleNullable(tile.dir)); obj_icons.Cut(); obj = Lang13.FindIn(typeof(Obj_Structure), tile); if (Lang13.Bool(obj)) { obj_icons.Add(GlobalFuncs.getFlatIcon(obj)); } obj = Lang13.FindIn(typeof(Obj_Machinery), tile); if (Lang13.Bool(obj)) { obj_icons.Add(new Icon(obj.icon, obj.icon_state, Lang13.DoubleNullable(obj.dir), 1, false)); } obj = Lang13.FindIn(typeof(Obj_Structure_Window), tile); if (Lang13.Bool(obj)) { obj_icons.Add(new Icon("icons/obj/smooth_structures/window.dmi", "window", GlobalVars.SOUTH)); } foreach (dynamic _a in Lang13.Enumerate(obj_icons)) { I = _a; obj_icon = I; tile_icon.Blend(obj_icon, 3); } } if (tile_icon != null) { tile_icon.Scale(GlobalVars.TILE_SIZE, GlobalVars.TILE_SIZE); minimap.Blend(tile_icon, 3, Lang13.DoubleNullable((tile.x - 1) * 8), Lang13.DoubleNullable((tile.y - 1) * 8)); Lang13.Delete(tile_icon); tile_icon = null; } counter--; if (counter <= 0) { counter = 128; flatten = new Icon(); flatten.Insert(minimap, "", GlobalVars.SOUTH, 1, false); Lang13.Delete(minimap); minimap = null; minimap = flatten; Task13.Sleep(-1); } } final = new Icon(); final.Insert(minimap, "", GlobalVars.SOUTH, 1, false); File13.Copy(final, this.map_path(z)); return; }
// Function from file: holder.dm public bool handle_reactions( ) { bool reaction_occured = false; dynamic reagent = null; dynamic R = null; dynamic reaction = null; dynamic C = null; int total_required_reagents = 0; int total_matching_reagents = 0; int total_required_catalysts = 0; int total_matching_catalysts = 0; bool matching_container = false; bool matching_other = false; ByTable multipliers = null; dynamic required_temp = null; dynamic B = null; dynamic B2 = null; dynamic M = null; dynamic multiplier = null; dynamic B3 = null; double? created_volume = null; ByTable seen = null; dynamic M2 = null; dynamic ME2 = null; dynamic M3 = null; if (Lang13.Bool(this.my_atom.flags & 16384)) { return(false); } reaction_occured = false; do { reaction_occured = false; foreach (dynamic _g in Lang13.Enumerate(this.reagent_list)) { reagent = _g; R = reagent; foreach (dynamic _f in Lang13.Enumerate(GlobalVars.chemical_reactions_list[R.id])) { reaction = _f; if (!Lang13.Bool(reaction)) { continue; } C = reaction; total_required_reagents = C.required_reagents.len; total_matching_reagents = 0; total_required_catalysts = C.required_catalysts.len; total_matching_catalysts = 0; matching_container = false; matching_other = false; multipliers = new ByTable(); required_temp = C.required_temp; foreach (dynamic _a in Lang13.Enumerate(C.required_reagents)) { B = _a; if (!Lang13.Bool(this.has_reagent(B, Lang13.DoubleNullable(C.required_reagents[B])))) { break; } total_matching_reagents++; multipliers.Add(Num13.Floor((this.get_reagent_amount(B) ?1:0) / Convert.ToDouble(C.required_reagents[B]))); } foreach (dynamic _b in Lang13.Enumerate(C.required_catalysts)) { B2 = _b; if (!Lang13.Bool(this.has_reagent(B2, Lang13.DoubleNullable(C.required_catalysts[B2])))) { break; } total_matching_catalysts++; } if (!(C.required_container != null)) { matching_container = true; } else if (this.my_atom.type == C.required_container) { matching_container = true; } if (this.my_atom is Mob_Living) { if (C.mob_react) { return(false); } } if (!C.required_other) { matching_other = true; } else if (this.my_atom is Obj_Item_SlimeExtract) { M = this.my_atom; if (M.Uses > 0) { matching_other = true; } } if (required_temp == 0) { required_temp = this.chem_temp; } if (total_matching_reagents == total_required_reagents && total_matching_catalysts == total_required_catalysts && matching_container && matching_other && Convert.ToDouble(this.chem_temp) >= Convert.ToDouble(required_temp)) { multiplier = Num13.Min(multipliers); foreach (dynamic _c in Lang13.Enumerate(C.required_reagents)) { B3 = _c; this.remove_reagent(B3, multiplier * C.required_reagents[B3], true); } created_volume = C.result_amount * Convert.ToDouble(multiplier); if (Lang13.Bool(C.result)) { GlobalFuncs.feedback_add_details("chemical_reaction", "" + C.result + "|" + C.result_amount * Convert.ToDouble(multiplier)); multiplier = Num13.MaxInt(Convert.ToInt32(multiplier), 1); this.add_reagent(C.result, C.result_amount * Convert.ToDouble(multiplier), null, this.chem_temp); } seen = Map13.FetchViewers(GlobalFuncs.get_turf(this.my_atom), 4); if (!(this.my_atom is Mob)) { GlobalFuncs.playsound(GlobalFuncs.get_turf(this.my_atom), "sound/effects/bubbles.ogg", 80, 1); foreach (dynamic _d in Lang13.Enumerate(seen)) { M2 = _d; M2.WriteMsg(new Txt("<span class='notice'>").icon(this.my_atom).str(" ").item(C.mix_message).str("</span>").ToString()); } } if (this.my_atom is Obj_Item_SlimeExtract) { ME2 = this.my_atom; ME2.Uses--; if (ME2.Uses <= 0) { foreach (dynamic _e in Lang13.Enumerate(seen)) { M3 = _e; M3.WriteMsg(new Txt("<span class='notice'>").icon(this.my_atom).str(" ").The(this.my_atom).item().str("'s power is consumed in the reaction.</span>").ToString()); ME2.name = "used slime extract"; ME2.desc = "This extract has been used up."; } } } ((ChemicalReaction)C).on_reaction(this, created_volume); reaction_occured = true; break; } } } } while (reaction_occured); this.update_total(); return(false); }