// Function from file: reader.dm public string trim_text(string what = null, bool?trim_quotes = null) { trim_quotes = trim_quotes ?? false; while (Lang13.Length(what) != 0 && String13.FindIgnoreCase(what, " ", 1, 2) != 0) { what = String13.SubStr(what, 2, 0); } while (Lang13.Length(what) != 0 && String13.FindIgnoreCase(what, " ", Lang13.Length(what), 0) != 0) { what = String13.SubStr(what, 1, Lang13.Length(what)); } if (trim_quotes == true) { while (Lang13.Length(what) != 0 && String13.FindIgnoreCase(what, this.quote, 1, 2) != 0) { what = String13.SubStr(what, 2, 0); } while (Lang13.Length(what) != 0 && String13.FindIgnoreCase(what, this.quote, Lang13.Length(what), 0) != 0) { what = String13.SubStr(what, 1, Lang13.Length(what)); } } return(what); }
// Function from file: holidays.dm public virtual string getStationPrefix( ) { int i = 0; i = String13.FindIgnoreCase(this.name, " ", 1, 0); return(String13.SubStr(this.name, 1, i)); }
// Function from file: shuttles.dm public void initial_move( ) { Obj_DockingPort_Mobile M = null; Obj_DockingPort_Stationary S = null; foreach (dynamic _b in Lang13.Enumerate(this.mobile, typeof(Obj_DockingPort_Mobile))) { M = _b; if (!Lang13.Bool(M.roundstart_move)) { continue; } foreach (dynamic _a in Lang13.Enumerate(this.stationary, typeof(Obj_DockingPort_Stationary))) { S = _a; if (S.z != 1 && String13.FindIgnoreCase(S.id, M.id, 1, 0) != 0) { S.width = M.width; S.height = M.height; S.dwidth = M.dwidth; S.dheight = M.dheight; } } this.moveShuttle(M.id, "" + M.roundstart_move, 0); } return; }
// Function from file: cable.dm public Obj_Structure_Cable(dynamic loc = null) : base((object)(loc)) { int dash = 0; Ent_Static T = null; // Warning: Super call was HERE! If anything above HERE is needed by the super call, it might break!; dash = String13.FindIgnoreCase(this.icon_state, "-", 1, 0); this.d1 = String13.ParseNumber(String13.SubStr(this.icon_state, 1, dash)); this.d2 = String13.ParseNumber(String13.SubStr(this.icon_state, dash + 1, 0)); T = this.loc; if (this.level == 1) { this.hide(Lang13.Bool(((dynamic)T).intact)); } GlobalVars.cable_list.Add(this); if (Lang13.Bool(this.d1)) { this.stored = new Obj_Item_Stack_CableCoil(null, 2, this.cable_color); } else { this.stored = new Obj_Item_Stack_CableCoil(null, 1, this.cable_color); } return; }
// Function from file: machine_interactions.dm public override void Options_Topic(string href = null, ByTable href_list = null) { dynamic newfreq = null; if (Lang13.Bool(href_list["change_freq"])) { newfreq = Interface13.Input(Task13.User, "Specify a new frequency for new signals to change to. Enter null to turn off frequency changing. Decimals assigned automatically.", this, this.network, null, InputType.Num | InputType.Null); if (this.canAccess(Task13.User)) { if (Lang13.Bool(newfreq)) { if (String13.FindIgnoreCase(String13.NumberToString(Convert.ToDouble(newfreq)), ".", 1, 0) != 0) { newfreq *= 10; } if (Convert.ToDouble(newfreq) < 10000) { this.change_frequency = newfreq; this.temp = "<font color = #666633>-% New frequency to change to assigned: \"" + newfreq + " GHz\" %-</font color>"; } } else { this.change_frequency = 0; this.temp = "<font color = #666633>-% Frequency changing deactivated %-</font color>"; } } } return; }
// Function from file: navbeacon.dm public void set_codes( ) { ByTable entries = null; dynamic e = null; int index = 0; string key = null; string val = null; if (!Lang13.Bool(this.codes_txt)) { return; } this.codes = new ByTable(); entries = GlobalFuncs.splittext(this.codes_txt, ";"); foreach (dynamic _a in Lang13.Enumerate(entries)) { e = _a; index = String13.FindIgnoreCase(e, "=", 1, 0); if (index != 0) { key = String13.SubStr(e, 1, index); val = String13.SubStr(e, index + 1, 0); this.codes[key] = val; } else { this.codes[e] = "1"; } } return; }
// Function from file: reader.dm public ByTable readlist(string text = null, string delimiter = null) { delimiter = delimiter ?? ","; ByTable to_return = null; int position = 0; int old_position = 0; int equal_position = 0; string trim_left = null; dynamic trim_right = null; to_return = new ByTable(); old_position = 1; do { position = this.find_next_delimiter_position(text, old_position, delimiter); equal_position = String13.FindIgnoreCase(text, "=", old_position, position); trim_left = this.trim_text(String13.SubStr(text, old_position, (equal_position != 0 ? equal_position : position)), true); old_position = position + 1; if (equal_position != 0) { trim_right = this.trim_text(String13.SubStr(text, equal_position + 1, position)); if (String13.FindIgnoreCase(trim_right, this.quote, 1, 2) != 0) { trim_right = String13.SubStr(trim_right, 2, String13.FindIgnoreCase(trim_right, this.quote, 3, 0)); } else if (Lang13.Bool(Lang13.IsNumber(String13.ParseNumber(trim_right)))) { trim_right = String13.ParseNumber(trim_right); } else if (trim_right == "null") { trim_right = null; } else if (String13.SubStr(trim_right, 1, 5) == "list") { trim_right = this.readlist(String13.SubStr(trim_right, 6, Lang13.Length(trim_right))); } else if (String13.SubStr(trim_right, 1, 2) == "'") { trim_right = new File(String13.SubStr(trim_right, 2, Lang13.Length(trim_right))); } else if (Lang13.FindClass(trim_right) is Type) { trim_right = Lang13.FindClass(trim_right); } to_return[trim_left] = trim_right; } else { to_return[trim_left] = null; } } while (position != 0); return(to_return); }
// Function from file: twohanded.dm public virtual void unwield(dynamic user = null) { int sf = 0; dynamic O = null; if (!this.wielded || !Lang13.Bool(user)) { return; } this.wielded = false; if (this.force_unwielded != 0) { this.force = this.force_unwielded; } sf = String13.FindIgnoreCase(this.name, " (Wielded)", 1, 0); if (sf != 0) { this.name = String13.SubStr(this.name, 1, sf); } else { this.name = "" + Lang13.Initial(this, "name"); } this.update_icon(); if (user is Mob_Living_Silicon_Robot) { user.WriteMsg("<span class='notice'>You free up your module.</span>"); } else if (this is Obj_Item_Weapon_Twohanded_Required) { user.WriteMsg(new Txt("<span class='notice'>You drop ").the(this.name).item().str(".</span>").ToString()); } else { user.WriteMsg("<span class='notice'>You are now carrying the " + this.name + " with one hand.</span>"); } if (Lang13.Bool(this.unwieldsound)) { GlobalFuncs.playsound(this.loc, this.unwieldsound, 50, 1); } O = ((Mob)user).get_inactive_hand(); if (Lang13.Bool(O) && O is Obj_Item_Weapon_Twohanded_Offhand) { ((Obj_Item_Weapon_Twohanded)O).unwield(); } return; }
// Function from file: floorbot.dm public bool is_hull_breach(dynamic t = null) { dynamic t_area = null; t_area = GlobalFuncs.get_area(t); if (Lang13.Bool(t_area) && (t_area.name == "Space" || String13.FindIgnoreCase(t_area.name, "huttle", 1, 0) != 0)) { return(false); } else { return(true); } }
// Function from file: map_template.dm public void preload_size(string path = null) { string quote = null; string map_file = null; int key_len = 0; int mapstart = 0; string content = null; int line_len = 0; quote = String13.GetCharFromCode(34); map_file = File13.Read(path); key_len = Lang13.Length(String13.SubStr(map_file, 2, String13.FindIgnoreCase(map_file, quote, 2, 0))); mapstart = String13.FindIgnoreCase(map_file, "\n(1,1,", 1, 0); content = String13.SubStr(map_file, String13.FindIgnoreCase(map_file, quote + "\n", mapstart, 0) + 2, String13.FindIgnoreCase(map_file, "\n" + quote, mapstart, 0) + 1); line_len = Lang13.Length(String13.SubStr(content, 1, String13.FindIgnoreCase(content, "\n", 2, 0))); this.width = line_len / key_len; this.height = Lang13.Length(content) / (line_len + 1); return; }
// Function from file: slotmachine.dm public int get_lines( ) { int amountthesame = 0; int? i = null; string inputtext = null; dynamic symbol = null; int j = 0; dynamic symboltext = null; i = null; i = 1; while ((i ?? 0) <= 3) { inputtext = this.reels[1][i] + this.reels[2][i] + this.reels[3][i] + this.reels[4][i] + this.reels[5][i]; foreach (dynamic _a in Lang13.Enumerate(this.symbols)) { symbol = _a; j = 3; symboltext = symbol + symbol + symbol; while (j <= 5) { if (String13.FindIgnoreCase(inputtext, symboltext, 1, 0) != 0) { amountthesame = Num13.MaxInt(j, amountthesame); } j++; symboltext += symbol; } if (amountthesame != 0) { break; } } i++; } return(amountthesame); }
// Function from file: reader.dm public int find_next_delimiter_position(string text = null, int initial_position = 0, string delimiter = null, string opening_escape = null, string closing_escape = null) { delimiter = delimiter ?? ","; opening_escape = opening_escape ?? this.quote; closing_escape = closing_escape ?? this.quote; int position = 0; int next_delimiter = 0; int next_opening = 0; position = initial_position; next_delimiter = String13.FindIgnoreCase(text, delimiter, position, 0); next_opening = String13.FindIgnoreCase(text, opening_escape, position, 0); while (next_opening != 0 && next_opening < next_delimiter) { position = String13.FindIgnoreCase(text, closing_escape, next_opening + 1, 0) + 1; next_delimiter = String13.FindIgnoreCase(text, delimiter, position, 0); next_opening = String13.FindIgnoreCase(text, opening_escape, position, 0); } return(next_delimiter); }
// Function from file: martial.dm public bool check_streak(dynamic A = null, Mob_Living D = null) { if (String13.FindIgnoreCase(this.streak, "DD", 1, 0) != 0) { this.streak = ""; this.wristWrench(A, D); return(true); } if (String13.FindIgnoreCase(this.streak, "HG", 1, 0) != 0) { this.streak = ""; this.backKick(A, D); return(true); } if (String13.FindIgnoreCase(this.streak, "GH", 1, 0) != 0) { this.streak = ""; this.kneeStomach(A, D); return(true); } if (String13.FindIgnoreCase(this.streak, "DHH", 1, 0) != 0) { this.streak = ""; this.headKick(A, D); return(true); } if (String13.FindIgnoreCase(this.streak, "HDHDH", 1, 0) != 0) { this.streak = ""; this.elbowDrop(A, D); return(true); } return(false); }
// Function from file: martial.dm public bool check_streak(dynamic A = null, Ent_Static D = null) { if (String13.FindIgnoreCase(this.streak, "HHD", 1, 0) != 0) { this.streak = ""; this.Tornado(A, D); return(true); } if (String13.FindIgnoreCase(this.streak, "DHD", 1, 0) != 0) { this.streak = ""; this.Throwback(A, D); return(true); } if (String13.FindIgnoreCase(this.streak, "HDDDH", 1, 0) != 0) { this.streak = ""; this.Plasma(A, D); return(true); } return(false); }
// Function from file: autolathe.dm public override dynamic Topic(string href = null, ByTable href_list = null, dynamic hsrc = null) { Ent_Static T = null; double? multiplier = null; int max_multiplier = 0; dynamic is_stack = null; double coeff = 0; dynamic metal_cost = null; dynamic glass_cost = null; double power = 0; ByTable materials_used = null; dynamic N = null; Obj_Item_Stack S = null; ByTable materials_used2 = null; dynamic new_item = null; dynamic v = null; dynamic D = null; if (Lang13.Bool(base.Topic(href, href_list, (object)(hsrc)))) { return(null); } if (!this.busy) { if (Lang13.Bool(href_list["menu"])) { this.screen = String13.ParseNumber(href_list["menu"]); } if (Lang13.Bool(href_list["category"])) { this.selected_category = href_list["category"]; } if (Lang13.Bool(href_list["make"])) { T = this.loc; this.being_built = this.files.FindDesignByID(href_list["make"]); if (!(this.being_built != null)) { return(null); } multiplier = String13.ParseNumber(href_list["multiplier"]); max_multiplier = Num13.MinInt(this.being_built.maxstack, ((int)((Lang13.Bool(this.being_built.materials["$metal"]) ? Num13.Floor((this.materials.amount("$metal") ?1:0) / Convert.ToDouble(this.being_built.materials["$metal"])) : Double.PositiveInfinity))), ((int)((Lang13.Bool(this.being_built.materials["$glass"]) ? Num13.Floor((this.materials.amount("$glass") ?1:0) / Convert.ToDouble(this.being_built.materials["$glass"])) : Double.PositiveInfinity)))); is_stack = this.being_built.build_path.IsSubclassOf(typeof(Obj_Item_Stack)); if (!Lang13.Bool(is_stack) && (multiplier ?? 0) > 1) { return(null); } if (!new ByTable(new object [] { 1, 10, 25, max_multiplier }).Contains(multiplier)) { return(null); } coeff = (Lang13.Bool(is_stack) ? 1 : Math.Pow(2, this.prod_coeff)); metal_cost = this.being_built.materials["$metal"]; glass_cost = this.being_built.materials["$glass"]; power = Num13.MaxInt(2000, Convert.ToInt32((metal_cost + glass_cost) * multiplier / 5)); if ((this.materials.amount("$metal") ?1:0) >= Convert.ToDouble(metal_cost * multiplier / coeff) && (this.materials.amount("$glass") ?1:0) >= Convert.ToDouble(glass_cost * multiplier / coeff)) { this.busy = true; this.f_use_power(power); this.icon_state = "autolathe"; Icon13.Flick("autolathe_n", this); Task13.Schedule(((int)(32 / coeff)), (Task13.Closure)(() => { this.f_use_power(power); if (Lang13.Bool(is_stack)) { materials_used = new ByTable().Set("$metal", metal_cost * multiplier).Set("$glass", glass_cost * multiplier); this.materials.use_amount(materials_used); N = Lang13.Call(this.being_built.build_path, T, multiplier); N.update_icon(); ((Obj_Item)N).autolathe_crafted(this); foreach (dynamic _a in Lang13.Enumerate(T.contents - N, typeof(Obj_Item_Stack))) { S = _a; if (Lang13.Bool(((dynamic)N.merge_type).IsInstanceOfType(S))) { N.merge(S); } } } else { materials_used2 = new ByTable().Set("$metal", metal_cost / coeff).Set("$glass", glass_cost / coeff); this.materials.use_amount(materials_used2); new_item = Lang13.Call(this.being_built.build_path, T); new_item.materials = materials_used2.Copy(); ((Obj_Item)new_item).autolathe_crafted(this); } this.busy = false; this.updateUsrDialog(); return; })); } } if (Lang13.Bool(href_list["search"])) { this.matching_designs.Cut(); foreach (dynamic _b in Lang13.Enumerate(this.files.known_designs)) { v = _b; D = this.files.known_designs[v]; if (String13.FindIgnoreCase(D.name, href_list["to_search"], 1, 0) != 0) { this.matching_designs.Add(D); } } } } else { Task13.User.WriteMsg("<span class=\"alert\">The autolathe is busy. Please wait for completion of previous operation.</span>"); } this.updateUsrDialog(); return(null); }
// Function from file: emote.dm public override void emote(string act = null, int?m_type = null, dynamic message = null) { m_type = m_type ?? 1; int t1 = 0; dynamic M = null; if (!(this.container != null && this.container is Obj_Item_Device_Mmi)) { return; } if (String13.FindIgnoreCase(act, "-", 1, 0) != 0) { t1 = String13.FindIgnoreCase(act, "-", 1, 0); act = String13.SubStr(act, 1, t1); } if (this.stat == 2) { return; } switch ((string)(act)) { case "alarm": this.WriteMsg("You sound an alarm."); message = "<B>" + this + "</B> sounds an alarm."; m_type = 2; break; case "alert": this.WriteMsg("You let out a distressed noise."); message = "<B>" + this + "</B> lets out a distressed noise."; m_type = 2; break; case "beep": case "beeps": this.WriteMsg("You beep."); message = "<B>" + this + "</B> beeps."; m_type = 2; break; case "blink": case "blinks": message = "<B>" + this + "</B> blinks."; m_type = 1; break; case "boop": case "boops": this.WriteMsg("You boop."); message = "<B>" + this + "</B> boops."; m_type = 2; break; case "flash": message = "The lights on <B>" + this + "</B> flash quickly."; m_type = 1; break; case "notice": this.WriteMsg("You play a loud tone."); message = "<B>" + this + "</B> plays a loud tone."; m_type = 2; break; case "whistle": case "whistles": this.WriteMsg("You whistle."); message = "<B>" + this + "</B> whistles."; m_type = 2; break; case "help": this.WriteMsg("Help for MMI emotes. You can use these emotes with say \"*emote\":\nalarm, alert, beep, blink, boop, flash, notice, whistle"); break; default: this.WriteMsg("<span class='notice'>Unusable emote '" + act + "'. Say *help for a list.</span>"); return; break; } if (Lang13.Bool(message)) { GlobalFuncs.log_emote("" + this.name + "/" + this.key + " : " + message); foreach (dynamic _b in Lang13.Enumerate(GlobalVars.dead_mob_list)) { M = _b; if (!Lang13.Bool(M.client) || M is Mob_NewPlayer) { continue; } if (Convert.ToInt32(M.stat) == 2 && Lang13.Bool(M.client) && (M.client.prefs.chat_toggles & 8) != 0 && !Map13.FetchViewers(null, this).Contains(M)) { M.show_message(message); } } if (((m_type ?? 0) & 1) != 0) { this.visible_message(message); } else if (((m_type ?? 0) & 2) != 0) { this.audible_message(message); } } return; }
// Function from file: mask.dm public override dynamic speechModification(dynamic message = null) { ByTable temp_message = null; ByTable pick_list = null; int? i = null; double? i2 = null; dynamic H = null; if (this.voice == "Unknown") { if (String13.SubStr(message, 1, 2) != "*") { temp_message = GlobalFuncs.splittext(message, " "); pick_list = new ByTable(); i = null; i = 1; while ((i ?? 0) <= temp_message.len) { pick_list.Add(i); i++; } i2 = null; i2 = 1; while ((i2 ?? 0) <= Math.Abs(temp_message.len / 3)) { H = Rand13.PickFromTable(pick_list); if (String13.FindIgnoreCase(temp_message[H], "*", 1, 0) != 0 || String13.FindIgnoreCase(temp_message[H], ";", 1, 0) != 0 || String13.FindIgnoreCase(temp_message[H], ":", 1, 0) != 0) { } else { temp_message[H] = GlobalFuncs.ninjaspeak(temp_message[H]); pick_list.Remove(H); } i2++; } message = GlobalFuncs.jointext(temp_message, " "); message = GlobalFuncs.replacetext(message, "l", "r"); message = GlobalFuncs.replacetext(message, "rr", "ru"); message = GlobalFuncs.replacetext(message, "v", "b"); message = GlobalFuncs.replacetext(message, "f", "hu"); message = GlobalFuncs.replacetext(message, "'t", ""); message = GlobalFuncs.replacetext(message, "t ", "to "); message = GlobalFuncs.replacetext(message, " I ", " ai "); message = GlobalFuncs.replacetext(message, "th", "z"); message = GlobalFuncs.replacetext(message, "is", "izu"); message = GlobalFuncs.replacetext(message, "ziz", "zis"); message = GlobalFuncs.replacetext(message, "se", "su"); message = GlobalFuncs.replacetext(message, "br", "bur"); message = GlobalFuncs.replacetext(message, "ry", "ri"); message = GlobalFuncs.replacetext(message, "you", "yuu"); message = GlobalFuncs.replacetext(message, "ck", "cku"); message = GlobalFuncs.replacetext(message, "eu", "uu"); message = GlobalFuncs.replacetext(message, "ow", "au"); message = GlobalFuncs.replacetext(message, "are", "aa"); message = GlobalFuncs.replacetext(message, "ay", "ayu"); message = GlobalFuncs.replacetext(message, "ea", "ii"); message = GlobalFuncs.replacetext(message, "ch", "chi"); message = GlobalFuncs.replacetext(message, "than", "sen"); message = GlobalFuncs.replacetext(message, ".", ""); message = String13.ToLower(message); } } return(message); }
// Function from file: emote.dm public override void emote(string act = null, int?m_type = null, dynamic message = null) { m_type = m_type ?? 1; string param = null; int t1 = 0; bool muzzled = false; param = null; if (String13.FindIgnoreCase(act, "-", 1, 0) != 0) { t1 = String13.FindIgnoreCase(act, "-", 1, 0); param = String13.SubStr(act, t1 + 1, Lang13.Length(act) + 1); act = String13.SubStr(act, 1, t1); } muzzled = this.is_muzzled(); switch ((string)(act)) { case "deathgasp": case "deathgasps": message = "<b>" + this + "</b> lets out a faint chimper as it collapses and stops moving..."; m_type = 1; break; case "gnarl": case "gnarls": if (!muzzled) { message = "<B>" + this + "</B> gnarls and shows its teeth.."; m_type = 2; } break; case "me": base.emote(act, m_type, (object)(message)); return; break; case "moan": case "moans": message = "<B>" + this + "</B> moans!"; m_type = 2; break; case "paw": if (!this.restrained()) { message = "<B>" + this + "</B> flails its paw."; m_type = 1; } break; case "roar": case "roars": if (!muzzled) { message = "<B>" + this + "</B> roars."; m_type = 2; } break; case "roll": case "rolls": if (!this.restrained()) { message = "<B>" + this + "</B> rolls."; m_type = 1; } break; case "scratch": case "scratches": if (!this.restrained()) { message = "<B>" + this + "</B> scratches."; m_type = 1; } break; case "screech": case "screeches": if (!muzzled) { message = "<B>" + this + "</B> screeches."; m_type = 2; } break; case "shiver": case "shivers": message = "<B>" + this + "</B> shivers."; m_type = 2; break; case "sign": case "signs": if (!this.restrained()) { message = "<B>" + this + "</B> signs" + (Lang13.Bool(String13.ParseNumber(param)) ? " the number " + String13.ParseNumber(param) : null) + "."; m_type = 1; } break; case "tail": message = "<B>" + this + "</B> waves its tail."; m_type = 1; break; case "help": this.WriteMsg("Help for monkey emotes. You can use these emotes with say \"*emote\":\n\naflap, airguitar, blink, blink_r, blush, bow-(none)/mob, burp, choke, chuckle, clap, collapse, cough, dance, deathgasp, drool, flap, frown, gasp, gnarl, giggle, glare-(none)/mob, grin, jump, laugh, look, me, moan, nod, paw, point-(atom), roar, roll, scream, scratch, screech, shake, shiver, sigh, sign-#, sit, smile, sneeze, sniff, snore, stare-(none)/mob, sulk, sway, tail, tremble, twitch, twitch_s, wave whimper, wink, yawn"); break; default: base.emote(act, m_type, (object)(message)); break; } if (Lang13.Bool(message) && this.stat == 0) { if (this.client != null) { GlobalFuncs.log_emote("" + this.name + "/" + this.key + " : " + message); } if (((m_type ?? 0) & 1) != 0) { this.visible_message(message); } else { this.audible_message(message); } } return; }
// Function from file: ticker.dm public bool declare_completion( ) { bool station_evacuated = false; int num_survivors = 0; int num_escapees = 0; dynamic Player = null; StationState end_state = null; int station_integrity = 0; Mob_Living_Silicon_Ai aiPlayer = null; string robolist = null; Mob_Living_Silicon_Robot robo = null; Mob_Living_Silicon_Robot robo2 = null; dynamic handler = null; ByTable total_antagonists = null; Mind Mind = null; string temprole = null; dynamic i = null; string dellog = null; dynamic path = null; if (GlobalVars.SSshuttle.emergency.mode >= 5) { station_evacuated = true; } num_survivors = 0; num_escapees = 0; Game13.WriteMsg("<BR><BR><BR><FONT size=3><B>The round has ended.</B></FONT>"); foreach (dynamic _a in Lang13.Enumerate(GlobalVars.mob_list)) { Player = _a; if (Lang13.Bool(Player.mind) && !(Player is Mob_NewPlayer)) { if (Convert.ToInt32(Player.stat) != 2 && !(Player is Mob_Living_Carbon_Brain)) { num_survivors++; if (station_evacuated) { if (!((Ent_Static)Player).onCentcom() && !((Ent_Static)Player).onSyndieBase()) { Player.WriteMsg("<font color='blue'><b>You managed to survive, but were marooned on " + GlobalFuncs.station_name() + "...</b></FONT>"); } else { num_escapees++; Player.WriteMsg("<font color='green'><b>You managed to survive the events on " + GlobalFuncs.station_name() + " as " + Player.real_name + ".</b></FONT>"); } } else { Player.WriteMsg("<font color='green'><b>You managed to survive the events on " + GlobalFuncs.station_name() + " as " + Player.real_name + ".</b></FONT>"); } } else { Player.WriteMsg("<font color='red'><b>You did not survive the events on " + GlobalFuncs.station_name() + "...</b></FONT>"); } } } end_state = new StationState(); end_state.count(); station_integrity = Num13.MinInt(((int)(Num13.Round(GlobalVars.start_state.score(end_state) * 100, 0.1))), 100); Game13.WriteMsg("<BR>" + GlobalVars.TAB + "Shift Duration: <B>" + Num13.Floor(Game13.time / 36000) + ":" + GlobalFuncs.add_zero("" + Game13.time / 600 % 60, 2) + ":" + Game13.time / 100 % 6 + Game13.time / 100 % 10 + "</B>"); Game13.WriteMsg("<BR>" + GlobalVars.TAB + "Station Integrity: <B>" + (this.mode.station_was_nuked ? "<font color='red'>Destroyed</font>" : "" + station_integrity + "%") + "</B>"); if (GlobalVars.joined_player_list.len != 0) { Game13.WriteMsg("<BR>" + GlobalVars.TAB + "Total Population: <B>" + GlobalVars.joined_player_list.len + "</B>"); if (station_evacuated) { Game13.WriteMsg("<BR>" + GlobalVars.TAB + "Evacuation Rate: <B>" + num_escapees + " (" + Num13.Round(num_escapees / GlobalVars.joined_player_list.len * 100, 0.1) + "%)</B>"); } Game13.WriteMsg("<BR>" + GlobalVars.TAB + "Survival Rate: <B>" + num_survivors + " (" + Num13.Round(num_survivors / GlobalVars.joined_player_list.len * 100, 0.1) + "%)</B>"); } Game13.WriteMsg("<BR>"); foreach (dynamic _c in Lang13.Enumerate(GlobalVars.mob_list, typeof(Mob_Living_Silicon_Ai))) { aiPlayer = _c; if (aiPlayer.stat != 2 && aiPlayer.mind != null) { Game13.WriteMsg("<b>" + aiPlayer.name + " (Played by: " + aiPlayer.mind.key + ")'s laws at the end of the round were:</b>"); aiPlayer.show_laws(true); } else if (aiPlayer.mind != null) { Game13.WriteMsg("<b>" + aiPlayer.name + " (Played by: " + aiPlayer.mind.key + ")'s laws when it was deactivated were:</b>"); aiPlayer.show_laws(true); } Game13.WriteMsg("<b>Total law changes: " + aiPlayer.law_change_counter + "</b>"); if (aiPlayer.connected_robots.len != 0) { robolist = "<b>" + aiPlayer.real_name + "'s minions were:</b> "; foreach (dynamic _b in Lang13.Enumerate(aiPlayer.connected_robots, typeof(Mob_Living_Silicon_Robot))) { robo = _b; if (robo.mind != null) { robolist += "" + robo.name + (robo.stat != 0 ? " (Deactivated) (Played by: " + robo.mind.key + "), " : " (Played by: " + robo.mind.key + "), "); } } Game13.WriteMsg("" + robolist); } } foreach (dynamic _d in Lang13.Enumerate(GlobalVars.mob_list, typeof(Mob_Living_Silicon_Robot))) { robo2 = _d; if (!Lang13.Bool(robo2.connected_ai) && robo2.mind != null) { if (robo2.stat != 2) { Game13.WriteMsg("<b>" + robo2.name + " (Played by: " + robo2.mind.key + ") survived as an AI-less borg! Its laws were:</b>"); } else { Game13.WriteMsg("<b>" + robo2.name + " (Played by: " + robo2.mind.key + ") was unable to survive the rigors of being a cyborg without an AI. Its laws were:</b>"); } if (robo2 != null) { robo2.laws.show_laws(typeof(Game13)); } } } this.mode.declare_completion(); foreach (dynamic _e in Lang13.Enumerate(Lang13.GetTypes("/datum/game_mode/proc"))) { handler = _e; if (String13.FindIgnoreCase("" + handler, "auto_declare_completion_", 1, 0) != 0) { Lang13.Call(Lang13.BindFunc(this.mode, handler), this.force_ending); } } total_antagonists = new ByTable(); foreach (dynamic _f in Lang13.Enumerate(this.minds, typeof(Mind))) { Mind = _f; temprole = Mind.special_role; if (Lang13.Bool(temprole)) { if (total_antagonists.Contains(temprole)) { total_antagonists[temprole] += ", " + Mind.name + "(" + Mind.key + ")"; } else { total_antagonists.Add(temprole); total_antagonists[temprole] += ": " + Mind.name + "(" + Mind.key + ")"; } } } GlobalFuncs.log_game("Antagonists at round end were..."); foreach (dynamic _g in Lang13.Enumerate(total_antagonists)) { i = _g; GlobalFuncs.log_game("" + i + "s" + total_antagonists[i] + "."); } if (GlobalVars.SSgarbage.didntgc.len != 0) { dellog = ""; foreach (dynamic _h in Lang13.Enumerate(GlobalVars.SSgarbage.didntgc)) { path = _h; dellog += "Path : " + path + " \n"; dellog += "Failures : " + GlobalVars.SSgarbage.didntgc[path] + " \n"; } Game13.log.WriteMsg(dellog); } return(true); }
// Function from file: camera_bug.dm public override int?process(dynamic seconds = null) { dynamic M = null; ByTable tracking_cams = null; ByTable b_cams = null; dynamic entry = null; ByTable target_region = null; Obj_Machinery_Camera C = null; if (this.track_mode == 0 || Game13.time < this.last_tracked + this.refresh_interval) { return(null); } this.last_tracked = Game13.time; if (this.track_mode == 2) { if (!Lang13.Bool(this.tracking)) { this.updateSelfDialog(); return(null); } if (this.tracking.name != this.tracked_name) { M = this.tracking; if (M is Mob) { if (!(this.tracked_name == "Unknown" && String13.FindIgnoreCase(this.tracking.name, "Unknown", 1, 0) != 0)) { if (!(this.tracked_name == M.real_name && String13.FindIgnoreCase(this.tracking.name, M.real_name, 1, 0) != 0)) { this.updateSelfDialog(); return(null); } } } else { this.updateSelfDialog(); return(null); } } tracking_cams = new ByTable(); b_cams = this.get_cameras(); foreach (dynamic _a in Lang13.Enumerate(b_cams)) { entry = _a; tracking_cams.Add(b_cams[entry]); } target_region = Map13.FetchInView(null, this.tracking); foreach (dynamic _b in Lang13.Enumerate(target_region & tracking_cams, typeof(Obj_Machinery_Camera))) { C = _b; if (!GlobalFuncs.can_see(C, this.tracking)) { continue; } if (C.can_use()) { this.last_found = C.c_tag; this.last_seen = Game13.time; break; } } } this.updateSelfDialog(); return(null); }
public string write_map(dynamic t1 = null, dynamic t2 = null, dynamic flags = null) { Tile nw = null; Tile se = null; ByTable templates = null; string template_buffer = null; string dmm_text = null; double pos_z = 0; double pos_y = 0; double pos_x = 0; Tile test_turf = null; string test_template = null; int template_number = 0; int key_length = 0; ByTable keys = null; double key_pos = 0; int z_level = 0; int? z_pos = null; string z_block = null; int? y_pos = null; string y_block = null; int? x_pos = null; string x_block = null; double? key_number = null; dynamic temp_key = null; if (!(t1 is Tile) || !(t2 is Tile)) { Task13.Crash("Invalid arguments supplied to proc write_map, arguments were not turfs."); } nw = Map13.GetTile(Num13.MinInt(Convert.ToInt32(t1.x), Convert.ToInt32(t2.x)), Num13.MaxInt(Convert.ToInt32(t1.y), Convert.ToInt32(t2.y)), Num13.MinInt(Convert.ToInt32(t1.z), Convert.ToInt32(t2.z))); se = Map13.GetTile(Num13.MaxInt(Convert.ToInt32(t1.x), Convert.ToInt32(t2.x)), Num13.MinInt(Convert.ToInt32(t1.y), Convert.ToInt32(t2.y)), Num13.MaxInt(Convert.ToInt32(t1.z), Convert.ToInt32(t2.z))); templates = new ByTable(0); template_buffer = ""; dmm_text = ""; foreach (dynamic _c in Lang13.IterateRange(nw.z, se.z)) { pos_z = _c; foreach (dynamic _b in Lang13.IterateRange(nw.y, se.y)) { pos_y = _b; foreach (dynamic _a in Lang13.IterateRange(nw.x, se.x)) { pos_x = _a; test_turf = Map13.GetTile(((int)(pos_x)), ((int)(pos_y)), ((int)(pos_z))); test_template = this.make_template(test_turf, flags); template_number = templates.Find(test_template); if (!(template_number != 0)) { templates.Add(test_template); template_number = templates.len; } template_buffer += "" + template_number + ","; } template_buffer += ";"; } template_buffer += "."; } key_length = Num13.Floor(Math.Log(this.letter_digits.len, templates.len - 1) + 1); keys = null; keys = new ByTable(templates.len); foreach (dynamic _d in Lang13.IterateRange(1, templates.len)) { key_pos = _d; keys[key_pos] = this.get_model_key(key_pos, key_length); dmm_text += "\"" + keys[key_pos] + "\" = (" + templates[key_pos] + ")\n"; } z_level = 0; z_pos = null; z_pos = 1; while (GlobalVars.TRUE != 0) { if ((z_pos ?? 0) >= Lang13.Length(template_buffer)) { break; } if (z_level != 0) { dmm_text += "\n"; } dmm_text += "\n(1,1," + ++z_level + ") = {\"\n"; z_block = String13.SubStr(template_buffer, z_pos ?? 0, String13.FindIgnoreCase(template_buffer, ".", z_pos ?? 0, 0)); y_pos = null; y_pos = 1; while (GlobalVars.TRUE != 0) { if ((y_pos ?? 0) >= Lang13.Length(z_block)) { break; } y_block = String13.SubStr(z_block, y_pos ?? 0, String13.FindIgnoreCase(z_block, ";", y_pos ?? 0, 0)); x_pos = null; x_pos = 1; while (GlobalVars.TRUE != 0) { if ((x_pos ?? 0) >= Lang13.Length(y_block)) { break; } x_block = String13.SubStr(y_block, x_pos ?? 0, String13.FindIgnoreCase(y_block, ",", x_pos ?? 0, 0)); key_number = String13.ParseNumber(x_block); temp_key = keys[key_number]; dmm_text += temp_key; Task13.Sleep(-1); x_pos = String13.FindIgnoreCase(y_block, ",", x_pos ?? 0, 0) + 1; } dmm_text += "\n"; Task13.Sleep(-1); y_pos = String13.FindIgnoreCase(z_block, ";", y_pos ?? 0, 0) + 1; } dmm_text += "\"}"; Task13.Sleep(-1); z_pos = String13.FindIgnoreCase(template_buffer, ".", z_pos ?? 0, 0) + 1; } return(dmm_text); }
// Function from file: reader.dm public void parse_grid(string model = null, int xcrd = 0, double ycrd = 0, int zcrd = 0) { ByTable members = null; ByTable members_attributes = null; double index = 0; int old_position = 0; int dpos = 0; string full_def = null; Type atom_def = null; ByTable fields = null; int variables_start = 0; ByTable turfs_underlays = null; dynamic instance = null; Tile crds = null; int first_turf_index = 0; dynamic T = null; dynamic UT = null; members = new ByTable(); members_attributes = new ByTable(); index = 1; old_position = 1; do { dpos = this.find_next_delimiter_position(model, old_position, ",", "{", "}"); full_def = String13.SubStr(model, old_position, dpos); atom_def = Lang13.FindClass(String13.SubStr(full_def, 1, String13.FindIgnoreCase(full_def, "{", 1, 0))); members.Add(atom_def); old_position = dpos + 1; fields = new ByTable(); variables_start = String13.FindIgnoreCase(full_def, "{", 1, 0); if (variables_start != 0) { full_def = String13.SubStr(full_def, variables_start + 1, Lang13.Length(full_def)); fields = this.readlist(full_def, ";"); } members_attributes.len++; members_attributes[index++] = fields; Task13.Sleep(-1); } while (dpos != 0); turfs_underlays = new ByTable(); index = members.len; GlobalVars._preloader.setup(members_attributes[index]); instance = Lang13.FindObj(members[index]); crds = Map13.GetTile(xcrd, ((int)(ycrd)), zcrd); if (crds != null) { instance.contents.Add(crds); } if (Lang13.Bool(GlobalVars.use_preloader) && Lang13.Bool(instance)) { GlobalVars._preloader.load(instance); } members.Remove(members[index]); first_turf_index = 1; while (!Lang13.Bool(members[first_turf_index].IsSubclassOf(typeof(Tile)))) { first_turf_index++; } T = this.instance_atom(members[first_turf_index], members_attributes[first_turf_index], xcrd, ycrd, zcrd); if (Lang13.Bool(T)) { index = first_turf_index + 1; while (index <= members.len) { turfs_underlays.Insert(1, new Image(T.icon, null, T.icon_state, T.layer, T.dir)); UT = this.instance_atom(members[index], members_attributes[index], xcrd, ycrd, zcrd); this.add_underlying_turf(UT, T, turfs_underlays); T = UT; index++; } } foreach (dynamic _a in Lang13.IterateRange(1, first_turf_index - 1)) { index = _a; this.instance_atom(members[index], members_attributes[index], xcrd, ycrd, zcrd); } return; }
// Function from file: paper.dm public dynamic parsepencode(dynamic t = null, dynamic P = null, Mob user = null, bool?iscrayon = null) { iscrayon = iscrayon ?? false; dynamic C = null; int laststart = 0; int i = 0; if (Lang13.Length(t) < 1) { return(null); } t = GlobalFuncs.replacetext(t, "[center]", "<center>"); t = GlobalFuncs.replacetext(t, "[/center]", "</center>"); t = GlobalFuncs.replacetext(t, "[br]", "<BR>"); t = GlobalFuncs.replacetext(t, "[b]", "<B>"); t = GlobalFuncs.replacetext(t, "[/b]", "</B>"); t = GlobalFuncs.replacetext(t, "[i]", "<I>"); t = GlobalFuncs.replacetext(t, "[/i]", "</I>"); t = GlobalFuncs.replacetext(t, "[u]", "<U>"); t = GlobalFuncs.replacetext(t, "[/u]", "</U>"); t = GlobalFuncs.replacetext(t, "[large]", "<font size=\"4\">"); t = GlobalFuncs.replacetext(t, "[/large]", "</font>"); t = GlobalFuncs.replacetext(t, "[sign]", "<font face=\"" + "Times New Roman" + "\"><i>" + user.real_name + "</i></font>"); t = GlobalFuncs.replacetext(t, "[field]", "<span class=\"paper_field\"></span>"); if (!(iscrayon == true)) { t = GlobalFuncs.replacetext(t, "[*]", "<li>"); t = GlobalFuncs.replacetext(t, "[hr]", "<HR>"); t = GlobalFuncs.replacetext(t, "[small]", "<font size = \"1\">"); t = GlobalFuncs.replacetext(t, "[/small]", "</font>"); t = GlobalFuncs.replacetext(t, "[list]", "<ul>"); t = GlobalFuncs.replacetext(t, "[/list]", "</ul>"); t = "<font face=\"" + "Verdana" + "\" color=" + P.colour + ">" + t + "</font>"; } else { C = P; t = GlobalFuncs.replacetext(t, "[*]", ""); t = GlobalFuncs.replacetext(t, "[hr]", ""); t = GlobalFuncs.replacetext(t, "[small]", ""); t = GlobalFuncs.replacetext(t, "[/small]", ""); t = GlobalFuncs.replacetext(t, "[list]", ""); t = GlobalFuncs.replacetext(t, "[/list]", ""); t = "<font face=\"" + "Comic Sans MS" + "\" color=" + C.paint_color + "><b>" + t + "</b></font>"; } laststart = 1; while (true) { i = String13.FindIgnoreCase(t, "<span class=\"paper_field\">", laststart, 0); if (i == 0) { break; } laststart = i + 1; this.fields++; } return(t); }
// Function from file: items.dm public override dynamic acid_act(int acidpwr = 0, double?toxpwr = null, double?acid_volume = null) { dynamic _default = null; double meltingpwr = 0; double melting_threshold = 0; dynamic V = null; dynamic T = null; Obj_Effect_Decal_Cleanable_MoltenItem I = null; Obj_Item S = null; dynamic armour_value = null; _default = 1; if (this.unacidable) { return(_default); } meltingpwr = (toxpwr ?? 0) * acidpwr; melting_threshold = 100; if (meltingpwr <= melting_threshold) { return(_default); } foreach (dynamic _a in Lang13.Enumerate(this.armor)) { V = _a; if (Convert.ToDouble(this.armor[V]) > 0) { _default--; break; } } if (Lang13.Bool(_default) && Rand13.PercentChance(Num13.MinInt(((int)(meltingpwr / 10)), 90))) { T = GlobalFuncs.get_turf(this); if (Lang13.Bool(T)) { I = new Obj_Effect_Decal_Cleanable_MoltenItem(T); I.pixel_x = Rand13.Int(-16, 16); I.pixel_y = Rand13.Int(-16, 16); I.desc = new Txt("Looks like this was ").a(this).item().str(" some time ago.").ToString(); } if (this is Obj_Item_Weapon_Storage) { S = this; ((dynamic)S).do_quick_empty(); } GlobalFuncs.qdel(this); } else { foreach (dynamic _b in Lang13.Enumerate(this.armor)) { armour_value = _b; this.armor[armour_value] = Num13.MaxInt(Convert.ToInt32(this.armor[armour_value] - Num13.MinInt(acidpwr, ((int)(meltingpwr / 10)))), 0); } if (!(String13.FindIgnoreCase(this.desc, "it looks slightly melted...", 1, 0) != 0)) { this.desc += " it looks slightly melted..."; } } return(_default); }
// Function from file: emote.dm public override void emote(string act = null, int?m_type = null, dynamic message = null) { m_type = m_type ?? 1; string param = null; int t1 = 0; bool muzzled = false; param = null; if (String13.FindIgnoreCase(act, "-", 1, 0) != 0) { t1 = String13.FindIgnoreCase(act, "-", 1, 0); param = String13.SubStr(act, t1 + 1, Lang13.Length(act) + 1); act = String13.SubStr(act, 1, t1); } muzzled = this.is_muzzled(); switch ((string)(act)) { case "burp": case "burps": if (!muzzled) { message = "<span class='name'>" + this + "</span> burps."; m_type = 2; } break; case "choke": case "chokes": message = "<span class='name'>" + this + "</span> chokes."; m_type = 2; break; case "collapse": case "collapses": this.Paralyse(2); message = "<span class='name'>" + this + "</span> collapses!"; m_type = 2; break; case "dance": case "dances": if (!this.restrained()) { message = "<span class='name'>" + this + "</span> dances around happily."; m_type = 1; } break; case "deathgasp": case "deathgasps": message = "<span class='name'>" + this + "</span> lets out a sickly hiss of air and falls limply to the floor..."; m_type = 2; break; case "drool": case "drools": message = "<span class='name'>" + this + "</span> drools."; m_type = 1; break; case "gasp": case "gasps": message = "<span class='name'>" + this + "</span> gasps."; m_type = 2; break; case "gnarl": case "gnarls": if (!muzzled) { message = "<span class='name'>" + this + "</span> gnarls and shows its teeth.."; m_type = 2; } break; case "hiss": case "hisses": message = "<span class='name'>" + this + "</span> hisses softly."; m_type = 1; break; case "jump": case "jumps": message = "<span class='name'>" + this + "</span> jumps!"; m_type = 1; break; case "me": base.emote(act, m_type, (object)(message)); return; break; case "moan": case "moans": message = "<span class='name'>" + this + "</span> moans!"; m_type = 2; break; case "nod": case "nods": message = "<span class='name'>" + this + "</span> nods its head."; m_type = 1; break; case "roar": case "roars": if (!muzzled) { message = "<span class='name'>" + this + "</span> softly roars."; m_type = 2; } break; case "roll": case "rolls": if (!this.restrained()) { message = "<span class='name'>" + this + "</span> rolls."; m_type = 1; } break; case "scratch": case "scratches": if (!this.restrained()) { message = "<span class='name'>" + this + "</span> scratches."; m_type = 1; } break; case "screech": case "screeches": if (!muzzled) { message = "<span class='name'>" + this + "</span> screeches."; m_type = 2; } break; case "shake": case "shakes": message = "<span class='name'>" + this + "</span> shakes its head."; m_type = 1; break; case "shiver": case "shivers": message = "<span class='name'>" + this + "</span> shivers."; m_type = 2; break; case "sign": case "signs": if (!this.restrained()) { message = "<span class='name'>" + this + "</span> signs" + (Lang13.Bool(String13.ParseNumber(param)) ? " the number " + String13.ParseNumber(param) : null) + "."; m_type = 1; } break; case "snore": case "snores": message = "<B>" + this + "</B> snores."; m_type = 2; break; case "sulk": case "sulks": message = "<span class='name'>" + this + "</span> sulks down sadly."; m_type = 1; break; case "sway": case "sways": message = "<span class='name'>" + this + "</span> sways around dizzily."; m_type = 1; break; case "tail": message = "<span class='name'>" + this + "</span> waves its tail."; m_type = 1; break; case "twitch": message = "<span class='name'>" + this + "</span> twitches violently."; m_type = 1; break; case "whimper": case "whimpers": if (!muzzled) { message = "<span class='name'>" + this + "</span> whimpers."; m_type = 2; } break; case "help": this.WriteMsg("Help for larva emotes. You can use these emotes with say \"*emote\":\n\nburp, choke, collapse, dance, deathgasp, drool, gasp, gnarl, hiss, jump, me, moan, nod, roll, roar, scratch, screech, shake, shiver, sign-#, sulk, sway, tail, twitch, whimper"); break; default: this.WriteMsg("<span class='info'>Unusable emote '" + act + "'. Say *help for a list.</span>"); break; } if (Lang13.Bool(message) && this.stat == 0) { GlobalFuncs.log_emote("" + this.name + "/" + this.key + " : " + message); if (((m_type ?? 0) & 1) != 0) { this.visible_message(message); } else { this.audible_message(message); } } return; }
// Function from file: paper.dm public void addtofield(double?id = null, dynamic text = null, bool?links = null) { links = links ?? false; double?locid = null; int laststart = 0; int textindex = 0; int istart = 0; int iend = 0; string before = null; string after = null; string before2 = null; string after2 = null; locid = 0; laststart = 1; textindex = 1; while (true) { istart = 0; if (links == true) { istart = String13.FindIgnoreCase(this.info_links, "<span class=\"paper_field\">", laststart, 0); } else { istart = String13.FindIgnoreCase(this.info, "<span class=\"paper_field\">", laststart, 0); } if (istart == 0) { return; } laststart = istart + 1; locid++; if (locid == id) { iend = 1; if (links == true) { iend = String13.FindIgnoreCase(this.info_links, "</span>", istart, 0); } else { iend = String13.FindIgnoreCase(this.info, "</span>", istart, 0); } textindex = iend; break; } } if (links == true) { before = String13.SubStr(this.info_links, 1, textindex); after = String13.SubStr(this.info_links, textindex, 0); this.info_links = before + text + after; } else { before2 = String13.SubStr(this.info, 1, textindex); after2 = String13.SubStr(this.info, textindex, 0); this.info = before2 + text + after2; this.updateinfolinks(); } return; }
public void load_map(string dmm_file = null, bool x_offset = false, bool y_offset = false, int z_offset = 0) { string quote = null; string tfile = null; int tfile_len = 0; int lpos = 0; ByTable grid_models = null; int key_len = 0; string tline = null; string model_key = null; string model_contents = null; int zcrd = 0; double ycrd = 0; int xcrd = 0; int? zpos = null; string zgrid = null; int z_depth = 0; int x_depth = 0; double x_tilecount = 0; double y_depth = 0; int? gpos = null; string grid_line = null; double mpos = 0; string model_key2 = null; if (!(z_offset != 0)) { z_offset = Game13.map_size_z + 1; } if (!x_offset) { x_offset = false; } if (!y_offset) { y_offset = false; } quote = String13.GetCharFromCode(34); tfile = File13.Read(dmm_file); tfile_len = Lang13.Length(tfile); lpos = 1; grid_models = new ByTable(); key_len = Lang13.Length(String13.SubStr(tfile, 2, String13.FindIgnoreCase(tfile, quote, 2, 0))); lpos = 1; while (lpos < tfile_len) { tline = String13.SubStr(tfile, lpos, String13.FindIgnoreCase(tfile, "\n", lpos, 0)); if (String13.SubStr(tline, 1, 2) != quote) { break; } model_key = String13.SubStr(tline, 2, key_len + 2); model_contents = String13.SubStr(tline, String13.FindIgnoreCase(tfile, "=", 1, 0) + 3, Lang13.Length(tline)); grid_models[model_key] = model_contents; Task13.Sleep(-1); lpos = String13.FindIgnoreCase(tfile, "\n", lpos, 0) + 1; } zcrd = -1; ycrd = y_offset ?1:0; xcrd = x_offset ?1:0; zpos = null; zpos = String13.FindIgnoreCase(tfile, "\n(1,1,", lpos, 0); while (zpos != 0) { zcrd++; Game13.map_size_z = Num13.MaxInt(Game13.map_size_z, zcrd + z_offset); zgrid = String13.SubStr(tfile, String13.FindIgnoreCase(tfile, quote + "\n", zpos ?? 0, 0) + 2, String13.FindIgnoreCase(tfile, "\n" + quote, zpos ?? 0, 0) + 1); z_depth = Lang13.Length(zgrid); x_depth = Lang13.Length(String13.SubStr(zgrid, 1, String13.FindIgnoreCase(zgrid, "\n", 2, 0))); x_tilecount = x_depth / key_len; if (Game13.map_size_x < x_tilecount) { Game13.map_size_x = ((int)(x_tilecount)); } y_depth = z_depth / (x_depth + 1); if (Game13.map_size_y < y_depth) { Game13.map_size_y = ((int)(y_depth)); } ycrd = y_depth; gpos = null; gpos = 1; while (gpos != 0) { grid_line = String13.SubStr(zgrid, gpos ?? 0, String13.FindIgnoreCase(zgrid, "\n", gpos ?? 0, 0)); xcrd = 0; foreach (dynamic _a in Lang13.IterateRange(1, x_depth, key_len)) { mpos = _a; xcrd++; model_key2 = String13.SubStr(grid_line, ((int)(mpos)), ((int)(mpos + key_len))); this.parse_grid(grid_models[model_key2], xcrd + (x_offset ?1:0), ycrd + (y_offset ?1:0), zcrd + z_offset); } if ((gpos ?? 0) + x_depth + 1 > z_depth) { break; } ycrd--; Task13.Sleep(-1); gpos = String13.FindIgnoreCase(zgrid, "\n", gpos ?? 0, 0) + 1; } if (String13.FindIgnoreCase(tfile, quote + "}", zpos ?? 0, 0) + 2 == tfile_len) { break; } Task13.Sleep(-1); zpos = String13.FindIgnoreCase(tfile, "\n(1,1,", (zpos ?? 0) + 1, 0); } return; }
// Function from file: machine_interactions.dm public override dynamic Topic(string href = null, ByTable href_list = null, dynamic hsrc = null) { dynamic P = null; string newid = null; string newnet = null; Obj_Machinery_Telecomms T = null; dynamic newfreq = null; double? x = null; Obj_Machinery_Telecomms T2 = null; Obj_Machinery_Telecomms T3 = null; if (Lang13.Bool(base.Topic(href, href_list, (object)(hsrc)))) { return(null); } if (!(Task13.User is Mob_Living_Silicon)) { if (!(Task13.User.get_active_hand() is Obj_Item_Device_Multitool)) { return(null); } } P = this.get_multitool(Task13.User); if (Lang13.Bool(href_list["input"])) { dynamic _b = href_list["input"]; // Was a switch-case, sorry for the mess. if (_b == "toggle") { this.toggled = !this.toggled; this.temp = "<font color = #666633>-% " + this + " has been " + (this.toggled ? "activated" : "deactivated") + ".</font color>"; this.update_power(); } else if (_b == "id") { newid = String13.SubStr(GlobalFuncs.reject_bad_text(Interface13.Input(Task13.User, "Specify the new ID for this machine", this, this.id, null, InputType.Str | InputType.Null)), 1, 1024); if (Lang13.Bool(newid) && this.canAccess(Task13.User)) { this.id = newid; this.temp = "<font color = #666633>-% New ID assigned: \"" + this.id + "\" %-</font color>"; } } else if (_b == "network") { newnet = GlobalFuncs.stripped_input(Task13.User, "Specify the new network for this machine. This will break all current links.", this, this.network); if (Lang13.Bool(newnet) && this.canAccess(Task13.User)) { if (Lang13.Length(newnet) > 15) { this.temp = "<font color = #666633>-% Too many characters in new network tag %-</font color>"; } else { foreach (dynamic _a in Lang13.Enumerate(this.links, typeof(Obj_Machinery_Telecomms))) { T = _a; T.links.Remove(this); } this.network = newnet; this.links = new ByTable(); this.temp = "<font color = #666633>-% New network tag assigned: \"" + this.network + "\" %-</font color>"; } } } else if (_b == "freq") { newfreq = Interface13.Input(Task13.User, "Specify a new frequency to filter (GHz). Decimals assigned automatically.", this, this.network, null, InputType.Num | InputType.Null); if (Lang13.Bool(newfreq) && this.canAccess(Task13.User)) { if (String13.FindIgnoreCase(String13.NumberToString(Convert.ToDouble(newfreq)), ".", 1, 0) != 0) { newfreq *= 10; } if (newfreq == GlobalVars.SYND_FREQ) { this.temp = "<font color = #FF0000>-% Error: Interference preventing filtering frequency: \"" + newfreq + " GHz\" %-</font color>"; } else if (!this.freq_listening.Contains(newfreq) && Convert.ToDouble(newfreq) < 10000) { this.freq_listening.Add(newfreq); this.temp = "<font color = #666633>-% New frequency filter assigned: \"" + newfreq + " GHz\" %-</font color>"; } } } } if (Lang13.Bool(href_list["delete"])) { x = String13.ParseNumber(href_list["delete"]); this.temp = "<font color = #666633>-% Removed frequency filter " + x + " %-</font color>"; this.freq_listening.Remove(x); } if (Lang13.Bool(href_list["unlink"])) { if ((String13.ParseNumber(href_list["unlink"]) ?? 0) <= Lang13.Length(this.links)) { T2 = this.links[String13.ParseNumber(href_list["unlink"])]; if (T2 != null) { this.temp = new Txt("<font color = #666633>-% Removed ").Ref(T2).str(" ").item(T2.name).str(" from linked entities. %-</font color>").ToString(); if (T2.links != null) { T2.links.Remove(this); } this.links.Remove(T2); } else { this.temp = "<font color = #666633>-% Unable to locate machine to unlink from, try again. %-</font color>"; } } } if (Lang13.Bool(href_list["link"])) { if (Lang13.Bool(P)) { T3 = P.buffer; if (T3 is Obj_Machinery_Telecomms && T3 != this) { if (!T3.links.Contains(this)) { T3.links.Add(this); } if (!this.links.Contains(T3)) { this.links.Add(T3); } this.temp = new Txt("<font color = #666633>-% Successfully linked with ").Ref(T3).str(" ").item(T3.name).str(" %-</font color>").ToString(); } else { this.temp = "<font color = #666633>-% Unable to acquire buffer %-</font color>"; } } } if (Lang13.Bool(href_list["buffer"])) { P.buffer = this; this.temp = new Txt("<font color = #666633>-% Successfully stored ").Ref(P.buffer).str(" ").item(P.buffer.name).str(" in buffer %-</font color>").ToString(); } if (Lang13.Bool(href_list["flush"])) { this.temp = "<font color = #666633>-% Buffer successfully flushed. %-</font color>"; P.buffer = null; } this.Options_Topic(href, href_list); Task13.User.set_machine(this); this.updateUsrDialog(); return(null); }
// Function from file: tgstation.dme public override void emote(string act = null, int?m_type = null, dynamic message = null) { m_type = m_type ?? 1; string param = null; int t1 = 0; bool muzzled = false; param = null; if (String13.FindIgnoreCase(act, "-", 1, 0) != 0) { t1 = String13.FindIgnoreCase(act, "-", 1, 0); param = String13.SubStr(act, t1 + 1, Lang13.Length(act) + 1); act = String13.SubStr(act, 1, t1); } muzzled = this.is_muzzled(); switch ((string)(act)) { case "deathgasp": case "deathgasps": message = "<span class='name'>" + this + "</span> lets out a waning guttural screech, green blood bubbling from its maw..."; m_type = 2; break; case "gnarl": case "gnarls": if (!muzzled) { message = "<span class='name'>" + this + "</span> gnarls and shows its teeth.."; m_type = 2; } break; case "hiss": case "hisses": if (!muzzled) { message = "<span class='name'>" + this + "</span> hisses."; m_type = 2; } break; case "me": base.emote(act, m_type, (object)(message)); return; break; case "moan": case "moans": message = "<span class='name'>" + this + "</span> moans!"; m_type = 2; break; case "roar": case "roars": if (!muzzled) { message = "<span class='name'>" + this + "</span> roars."; m_type = 2; } break; case "roll": case "rolls": if (!this.restrained()) { message = "<span class='name'>" + this + "</span> rolls."; m_type = 1; } break; case "scratch": case "scratches": if (!this.restrained()) { message = "<span class='name'>" + this + "</span> scratches."; m_type = 1; } break; case "screech": case "screeches": if (!muzzled) { message = "<span class='name'>" + this + "</span> screeches."; m_type = 2; } break; case "shiver": case "shivers": message = "<span class='name'>" + this + "</span> shivers."; m_type = 2; break; case "sign": case "signs": if (!this.restrained()) { message = "<span class='name'>" + this + "</span> signs" + (Lang13.Bool(String13.ParseNumber(param)) ? " the number " + String13.ParseNumber(param) : null) + "."; m_type = 1; } break; case "tail": message = "<span class='name'>" + this + "</span> waves its tail."; m_type = 1; break; case "help": this.WriteMsg("Help for xenomorph emotes. You can use these emotes with say \"*emote\":\n\naflap, airguitar, blink, blink_r, blush, bow, burp, choke, chucke, clap, collapse, cough, dance, deathgasp, drool, flap, frown, gasp, giggle, glare-(none)/mob, gnarl, hiss, jump, laugh, look-atom, me, moan, nod, point-atom, roar, roll, scream, scratch, screech, shake, shiver, sign-#, sit, smile, sneeze, sniff, snore, stare-(none)/mob, sulk, sway, tail, tremble, twitch, twitch_s, wave, whimper, wink, yawn"); break; default: base.emote(act, m_type, (object)(message)); break; } if (Lang13.Bool(message) && this.stat == 0) { GlobalFuncs.log_emote("" + this.name + "/" + this.key + " : " + message); if (act == "roar") { GlobalFuncs.playsound(this.loc, "sound/voice/hiss5.ogg", 40, 1, 1); } if (act == "hiss") { GlobalFuncs.playsound(this.loc, "sound/voice/hiss3.ogg", 40, 1, 1); } if (act == "deathgasp") { GlobalFuncs.playsound(this.loc, "sound/voice/hiss6.ogg", 80, 1, 1); } if (((m_type ?? 0) & 1) != 0) { this.visible_message(message); } else { this.audible_message(message); } } return; }
// Function from file: abandoned_crates.dm public override dynamic attackby(dynamic A = null, dynamic user = null, string _params = null, bool?silent = null, bool?replace_spent = null) { ByTable guess = null; int bulls = 0; int cows = 0; int? i = null; string a = null; dynamic i2 = null; int a2 = 0; if (this.locked) { if (A is Obj_Item_Weapon_Card_Emag) { this.boom(user); } if (A is Obj_Item_Device_Multitool) { user.WriteMsg("<span class='notice'>DECA-CODE LOCK REPORT:</span>"); if (this.attempts == 1) { user.WriteMsg("<span class='warning'>* Anti-Tamper Bomb will activate on next failed access attempt.</span>"); } else { user.WriteMsg("<span class='notice'>* Anti-Tamper Bomb will activate after " + this.attempts + " failed access attempts.</span>"); } if (this.lastattempt != null) { guess = new ByTable(); bulls = 0; cows = 0; i = null; i = 1; while ((i ?? 0) < (this.codelen ?? 0) + 1) { a = String13.SubStr(this.lastattempt, i ?? 0, (i ?? 0) + 1); guess.Add(a); guess[a] = i; i++; } foreach (dynamic _a in Lang13.Enumerate(guess)) { i2 = _a; a2 = String13.FindIgnoreCase(this.code, i2, 1, 0); if (a2 == Convert.ToInt32(guess[i2])) { bulls++; } else if (a2 != 0) { cows++; } } user.WriteMsg("<span class='notice'>Last code attempt had " + bulls + " correct digits at correct positions and " + cows + " correct digits at incorrect positions.</span>"); } } else { base.attackby((object)(A), (object)(user), _params, silent, replace_spent); } } else { base.attackby((object)(A), (object)(user), _params, silent, replace_spent); } return(null); }