// Range: -1 Access: 0 Flags: ( 0, 4, 255 ) public static ByTable active_ais( bool? check_mind = null ) { ByTable _default = null; Mob_Living_Silicon_Ai A = null; if ( check_mind == null ) { check_mind = false; } _default = new ByTable(); A = null; foreach (dynamic _a in GlobalVars.living_mob_list ) { if ( !( _a is Mob_Living_Silicon_Ai ) ) { continue; } A = _a; if ( A.stat == 2 ) { continue; } if ( A.control_disabled ) { continue; } if ( check_mind == true ) { if ( !Lang13.Bool( A.mind ) ) { continue; } } _default += A; }; return _default; }
// Range: -1 Access: 0 Flags: ( 0, 4, 255 ) public static bool above_neck( dynamic zone = null ) { ByTable zones = null; zones = new ByTable(new object [] { "head", "mouth", "eyes" }); if ( zones.Find( zone ) != 0 ) { return true; } else { return false; } }
// Range: -1 Access: 0 Flags: ( 0, 4, 255 ) public static ByTable active_free_borgs( ) { ByTable _default = null; Mob_Living_Silicon_Robot R = null; _default = new ByTable(); R = null; foreach (dynamic _a in GlobalVars.living_mob_list ) { if ( !( _a is Mob_Living_Silicon_Robot ) ) { continue; } R = _a; if ( Lang13.Bool( R.connected_ai ) ) { continue; } if ( R.stat == 2 ) { continue; } if ( R.emagged || R.scrambledcodes || R.syndicate ) { continue; } _default += R; }; return _default; }
// Range: -1 Access: 0 Flags: ( 0, 4, 255 ) public static void gibs( dynamic location = null, ByTable viruses = null, dynamic MobDNA = null ) { new Ent_Effect_Gibspawner_Generic( location, viruses, MobDNA ); return; }
// Function from file: mixer.dm public override int?ui_act(string action = null, ByTable _params = null, Tgui ui = null, UiState state = null) { int?_default = null; dynamic pressure = null; double? value = null; double? value2 = null; if (Lang13.Bool(base.ui_act(action, _params, ui, state))) { return(_default); } switch ((string)(action)) { case "power": this.on = !this.on; this.investigate_log("was turned " + (this.on ? "on" : "off") + " by " + GlobalFuncs.key_name(Task13.User), "atmos"); _default = GlobalVars.TRUE; break; case "pressure": pressure = _params["pressure"]; if (pressure == "max") { pressure = 4500; _default = GlobalVars.TRUE; } else if (pressure == "input") { pressure = Interface13.Input("New output pressure (0-" + 4500 + " kPa):", this.name, this.target_pressure, null, null, InputType.Num | InputType.Null); if (!(pressure == null) && !Lang13.Bool(base.ui_act(action, _params, ui, state))) { _default = GlobalVars.TRUE; } } else if (String13.ParseNumber(pressure) != null) { pressure = String13.ParseNumber(pressure); _default = GlobalVars.TRUE; } if (Lang13.Bool(_default)) { this.target_pressure = Num13.MaxInt(0, Num13.MinInt(Convert.ToInt32(pressure), 4500)); this.investigate_log("was set to " + this.target_pressure + " kPa by " + GlobalFuncs.key_name(Task13.User), "atmos"); } break; case "node1": value = String13.ParseNumber(_params["concentration"]); this.node1_concentration = Num13.MaxInt(0, Num13.MinInt(1, ((int)(this.node1_concentration + (value ?? 0))))); this.node2_concentration = Num13.MaxInt(0, Num13.MinInt(1, ((int)(this.node2_concentration - (value ?? 0))))); this.investigate_log("was set to " + this.node1_concentration + " % on node 1 by " + GlobalFuncs.key_name(Task13.User), "atmos"); _default = GlobalVars.TRUE; break; case "node2": value2 = String13.ParseNumber(_params["concentration"]); this.node2_concentration = Num13.MaxInt(0, Num13.MinInt(1, ((int)(this.node2_concentration + (value2 ?? 0))))); this.node1_concentration = Num13.MaxInt(0, Num13.MinInt(1, ((int)(this.node1_concentration - (value2 ?? 0))))); this.investigate_log("was set to " + this.node2_concentration + " % on node 2 by " + GlobalFuncs.key_name(Task13.User), "atmos"); _default = GlobalVars.TRUE; break; } this.update_icon(); return(_default); }
// Range: -1 Access: 0 Flags: ( 0, 4, 255 ) public static ByTable pollCandidates( string Question = null, string jobbanType = null, GameMode gametypeCheck = null, dynamic be_special_flag = null, int? poll_time = null ) { ByTable candidates = null; int time_passed = 0; Mob_Dead_Observer G = null; Mob_Dead_Observer G2 = null; if ( be_special_flag == null ) { be_special_flag = 0; } if ( poll_time == null ) { poll_time = 300; } candidates = new ByTable(); time_passed = Game13.time; if ( !Lang13.Bool( Question ) ) { Question = "Would you like to be a special role?"; } G = null; foreach (dynamic _b in GlobalVars.player_list ) { if ( !( _b is Mob_Dead_Observer ) ) { continue; } G = _b; if ( !Lang13.Bool( ((dynamic)G).key ) || !Lang13.Bool( ((dynamic)G).client ) ) { continue; } if ( Lang13.Bool( be_special_flag ) ) { if ( !Lang13.Bool( ((dynamic)G).client.prefs.be_special & be_special_flag ) ) { continue; } } if ( gametypeCheck != null ) { if ( !gametypeCheck.age_check( ((dynamic)G).client ) ) { continue; } } if ( Lang13.Bool( jobbanType ) ) { if ( Lang13.Bool( GlobalFuncs.jobban_isbanned( G, jobbanType ) ) || Lang13.Bool( GlobalFuncs.jobban_isbanned( G, "Syndicate" ) ) ) { continue; } } Task13.schedule( 0, (Task13.Closure)(() => { ((dynamic)G).write( "sound/misc/notice2.ogg" ); dynamic _a = GlobalFuncs.askuser( G, Question, "Please answer in " + ( poll_time ??0) / 10 + " seconds!", "Yes", "No", null, false, poll_time ); // Was a switch-case, sorry for the mess. if ( _a==1 ) { ((dynamic)G).write( "<span class='notice'>Choice registered: Yes.</span>" ); if ( Game13.time - time_passed > ( poll_time ??0) ) { ((dynamic)G).write( "<span class='danger'>Sorry, you were too late for the consideration!</span>" ); ((dynamic)G).write( "sound/machines/buzz-sigh.ogg" ); } else { candidates += G; } } else if ( _a==2 ) { ((dynamic)G).write( "<span class='danger'>Choice registered: No.</span>" ); }; return; })); }; Task13.sleep( poll_time ??0 ); G2 = null; foreach (dynamic _c in candidates ) { if ( !( _c is Mob_Dead_Observer ) ) { continue; } G2 = _c; if ( !Lang13.Bool( ((dynamic)G2).key ) || !Lang13.Bool( ((dynamic)G2).client ) ) { candidates.Remove( G2 ); } }; return candidates; }
// Range: -1 Access: 0 Flags: ( 0, 4, 255 ) public static dynamic next_list_item( dynamic item = null, ByTable L = null ) { int i = 0; i = L.Find( item ); if ( i == L.len ) { i = 1; } else { i++; } return L[i]; }
// Range: -1 Access: 0 Flags: ( 0, 4, 255 ) public static void mineral_scan_pulse( ByTable mobs = null, dynamic T = null, dynamic range = null ) { ByTable minerals = null; Tile_Simulated_Mineral M = null; dynamic user = null; dynamic C = null; Tile_Simulated_Mineral M2 = null; dynamic F = null; Image I = null; if ( range == null ) { range = Game13.view; } minerals = new ByTable(); M = null; foreach (dynamic _a in Map13.fetch_in_range( T, range ) ) { if ( !( _a is Tile_Simulated_Mineral ) ) { continue; } M = _a; if ( Lang13.Bool( M.scan_state ) ) { minerals += M; } }; if ( minerals.len != 0 ) { user = null; foreach (dynamic _c in mobs ) { user = _c; if ( Lang13.Bool( user.client ) ) { C = user.client; M2 = null; foreach (dynamic _b in minerals ) { if ( !( _b is Tile_Simulated_Mineral ) ) { continue; } M2 = _b; F = GlobalFuncs.get_turf( M2 ); I = new Image( "icons/turf/mining.dmi", F, M2.scan_state, 18 ); C.images += I; Task13.schedule( 30, (Task13.Closure)(() => { if ( Lang13.Bool( C ) ) { C.images -= I; } return; })); }; } }; } return; }
// Range: -1 Access: 0 Flags: ( 0, 4, 255 ) public static dynamic listgetindex( ByTable L = null, dynamic index = null ) { if ( L is ByTable ) { if ( Lang13.isNumber( index ) ) { if ( GlobalFuncs.IsInRange( index, 1, L.len ) ) { return L[index]; } } else if ( L.contains( index ) ) { return L[index]; } } return null; }
// Range: -1 Access: 0 Flags: ( 0, 4, 255 ) public static bool isemptylist( ByTable L = null ) { if ( !( L.len != 0 ) ) { return true; } return false; }
// Function from file: laborstacker.dm public override dynamic Topic(string href = null, ByTable href_list = null, dynamic hsrc = null) { dynamic I = null; Obj_DockingPort_Stationary S = null; Task13.User.set_machine(this); this.add_fingerprint(Task13.User); if (Lang13.Bool(href_list["choice"])) { if (this.inserted_id is Obj_Item_Weapon_Card_Id_Prisoner) { if (href_list["choice"] == "eject") { this.inserted_id.loc = this.loc; this.inserted_id.__CallVerb("Pick up"); this.inserted_id = null; } if (href_list["choice"] == "claim") { this.inserted_id.points += this.machine.points; this.machine.points = 0; ((dynamic)this).WriteMsg("Points transferred."); } } else if (href_list["choice"] == "insert") { I = Task13.User.get_active_hand(); if (I is Obj_Item_Weapon_Card_Id_Prisoner) { if (!Task13.User.drop_item()) { return(null); } I.loc = this; this.inserted_id = I; } else { Task13.User.WriteMsg("<span class='warning'>Invalid ID.</span>"); } } if (this.check_auth()) { if (href_list["choice"] == "station") { if (!GlobalFuncs.alone_in_area(GlobalFuncs.get_area(this), Task13.User)) { Task13.User.WriteMsg("<span class='warning'>Prisoners are only allowed to be released while alone.</span>"); } else { switch ((int)(GlobalVars.SSshuttle.moveShuttle("laborcamp", "laborcamp_home"))) { case 1: Task13.User.WriteMsg("<span class='notice'>Shuttle not found</span>"); break; case 2: Task13.User.WriteMsg("<span class='notice'>Shuttle already at station</span>"); break; case 3: Task13.User.WriteMsg("<span class='notice'>No permission to dock could be granted.</span>"); break; default: this.Radio.set_frequency(GlobalVars.SEC_FREQ); this.Radio.talk_into(this, "" + this.inserted_id.registered_name + " has returned to the station. Minerals and Prisoner ID card ready for retrieval.", GlobalVars.SEC_FREQ); Task13.User.WriteMsg("<span class='notice'>Shuttle received message and will be sent shortly.</span>"); break; } } } if (href_list["choice"] == "release") { if (GlobalFuncs.alone_in_area(GlobalFuncs.get_area(this.loc), Task13.User)) { S = GlobalVars.SSshuttle.getDock("laborcamp_home"); if (S != null && Lang13.Bool(S.get_docked())) { if (this.release_door != null && this.release_door.density) { this.release_door.open(); } } else { Task13.User.WriteMsg("<span class='warning'>Prisoners can only be released while docked with the station.</span>"); } } else { Task13.User.WriteMsg("<span class='warning'>Prisoners are only allowed to be released while alone.</span>"); } } } this.updateUsrDialog(); } return(null); }
// Function from file: requests_console.dm public override dynamic Topic(string href = null, ByTable href_list = null, dynamic hsrc = null) { string new_message = null; string new_message2 = null; double?radio_freq = null; string log_msg = null; string sending = null; bool pass = false; Obj_Machinery_MessageServer MS = null; double?radio_freq2 = null; string authentic = null; string alert = null; Obj_Machinery_RequestsConsole Console = null; if (Lang13.Bool(base.Topic(href, href_list, (object)(hsrc)))) { return(null); } Task13.User.set_machine(this); this.add_fingerprint(Task13.User); if (Lang13.Bool(GlobalFuncs.reject_bad_text(href_list["write"]))) { this.dpt = String13.CKey(href_list["write"]); new_message = String13.SubStr(GlobalFuncs.reject_bad_text(Interface13.Input(Task13.User, "Write your message:", "Awaiting Input", "", null, InputType.Any)), 1, 1024); if (Lang13.Bool(new_message)) { this.message = new_message; this.screen = 9; if ((String13.ParseNumber(href_list["priority"]) ?? 0) < 2) { this.priority = -1; } else { this.priority = String13.ParseNumber(href_list["priority"]); } } else { this.dpt = ""; this.msgVerified = ""; this.msgStamped = ""; this.screen = 0; this.priority = -1; } } if (Lang13.Bool(href_list["writeAnnouncement"])) { new_message2 = String13.SubStr(GlobalFuncs.reject_bad_text(Interface13.Input(Task13.User, "Write your message:", "Awaiting Input", "", null, InputType.Any)), 1, 1024); if (Lang13.Bool(new_message2)) { this.message = new_message2; if ((String13.ParseNumber(href_list["priority"]) ?? 0) < 2) { this.priority = -1; } else { this.priority = String13.ParseNumber(href_list["priority"]); } } else { this.message = ""; this.announceAuth = false; this.screen = 0; } } if (Lang13.Bool(href_list["sendAnnouncement"])) { if (!this.announcementConsole) { return(null); } GlobalFuncs.minor_announce(this.message, "" + this.department + " Announcement:"); GlobalVars.news_network.SubmitArticle(this.message, this.department, "Station Announcements", null); GlobalFuncs.log_say("" + GlobalFuncs.key_name(Task13.User) + " has made a station announcement: " + this.message); GlobalFuncs.message_admins("" + GlobalFuncs.key_name_admin(Task13.User) + " has made a station announcement."); this.announceAuth = false; this.message = ""; this.screen = 0; } if (Lang13.Bool(href_list["emergency"])) { if (!Lang13.Bool(this.emergency)) { switch ((int?)(String13.ParseNumber(href_list["emergency"]))) { case 1: radio_freq = GlobalVars.SEC_FREQ; this.emergency = "Security"; break; case 2: radio_freq = GlobalVars.ENG_FREQ; this.emergency = "Engineering"; break; case 3: radio_freq = GlobalVars.MED_FREQ; this.emergency = "Medical"; break; } if (Lang13.Bool(radio_freq)) { this.Radio.set_frequency(radio_freq); this.Radio.talk_into(this, "" + this.emergency + " emergency in " + this.department + "!!", radio_freq); this.update_icon(); Task13.Schedule(3000, (Task13.Closure)(() => { this.emergency = null; this.update_icon(); return; })); } } } if (Lang13.Bool(href_list["department"]) && Lang13.Bool(this.message)) { log_msg = this.message; sending = this.message; sending += "<br>"; if (Lang13.Bool(this.msgVerified)) { sending += this.msgVerified; sending += "<br>"; } if (Lang13.Bool(this.msgStamped)) { sending += this.msgStamped; sending += "<br>"; } this.screen = 7; if (Lang13.Bool(sending)) { pass = false; foreach (dynamic _b in Lang13.Enumerate(GlobalVars.machines, typeof(Obj_Machinery_MessageServer))) { MS = _b; if (!MS.active) { continue; } MS.send_rc_message(href_list["department"], this.department, log_msg, this.msgStamped, this.msgVerified, this.priority); pass = true; } if (pass) { radio_freq2 = 0; dynamic _c = href_list["department"]; // Was a switch-case, sorry for the mess. if (_c == "bridge") { radio_freq2 = GlobalVars.COMM_FREQ; } else if (_c == "medbay") { radio_freq2 = GlobalVars.MED_FREQ; } else if (_c == "science") { radio_freq2 = GlobalVars.SCI_FREQ; } else if (_c == "engineering") { radio_freq2 = GlobalVars.ENG_FREQ; } else if (_c == "security") { radio_freq2 = GlobalVars.SEC_FREQ; } else if (_c == "cargobay") { radio_freq2 = GlobalVars.SUPP_FREQ; } this.Radio.set_frequency(radio_freq2); authentic = null; if (Lang13.Bool(this.msgVerified) || Lang13.Bool(this.msgStamped)) { authentic = " (Authenticated)"; } alert = ""; foreach (dynamic _e in Lang13.Enumerate(GlobalVars.allConsoles, typeof(Obj_Machinery_RequestsConsole))) { Console = _e; if (String13.CKey(Console.department) == String13.CKey(href_list["department"])) { switch ((int?)(this.priority)) { case 2: alert = "PRIORITY Alert in " + this.department + authentic; Console.createmessage(this, alert, sending, 2); break; case 3: alert = "EXTREME PRIORITY Alert from " + this.department + authentic; Console.createmessage(this, alert, sending, 3); break; default: alert = "Message from " + this.department + authentic; Console.createmessage(this, alert, sending, 1); break; } this.screen = 6; Console.SetLuminosity(2); } } if (Lang13.Bool(radio_freq2)) { this.Radio.talk_into(this, "" + alert + ": <i>" + this.message + "</i>", radio_freq2); } switch ((int?)(this.priority)) { case 2: this.messages.Add("<span class='bad'>High Priority</span><BR><b>To:</b> " + this.dpt + "<BR>" + sending); break; default: this.messages.Add("<b>To: " + this.dpt + "</b><BR>" + sending); break; } } else { this.say("NOTICE: No server detected!"); } } } switch ((int?)(String13.ParseNumber(href_list["setScreen"]))) { case null: break; case 1: this.screen = 1; break; case 2: this.screen = 2; break; case 3: this.screen = 3; break; case 5: this.screen = 5; break; case 6: this.screen = 6; break; case 7: this.screen = 7; break; case 8: this.screen = 8; break; case 9: this.screen = 9; break; case 10: if (!this.announcementConsole) { return(null); } this.screen = 10; break; default: this.dpt = ""; this.msgVerified = ""; this.msgStamped = ""; this.message = ""; this.priority = -1; this.screen = 0; break; } dynamic _h = href_list["setSilent"]; // Was a switch-case, sorry for the mess. if (_h == null) { } else if (_h == "1") { this.silent = true; } else { this.silent = false; } this.updateUsrDialog(); return(null); }
// Function from file: teleporter.dm public override dynamic Topic(string href = null, ByTable href_list = null, dynamic hsrc = null) { if (Lang13.Bool(base.Topic(href, href_list, (object)(hsrc)))) { return(null); } if (Lang13.Bool(href_list["eject"])) { this.eject(); this.updateDialog(); return(null); } if (!this.check_hub_connection()) { this.say("<span class='warning'>Error: Unable to detect hub.</span>"); return(null); } if (this.calibrating) { this.say("<span class='warning'>Error: Calibration in progress. Stand by.</span>"); return(null); } if (Lang13.Bool(href_list["regimeset"])) { this.power_station.engaged = 0; this.power_station.teleporter_hub.update_icon(); this.power_station.teleporter_hub.calibrated = 0; this.reset_regime(); } if (Lang13.Bool(href_list["settarget"])) { this.power_station.engaged = 0; this.power_station.teleporter_hub.update_icon(); this.power_station.teleporter_hub.calibrated = 0; this.set_target(Task13.User); } if (Lang13.Bool(href_list["locked"])) { this.power_station.engaged = 0; this.power_station.teleporter_hub.update_icon(); this.power_station.teleporter_hub.calibrated = 0; this.target = GlobalFuncs.get_turf(this.locked.locked_location); } if (Lang13.Bool(href_list["calibrate"])) { if (!Lang13.Bool(this.target)) { this.say("<span class='danger'>Error: No target set to calibrate to.</span>"); return(null); } if (Lang13.Bool(this.power_station.teleporter_hub.calibrated) || this.power_station.teleporter_hub.accurate >= 3) { this.say("<span class='warning'>Hub is already calibrated!</span>"); return(null); } this.say("<span class='notice'>Processing hub calibration to target...</span>"); this.calibrating = true; Task13.Schedule(((int)((3 - this.power_station.teleporter_hub.accurate) * 50)), (Task13.Closure)(() => { this.calibrating = false; if (this.check_hub_connection()) { this.power_station.teleporter_hub.calibrated = 1; this.say("<span class='notice'>Calibration complete.</span>"); } else { this.say("<span class='danger'>Error: Unable to detect hub.</span>"); } this.updateDialog(); return; })); } this.updateDialog(); return(null); }
// Function from file: teleporter.dm public void set_target(Mob user = null) { ByTable L = null; ByTable areaindex = null; Obj_Item_Device_Radio_Beacon R = null; dynamic T = null; string tmpname = null; Obj_Item_Weapon_Implant_Tracking I = null; Ent_Static M = null; dynamic T2 = null; string tmpname2 = null; dynamic desc = null; ByTable L2 = null; ByTable areaindex2 = null; ByTable S = null; Obj_Machinery_Teleport_Station R2 = null; dynamic T3 = null; string tmpname3 = null; dynamic desc2 = null; dynamic trg = null; if (this.regime_set == "Teleporter") { L = new ByTable(); areaindex = new ByTable(); foreach (dynamic _a in Lang13.Enumerate(typeof(Game13), typeof(Obj_Item_Device_Radio_Beacon))) { R = _a; T = GlobalFuncs.get_turf(R); if (!Lang13.Bool(T)) { continue; } if (Convert.ToInt32(T.z) == 2 || Convert.ToDouble(T.z) > 7) { continue; } tmpname = T.loc.name; if (Lang13.Bool(areaindex[tmpname])) { tmpname = "" + tmpname + " (" + ++areaindex[tmpname] + ")"; } else { areaindex[tmpname] = 1; } L[tmpname] = R; } foreach (dynamic _b in Lang13.Enumerate(GlobalVars.tracked_implants, typeof(Obj_Item_Weapon_Implant_Tracking))) { I = _b; if (!Lang13.Bool(I.implanted) || !(I.loc is Mob)) { continue; } else { M = I.loc; if (Convert.ToInt32(((dynamic)M).stat) == 2) { if (Convert.ToDouble(((dynamic)M).timeofdeath + 6000) < Game13.time) { continue; } } T2 = GlobalFuncs.get_turf(M); if (!Lang13.Bool(T2)) { continue; } if (Convert.ToInt32(T2.z) == 2) { continue; } tmpname2 = ((dynamic)M).real_name; if (Lang13.Bool(areaindex[tmpname2])) { tmpname2 = "" + tmpname2 + " (" + ++areaindex[tmpname2] + ")"; } else { areaindex[tmpname2] = 1; } L[tmpname2] = I; } } desc = Interface13.Input("Please select a location to lock in.", "Locking Computer", null, null, L, InputType.Any); this.target = L[desc]; } else { L2 = new ByTable(); areaindex2 = new ByTable(); S = this.power_station.linked_stations; if (!(S.len != 0)) { user.WriteMsg("<span class='alert'>No connected stations located.</span>"); return; } foreach (dynamic _c in Lang13.Enumerate(S, typeof(Obj_Machinery_Teleport_Station))) { R2 = _c; T3 = GlobalFuncs.get_turf(R2); if (!Lang13.Bool(T3) || !Lang13.Bool(R2.teleporter_hub) || !Lang13.Bool(R2.teleporter_console)) { continue; } if (Convert.ToInt32(T3.z) == 2 || Convert.ToDouble(T3.z) > 7) { continue; } tmpname3 = T3.loc.name; if (Lang13.Bool(areaindex2[tmpname3])) { tmpname3 = "" + tmpname3 + " (" + ++areaindex2[tmpname3] + ")"; } else { areaindex2[tmpname3] = 1; } L2[tmpname3] = R2; } desc2 = Interface13.Input("Please select a station to lock in.", "Locking Computer", null, null, L2, InputType.Any); this.target = L2[desc2]; if (Lang13.Bool(this.target)) { trg = this.target; trg.linked_stations.Or(this.power_station); trg.stat &= 65533; if (Lang13.Bool(trg.teleporter_hub)) { trg.teleporter_hub.stat &= 65533; trg.teleporter_hub.update_icon(); } if (Lang13.Bool(trg.teleporter_console)) { trg.teleporter_console.stat &= 65533; trg.teleporter_console.update_icon(); } } } return; }
// Function from file: nuclear.dm public override bool post_setup(bool?report = null) { ByTable synd_spawn = null; Obj_Effect_Landmark A = null; string nuke_code = null; bool leader_selected = false; int agent_number = 0; int spawnpos = 0; Mind synd_mind = null; dynamic nuke = null; synd_spawn = new ByTable(); foreach (dynamic _a in Lang13.Enumerate(GlobalVars.landmarks_list, typeof(Obj_Effect_Landmark))) { A = _a; if (A.name == "Syndicate-Spawn") { synd_spawn.Add(GlobalFuncs.get_turf(A)); continue; } } nuke_code = "" + Rand13.Int(10000, 99999); leader_selected = false; agent_number = 1; spawnpos = 1; foreach (dynamic _b in Lang13.Enumerate(this.syndicates, typeof(Mind))) { synd_mind = _b; if (spawnpos > synd_spawn.len) { spawnpos = 2; } synd_mind.current.loc = synd_spawn[spawnpos]; this.forge_syndicate_objectives(synd_mind); this.greet_syndicate(synd_mind); this.equip_syndicate(synd_mind.current); if (Lang13.Bool(nuke_code)) { synd_mind.store_memory("<B>Syndicate Nuclear Bomb Code</B>: " + nuke_code); synd_mind.current.WriteMsg("The nuclear authorization code is: <B>" + nuke_code + "</B>"); } if (!leader_selected) { this.prepare_syndicate_leader(synd_mind, nuke_code); leader_selected = true; } else { synd_mind.current.real_name = "" + GlobalFuncs.syndicate_name() + " Operative #" + agent_number; agent_number++; } spawnpos++; this.update_synd_icons_added(synd_mind); } nuke = Lang13.FindIn("syndienuke", GlobalVars.nuke_list); if (Lang13.Bool(nuke)) { nuke.r_code = nuke_code; } return(base.post_setup(report)); }
// Function from file: jobs.dm public bool DivideOccupations( ) { Job_Ai A = null; Mob_NewPlayer player = null; Job_Assistant assist = null; ByTable assistant_candidates = null; Mob_NewPlayer player2 = null; dynamic shuffledoccupations = null; double level = 0; Mob_NewPlayer player3 = null; Job job = null; Mob_NewPlayer player4 = null; Mob_NewPlayer player5 = null; Mob_NewPlayer player6 = null; this.Debug("Running DO"); if (GlobalVars.ticker != null) { foreach (dynamic _a in Lang13.Enumerate(this.occupations, typeof(Job_Ai))) { A = _a; if (GlobalVars.ticker.triai) { A.spawn_positions = 3; } } } foreach (dynamic _b in Lang13.Enumerate(GlobalVars.player_list, typeof(Mob_NewPlayer))) { player = _b; if (Lang13.Bool(player.ready) && player.mind != null && !Lang13.Bool(player.mind.assigned_role)) { this.unassigned += player; } } this.initial_players_to_assign = this.unassigned.len; this.Debug("DO, Len: " + this.unassigned.len); if (this.unassigned.len == 0) { return(false); } this.setup_officer_positions(); if (Lang13.Bool(GlobalVars.config.minimal_access_threshold)) { if ((GlobalVars.config.minimal_access_threshold ?? 0) > this.unassigned.len) { GlobalVars.config.jobs_have_minimal_access = false; } else { GlobalVars.config.jobs_have_minimal_access = true; } } this.unassigned = GlobalFuncs.shuffle(this.unassigned); this.HandleFeedbackGathering(); this.Debug("DO, Running Assistant Check 1"); assist = new Job_Assistant(); assistant_candidates = this.FindOccupationCandidates(assist, 3); this.Debug("AC1, Candidates: " + assistant_candidates.len); foreach (dynamic _c in Lang13.Enumerate(assistant_candidates, typeof(Mob_NewPlayer))) { player2 = _c; this.Debug("AC1 pass, Player: " + player2); this.AssignRole(player2, "Assistant"); assistant_candidates.Remove(player2); } this.Debug("DO, AC1 end"); this.Debug("DO, Running Head Check"); this.FillHeadPosition(); this.Debug("DO, Head Check end"); this.Debug("DO, Running AI Check"); this.FillAIPosition(); this.Debug("DO, AI Check end"); this.Debug("DO, Running Standard Check"); shuffledoccupations = GlobalFuncs.shuffle(this.occupations); foreach (dynamic _f in Lang13.IterateRange(1, 3)) { level = _f; this.CheckHeadPositions(level); foreach (dynamic _e in Lang13.Enumerate(this.unassigned, typeof(Mob_NewPlayer))) { player3 = _e; if (this.PopcapReached()) { this.RejectPlayer(player3); } foreach (dynamic _d in Lang13.Enumerate(shuffledoccupations, typeof(Job))) { job = _d; if (!(job != null)) { continue; } if (GlobalFuncs.jobban_isbanned(player3, job.title)) { this.Debug("DO isbanned failed, Player: " + player3 + ", Job:" + job.title); continue; } if (!job.player_old_enough(player3.client)) { this.Debug("DO player not old enough, Player: " + player3 + ", Job:" + job.title); continue; } if (player3.mind.restricted_roles.Contains(player3.mind != null && Lang13.Bool(job.title))) { this.Debug("DO incompatible with antagonist role, Player: " + player3 + ", Job:" + job.title); continue; } if (GlobalVars.config.enforce_human_authority && !((Species)player3.client.prefs.pref_species).qualifies_for_rank(job.title, player3.client.prefs.features)) { this.Debug("DO non-human failed, Player: " + player3 + ", Job:" + job.title); continue; } if (Lang13.Bool(player3.client.prefs.GetJobDepartment(job, level) & job.flag)) { if ((job.current_positions ?? 0) < (job.spawn_positions ?? 0) || job.spawn_positions == -1) { this.Debug("DO pass, Player: " + player3 + ", Level:" + level + ", Job:" + job.title); this.AssignRole(player3, job.title); this.unassigned -= player3; break; } } } } } foreach (dynamic _g in Lang13.Enumerate(this.unassigned, typeof(Mob_NewPlayer))) { player4 = _g; if (this.PopcapReached()) { this.RejectPlayer(player4); } else if (GlobalFuncs.jobban_isbanned(player4, "Assistant")) { this.GiveRandomJob(player4); } } foreach (dynamic _h in Lang13.Enumerate(this.unassigned, typeof(Mob_NewPlayer))) { player5 = _h; if (this.PopcapReached()) { this.RejectPlayer(player5); } else if (Lang13.Bool(player5.client.prefs.userandomjob)) { this.GiveRandomJob(player5); } } this.Debug("DO, Standard Check end"); this.Debug("DO, Running AC2"); foreach (dynamic _i in Lang13.Enumerate(this.unassigned, typeof(Mob_NewPlayer))) { player6 = _i; if (this.PopcapReached()) { this.RejectPlayer(player6); } this.Debug("AC2 Assistant located, Player: " + player6); this.AssignRole(player6, "Assistant"); } return(true); }
// Function from file: npcpool.dm public override void fire( ) { int?npcCount = null; Mob_Living_Carbon_Human_Interactive check = null; ByTable checkInRange = null; Mob_Living_Carbon_Human_Interactive check2 = null; dynamic candidate = null; int facCount = 0; int helpProb = 0; dynamic C = null; dynamic D = null; Mob_Living_Carbon_Human_Interactive check3 = null; dynamic candidate2 = null; int facCount2 = 0; int helpProb2 = 0; dynamic C2 = null; dynamic D2 = null; npcCount = 1; foreach (dynamic _a in Lang13.Enumerate(this.botPool_l, typeof(Mob_Living_Carbon_Human_Interactive))) { check = _a; if (!(check != null)) { this.botPool_l.Cut(npcCount, (npcCount ?? 0) + 1); continue; } checkInRange = Map13.FetchInView(check, 32); if (!Lang13.Bool(Lang13.FindIn(check.TARGET, checkInRange))) { this.needsDelegate.Or(check); } else if (check.isnotfunc(GlobalVars.FALSE)) { this.needsDelegate.Or(check); } else if ((check.doing & 8) != 0) { this.needsAssistant.Or(check); } else { this.canBeUsed.Or(check); } npcCount++; } if (this.needsDelegate.len != 0) { npcCount = 1; foreach (dynamic _d in Lang13.Enumerate(this.needsDelegate, typeof(Mob_Living_Carbon_Human_Interactive))) { check2 = _d; if (!(check2 != null)) { this.needsDelegate.Cut(npcCount, (npcCount ?? 0) + 1); continue; } if (this.canBeUsed.len != 0) { candidate = Rand13.PickFromTable(this.canBeUsed); facCount = 0; helpProb = 0; foreach (dynamic _c in Lang13.Enumerate(check2.faction)) { C = _c; foreach (dynamic _b in Lang13.Enumerate(candidate.faction)) { D = _b; if (D == C) { helpProb = Num13.MinInt(100, helpProb + 25); } facCount++; } } if (facCount == 1 && helpProb > 0) { helpProb = 100; } if (Rand13.PercentChance(helpProb)) { if (Lang13.Bool(((Mob_Living_Carbon_Human_Interactive)candidate).takeDelegate(check2))) { this.needsDelegate.Remove(check2); this.canBeUsed.Remove(candidate); candidate.eye_color = "red"; } } } npcCount++; } } if (this.needsAssistant.len != 0) { npcCount = 1; foreach (dynamic _g in Lang13.Enumerate(this.needsAssistant, typeof(Mob_Living_Carbon_Human_Interactive))) { check3 = _g; if (!(check3 != null)) { this.needsAssistant.Cut(npcCount, (npcCount ?? 0) + 1); continue; } if (this.canBeUsed.len != 0) { candidate2 = Rand13.PickFromTable(this.canBeUsed); facCount2 = 0; helpProb2 = 0; foreach (dynamic _f in Lang13.Enumerate(check3.faction)) { C2 = _f; foreach (dynamic _e in Lang13.Enumerate(candidate2.faction)) { D2 = _e; if (D2 == C2) { helpProb2 = Num13.MinInt(100, helpProb2 + 25); } facCount2++; } } if (facCount2 == 1 && helpProb2 > 0) { helpProb2 = 100; } if (Rand13.PercentChance(helpProb2)) { if (Lang13.Bool(((Mob_Living_Carbon_Human_Interactive)candidate2).takeDelegate(check3, GlobalVars.FALSE))) { this.needsAssistant.Remove(check3); this.canBeUsed.Remove(candidate2); candidate2.eye_color = "yellow"; } } } npcCount++; } } return; }
// Range: -1 Access: 0 Flags: ( 0, 4, 255 ) public static ByTable init_sprite_accessory_subtypes( dynamic prototype = null, ByTable L = null, ByTable male = null, ByTable female = null ) { dynamic path = null; dynamic D = null; if ( !( L is ByTable ) ) { L = new ByTable(); } if ( !( male is ByTable ) ) { male = new ByTable(); } if ( !( female is ByTable ) ) { female = new ByTable(); } path = null; foreach (dynamic _b in Lang13.get_all_types( prototype ) ) { path = _b; if ( path == prototype ) { continue; } D = Lang13.call( path ); if ( Lang13.Bool( D.icon_state ) ) { L[D.name] = D; } else { L += D.name; } dynamic _a = D.gender; // Was a switch-case, sorry for the mess. if ( _a=="male" ) { male += D.name; } else if ( _a=="female" ) { female += D.name; } else { male += D.name; female += D.name; }; }; return L; }
// Range: -1 Access: 0 Flags: ( 0, 4, 255 ) public static dynamic AStar( dynamic start = null, dynamic end = null, Mob_Living_SimpleAnimal atom = null, System.Reflection.MethodInfo dist = null, dynamic maxnodes = null, dynamic maxnodedepth = null, dynamic mintargetdist = null, System.Reflection.MethodInfo adjacent = null, Ent_Item_Weapon_Card_Id id = null, dynamic exclude = null, bool? simulated_only = null ) { Heap open = null; ByTable closed = null; ByTable path = null; dynamic cur = null; bool? closeenough = null; dynamic L = null; dynamic T = null; dynamic newg = null; PathNode PN = null; dynamic T2 = null; double? i = null; if ( maxnodedepth == null ) { maxnodedepth = 30; } if ( adjacent == null ) { adjacent = typeof(Tile).GetMethod( "reachableAdjacentTurfs" ); } if ( id == null ) { id = null; } if ( exclude == null ) { exclude = null; } if ( simulated_only == null ) { simulated_only = true; } if ( Lang13.Bool( maxnodes ) ) { if ( Lang13.Double( Lang13.call( Lang13.bindf( start, dist ), end ) ) > Lang13.Double( maxnodes ) ) { return 0; } maxnodedepth = maxnodes; } open = new Heap( typeof(GlobalFuncs).GetMethod( "HeapPathWeightCompare" ) ); closed = new ByTable(); path = null; start = GlobalFuncs.get_turf( start ); if ( !Lang13.Bool( start ) ) { return 0; } open.Insert( new PathNode( start, null, false, Lang13.call( Lang13.bindf( start, dist ), end ), false ) ); while (!open.IsEmpty() && !( path != null )) { cur = open.Pop(); closed.Add( cur.source ); closeenough = null; if ( Lang13.Bool( mintargetdist ) ) { closeenough = Lang13.Double( Lang13.call( Lang13.bindf( cur.source, dist ), end ) ) <= Lang13.Double( mintargetdist ); } if ( Lang13.Bool( maxnodedepth ) && Lang13.Double( cur.nt ) > Lang13.Double( maxnodedepth ) ) { continue; } if ( cur.source == end || closeenough == true ) { path = new ByTable(); path.Add( cur.source ); while (Lang13.Bool( cur.prevNode )) { cur = cur.prevNode; path.Add( cur.source ); } break; } L = Lang13.call( Lang13.bindf( cur.source, adjacent ), atom, id, simulated_only ); T = null; foreach (dynamic _a in L ) { T = _a; if ( T == exclude || closed.contains( T ) ) { continue; } newg = cur.g + Lang13.call( Lang13.bindf( cur.source, dist ), T ); if ( !Lang13.Bool( T.PNode ) ) { open.Insert( new PathNode( T, cur, Lang13.Bool( newg ), Lang13.call( Lang13.bindf( T, dist ), end ), Lang13.Bool( cur.nt + 1 ) ) ); } else if ( Lang13.Double( newg ) < Lang13.Double( T.PNode.g ) ) { T.PNode.prevNode = cur; T.PNode.g = newg; ((dynamic)T.PNode).calc_f(); T.PNode.nt = cur.nt + 1; open.ReSort( T.PNode ); } }; } PN = null; foreach (dynamic _b in open.L ) { if ( !( _b is PathNode ) ) { continue; } PN = _b; PN.source.PNode = null; }; T2 = null; foreach (dynamic _c in closed ) { T2 = _c; T2.PNode = null; }; if ( path != null ) { i = null; i = 1; while (( i ??0) <= path.len / 2) { path.Swap( ((int)( i )), ((int)( path.len - ( i ??0) + 1 )) ); i++; } } return path; }
// Function from file: camera.dm public bool use_camera_console(dynamic user = null) { ByTable camera_list = null; dynamic t = null; Obj_Machinery_Camera C = null; bool camera_fail = false; ByTable viewing = null; dynamic A = null; camera_list = this.get_available_cameras(); t = Interface13.Input(user, "Which camera should you change to?", null, null, camera_list, InputType.Null | InputType.Any); if (user.machine != this) { return(false); } if (!Lang13.Bool(t)) { ((Mob)user).unset_machine(); return(false); } C = camera_list[t]; if (t == "Cancel") { ((Mob)user).unset_machine(); return(false); } if (C != null) { camera_fail = false; if (!C.can_use() || user.machine != this || user.eye_blind != 0 || ((Mob)user).incapacitated()) { camera_fail = true; } else if (user is Mob_Living_Silicon_Robot) { viewing = Map13.FetchViewers(null, this); if (!(viewing.Find(user) != 0)) { camera_fail = true; } } else if (!(user is Mob_Living_Silicon)) { if (!this.Adjacent(user)) { camera_fail = true; } } if (camera_fail) { ((Mob)user).unset_machine(); return(false); } if (user is Mob_Living_Silicon_Ai) { A = user; ((Mob_Camera_AiEye)A.eyeobj).setLoc(GlobalFuncs.get_turf(C)); A.client.eye = A.eyeobj; } else { ((Mob)user).reset_perspective(C); } this.watchers[user] = C; this.f_use_power(50); Task13.Schedule(5, (Task13.Closure)(() => { this.use_camera_console(user); return; })); } else { ((Mob)user).unset_machine(); } return(false); }
// Function from file: area_teleport.dm public override bool cast(dynamic targets = null, dynamic thearea = null, dynamic user = null) { user = user ?? Task13.User; Mob_Living target = null; ByTable L = null; dynamic T = null; bool clear = false; Obj O = null; ByTable tempL = null; dynamic attempt = null; bool success = false; GlobalFuncs.playsound(GlobalFuncs.get_turf(user), this.sound1, 50, 1); foreach (dynamic _c in Lang13.Enumerate(targets, typeof(Mob_Living))) { target = _c; L = new ByTable(); foreach (dynamic _b in Lang13.Enumerate(GlobalFuncs.get_area_turfs(thearea.type))) { T = _b; if (!T.density) { clear = true; foreach (dynamic _a in Lang13.Enumerate(T, typeof(Obj))) { O = _a; if (O.density) { clear = false; break; } } if (clear) { L.Add(T); } } } if (!(L.len != 0)) { Task13.User.WriteMsg("The spell matrix was unable to locate a suitable teleport destination for an unknown reason. Sorry."); return(false); } if (target != null && target.buckled != null) { target.buckled.unbuckle_mob(); } tempL = L; attempt = null; success = false; while (tempL.len != 0) { attempt = Rand13.PickFromTable(tempL); target.Move(attempt); if (GlobalFuncs.get_turf(target) == attempt) { success = true; break; } else { tempL.Remove(attempt); } } if (!success) { target.loc = Rand13.PickFromTable(L); GlobalFuncs.playsound(GlobalFuncs.get_turf(user), this.sound2, 50, 1); } } return(false); }
// Function from file: overview.dm public void drawmap(Mob user = null) { int icx = 0; int icy = 0; int xoff = 0; int yoff = 0; int? icount = null; ByTable imap = null; int? i = null; int? wx = null; int? wy = null; Tile T = null; string colour = null; bool sense = false; GasMixture environment = null; double turf_total = 0; double t1 = 0; Ent_Static AM = null; Ent_Static A = null; int red = 0; int green = 0; int blue = 0; int ix = 0; int iy = 0; double? rx = null; double? ry = null; Icon I = null; int? i2 = null; Obj_Screen H = null; dynamic I2 = null; icx = Num13.Floor(Game13.map_size_x / 16) + 1; icy = Num13.Floor(Game13.map_size_y / 16) + 1; xoff = Num13.Floor(icx * 16 - Game13.map_size_x - 2); yoff = Num13.Floor(icy * 16 - Game13.map_size_y - 2); icount = icx * icy; imap = new ByTable(); i = null; i = 0; while ((i ?? 0) < (icount ?? 0)) { imap.Add(new Icon("icons/misc/imap.dmi", "blank")); i++; } wx = null; wx = 1; while ((wx ?? 0) <= Game13.map_size_x) { wy = null; wy = 1; while ((wy ?? 0) <= Game13.map_size_y) { T = Map13.GetTile(wx ?? 0, wy ?? 0, this.z); colour = null; if (!(T != null)) { colour = "#000000"; } else { sense = true; switch ((string)("" + T.type)) { case "/turf/space": colour = "#0a0a0a"; sense = false; break; case "/turf/simulated/floor": case "/turf/simulated/floor/engine": environment = T.return_air(); turf_total = environment.total_moles(); t1 = turf_total / 103.98379516601562 * 175; if (t1 <= 100) { colour = String13.ColorCode(0, 0, ((int)(t1 * 2.41))); } else { t1 = Num13.MinInt(100, ((int)(t1 - 100))); colour = String13.ColorCode(((int)(t1 * 2.41)), ((int)(t1 * 2.41)), 255); } break; case "/turf/simulated/wall": colour = "#606060"; break; case "/turf/simulated/wall/r_wall": colour = "#806060"; break; default: colour = "#002800"; break; } if (sense) { foreach (dynamic _b in Lang13.Enumerate(T.contents, typeof(Ent_Static))) { AM = _b; if (AM is Obj_Machinery_Door && !(AM is Obj_Machinery_Door_Window)) { if (AM.density) { colour = "#0060c0"; } else { colour = "#60c080"; } } if (AM is Obj_Machinery_Airalarm) { colour = "#00ff00"; if (AM.icon_state == "alarm:1") { colour = "#ffff00"; } } if (AM is Mob) { if (Lang13.Bool(((dynamic)AM).client)) { colour = "#ff0000"; } else { colour = "#ff8080"; } } } } A = T.loc; if (Lang13.Bool(((dynamic)A).fire)) { red = GlobalFuncs.getr(colour); green = GlobalFuncs.getg(colour); blue = GlobalFuncs.getb(colour); green = Num13.MinInt(255, green + 40); blue = Num13.MinInt(255, blue + 40); colour = String13.ColorCode(red, green, blue); } } ix = Num13.Floor(((wx ?? 0) * 2 + xoff) / 32); iy = Num13.Floor(((wy ?? 0) * 2 + yoff) / 32); rx = ((wx ?? 0) * 2 + xoff) % 32 + 1; ry = ((wy ?? 0) * 2 + yoff) % 32 + 1; I = imap[ix + icx * iy + 1]; I.DrawBox(colour, rx, ry, rx, ry); wy++; } wx++; } user.clearmap(); user.mapobjs = new ByTable(); i2 = null; i2 = 0; while ((i2 ?? 0) < (icount ?? 0)) { H = new Obj_Screen(); H.screen_loc = "" + ((i2 ?? 0) % icx + 5) + "," + (Num13.Floor((i2 ?? 0) / icx) + 6); H.name = (i2 == 0 ? "maprefresh" : "map"); I2 = imap[(i2 ?? 0) + 1]; H.icon = I2; GlobalFuncs.qdel(I2); H.layer = 25; Task13.User.mapobjs.Add(H); i2++; } user.client.screen.Add(user.mapobjs); this.close(user); return; }
// Range: -1 Access: 0 Flags: ( 0, 4, 255 ) public static bool attempt_initiate_surgery( Ent_Item_Weapon I = null, dynamic M = null, dynamic user = null ) { dynamic H = null; dynamic affecting = null; string selected_zone = null; Surgery current_surgery = null; Surgery S = null; ByTable all_surgeries = null; ByTable available_surgeries = null; Surgery S2 = null; dynamic path = null; dynamic P = null; dynamic S3 = null; dynamic procedure = null; if ( M is Mob_Living ) { selected_zone = user.zone_sel.selecting; if ( M is Mob_Living_Carbon_Human ) { H = M; affecting = ((dynamic)H).get_organ( GlobalFuncs.check_zone( selected_zone ) ); } if ( Lang13.Bool( M.lying ) || M is Mob_Living_SimpleAnimal_Slime ) { S = null; foreach (dynamic _a in M.surgeries ) { if ( !( _a is Surgery ) ) { continue; } S = _a; if ( S.location == selected_zone ) { current_surgery = S; } }; if ( !( current_surgery != null ) ) { all_surgeries = GlobalVars.surgeries_list.Copy(); available_surgeries = new ByTable(); S2 = null; foreach (dynamic _c in all_surgeries ) { if ( !( _c is Surgery ) ) { continue; } S2 = _c; if ( !( S2.possible_locs.Find( selected_zone ) != 0 ) ) { continue; } if ( Lang13.Bool( affecting ) && S2.requires_organic_bodypart && Lang13.Int( affecting.status ) == 2 ) { continue; } if ( !S2.can_start( user, M ) ) { continue; } path = null; foreach (dynamic _b in S2.species ) { path = _b; if ( Lang13.Bool( path.IsInstanceOfType( M ) ) ) { available_surgeries[S2.name] = S2; break; } }; }; P = Interface13.input( "Begin which procedure?", "Surgery", null, null, available_surgeries, 4224 ); if ( Lang13.Bool( P ) && Lang13.Bool( user ) && Lang13.Bool( ((dynamic)user).Adjacent( M ) ) && Lang13.Bool( ((dynamic)user).contains( I ) ) ) { S3 = available_surgeries[P]; procedure = S3.type(); if ( Lang13.Bool( procedure ) ) { procedure.location = selected_zone; if ( Lang13.Bool( procedure.ignore_clothes ) || GlobalFuncs.get_location_accessible( M, selected_zone ) ) { M.surgeries += procedure; procedure.organ = affecting; ((dynamic)user).visible_message( ((dynamic)new Txt()).item( user ).str( " drapes " ).item( I ).str( " over " ).item( M ).str( "'s " ).item( GlobalFuncs.parse_zone( selected_zone ) ).str( " to prepare for " ).a( procedure.name ).item().str( "." ), ((dynamic)new Txt( /* Pruned args, no ctor exists. */ )).item( I ).str( " over " ).item( M ).str( "'s " ).item( GlobalFuncs.parse_zone( selected_zone ) ).str( " to prepare for " ).a( procedure.name ).item().str( ".</span>" ) ); GlobalFuncs.add_logs( user, M, "operated", null, "Operation type: " + procedure.name + ", location: " + selected_zone ); } else { user.write( "<span class='warning'>You need to expose " + M + "'s " + GlobalFuncs.parse_zone( selected_zone ) + " first!</span>" ); } } } } else if ( !current_surgery.step_in_progress ) { if ( current_surgery.status ) { M.surgeries -= current_surgery; ((dynamic)user).visible_message( "" + user + " removes the drapes from " + M + "'s " + GlobalFuncs.parse_zone( selected_zone ) + ".", "<span class='notice'>You remove the drapes from " + M + "'s " + GlobalFuncs.parse_zone( selected_zone ) + ".</span>" ); GlobalFuncs.qdel( current_surgery ); } else if ( ((Mob)user).get_inactive_hand() is Ent_Item_Weapon_Cautery && current_surgery.can_cancel ) { M.surgeries -= current_surgery; ((dynamic)user).visible_message( "" + user + " mends the incision and removes the drapes from " + M + "'s " + GlobalFuncs.parse_zone( selected_zone ) + ".", "<span class='notice'>You mend the incision and remove the drapes from " + M + "'s " + GlobalFuncs.parse_zone( selected_zone ) + ".</span>" ); GlobalFuncs.qdel( current_surgery ); } else if ( current_surgery.can_cancel ) { user.write( "<span class='warning'>You need to hold a cautery in inactive hand to stop " + M + "'s surgery!</span>" ); } } return true; } } return false; }
// Function from file: pump.dm public override int?ui_act(string action = null, ByTable _params = null, Tgui ui = null, UiState state = null) { int?_default = null; dynamic plasma = null; dynamic n2o = null; dynamic pressure = null; if (Lang13.Bool(base.ui_act(action, _params, ui, state))) { return(_default); } switch ((string)(action)) { case "power": this.on = !this.on; if (this.on && !Lang13.Bool(this.holding)) { plasma = this.air_contents.gases["plasma"]; n2o = this.air_contents.gases["n2o"]; if (Lang13.Bool(n2o) || Lang13.Bool(plasma)) { GlobalFuncs.message_admins(new Txt().item(GlobalFuncs.key_name_admin(Task13.User)).str(" (<A HREF='?_src_=holder;adminmoreinfo=").Ref(Task13.User).str("'>?</A>) (<A HREF='?_src_=holder;adminplayerobservefollow=").Ref(Task13.User).str("'>FLW</A>) turned on a pump that contains ").item((Lang13.Bool(n2o) ? "N2O" : "")).item((Lang13.Bool(n2o) && Lang13.Bool(plasma) ? " & " : "")).item((Lang13.Bool(plasma) ? "Plasma" : "")).str("! (<A HREF='?_src_=holder;adminplayerobservecoodjump=1;X=").item(this.x).str(";Y=").item(this.y).str(";Z=").item(this.z).str("'>JMP</a>)").ToString()); GlobalFuncs.log_admin("" + GlobalFuncs.key_name(Task13.User) + " turned on a pump that contains " + (Lang13.Bool(n2o) ? "N2O" : "") + (Lang13.Bool(n2o) && Lang13.Bool(plasma) ? " & " : "") + (Lang13.Bool(plasma) ? "Plasma" : "") + " at " + this.x + ", " + this.y + ", " + this.z); } } _default = GlobalVars.TRUE; break; case "direction": if (this.direction == "out") { this.direction = "in"; } else { this.direction = "out"; } _default = GlobalVars.TRUE; break; case "pressure": pressure = _params["pressure"]; if (pressure == "reset") { pressure = 101.32499694824219; _default = GlobalVars.TRUE; } else if (pressure == "min") { pressure = 10.132499694824219; _default = GlobalVars.TRUE; } else if (pressure == "max") { pressure = 1013.25; _default = GlobalVars.TRUE; } else if (pressure == "input") { pressure = Interface13.Input("New release pressure (" + 10.132499694824219 + "-" + 1013.25 + " kPa):", this.name, this.pump.target_pressure, null, null, InputType.Num | InputType.Null); if (!(pressure == null) && !Lang13.Bool(base.ui_act(action, _params, ui, state))) { _default = GlobalVars.TRUE; } } else if (String13.ParseNumber(pressure) != null) { pressure = String13.ParseNumber(pressure); _default = GlobalVars.TRUE; } if (Lang13.Bool(_default)) { this.pump.target_pressure = Num13.MaxInt(((int)(10.132499694824219)), Num13.MinInt(Num13.Floor(Convert.ToDouble(pressure)), ((int)(1013.25)))); this.investigate_log("was set to " + this.pump.target_pressure + " kPa by " + GlobalFuncs.key_name(Task13.User) + ".", "atmos"); } break; case "eject": if (Lang13.Bool(this.holding)) { this.holding.loc = GlobalFuncs.get_turf(this); this.holding = null; _default = GlobalVars.TRUE; } break; } this.update_icon(); return(_default); }
// Range: -1 Access: 0 Flags: ( 0, 4, 255 ) public static void moveElement( ByTable L = null, dynamic fromIndex = null, dynamic toIndex = null ) { if ( fromIndex == toIndex || fromIndex + 1 == toIndex ) { return; } if ( Lang13.Double( fromIndex ) > Lang13.Double( toIndex ) ) { fromIndex++; } L.Insert( Lang13.Int( toIndex ), null ); L.Swap( Lang13.Int( fromIndex ), Lang13.Int( toIndex ) ); L.Cut( Lang13.IntNullable( fromIndex ), Lang13.Int( fromIndex + 1 ) ); return; }
// Function from file: RPD.dm public override dynamic Topic(string href = null, ByTable href_list = null, dynamic hsrc = null) { if (!Task13.User.canUseTopic(this)) { Interface13.Browse(Task13.User, null, "window=pipedispenser"); return(null); } Task13.User.set_machine(this); this.add_fingerprint(Task13.User); if (Lang13.Bool(href_list["screen"])) { this.screen = String13.ParseNumber(href_list["screen"]); this.show_menu(Task13.User); } if (Lang13.Bool(href_list["setdir"])) { this.p_dir = String13.ParseNumber(href_list["setdir"]); this.p_flipped = String13.ParseNumber(href_list["flipped"]); this.show_menu(Task13.User); } if (Lang13.Bool(href_list["eatpipes"])) { this.p_class = -1; this.p_conntype = -1; this.p_dir = 1; this.spark_system.start(); GlobalFuncs.playsound(GlobalFuncs.get_turf(this), "sound/effects/pop.ogg", 50, 0); this.show_menu(Task13.User); } if (Lang13.Bool(href_list["paintpipes"])) { this.p_class = -2; this.p_conntype = -1; this.p_dir = 1; this.spark_system.start(); GlobalFuncs.playsound(GlobalFuncs.get_turf(this), "sound/effects/pop.ogg", 50, 0); this.show_menu(Task13.User); } if (Lang13.Bool(href_list["set_color"])) { this.paint_color = href_list["set_color"]; this.spark_system.start(); GlobalFuncs.playsound(GlobalFuncs.get_turf(this), "sound/effects/pop.ogg", 50, 0); this.show_menu(Task13.User); } if (Lang13.Bool(href_list["makepipe"])) { this.p_type = Lang13.FindClass(href_list["makepipe"]); this.p_dir = String13.ParseNumber(href_list["dir"]); this.p_conntype = String13.ParseNumber(href_list["type"]); this.p_class = 0; this.spark_system.start(); GlobalFuncs.playsound(GlobalFuncs.get_turf(this), "sound/effects/pop.ogg", 50, 0); this.show_menu(Task13.User); } if (Lang13.Bool(href_list["makemeter"])) { this.p_class = 1; this.p_conntype = -1; this.p_dir = 1; this.spark_system.start(); GlobalFuncs.playsound(GlobalFuncs.get_turf(this), "sound/effects/pop.ogg", 50, 0); this.show_menu(Task13.User); } if (Lang13.Bool(href_list["dmake"])) { this.p_type = String13.ParseNumber(href_list["dmake"]); this.p_conntype = String13.ParseNumber(href_list["type"]); this.p_dir = 1; this.p_class = 2; this.spark_system.start(); GlobalFuncs.playsound(GlobalFuncs.get_turf(this), "sound/effects/pop.ogg", 50, 0); this.show_menu(Task13.User); } return(null); }
// Range: -1 Access: 0 Flags: ( 0, 4, 255 ) public static dynamic pick_n_take( ByTable L = null ) { dynamic _default = null; int picked = 0; if ( L.len != 0 ) { picked = Rand13.Int( 1, L.len ); _default = L[picked]; L.Cut( picked, picked + 1 ); } return _default; }
// Function from file: parrot.dm public override int radio(dynamic message = null, string message_mode = null, ByTable spans = null) { int _default = 0; _default = base.radio((object)(message), message_mode, spans); if (_default != 0) { return(_default); } switch ((string)(message_mode)) { case "headset": if (Lang13.Bool(this.ears)) { ((Obj_Item)this.ears).talk_into(this, message, null, spans); } return(3); break; case "department": if (Lang13.Bool(this.ears)) { ((Obj_Item)this.ears).talk_into(this, message, message_mode, spans); } return(3); break; } if (GlobalVars.radiochannels.Contains(message_mode)) { if (Lang13.Bool(this.ears)) { ((Obj_Item)this.ears).talk_into(this, message, message_mode, spans); return(3); } } return(0); }
// Range: -1 Access: 0 Flags: ( 0, 4, 255 ) public static dynamic AverageColour( Icon I = null ) { ByTable colours = null; double? x_pixel = null; double? y_pixel = null; string this_colour = null; dynamic final_average = null; dynamic colour = null; colours = new ByTable(); x_pixel = null; foreach (dynamic _b in Lang13.iter_range( 1, I.Width() ) ) { x_pixel = _b; y_pixel = null; foreach (dynamic _a in Lang13.iter_range( 1, I.Height() ) ) { y_pixel = _a; this_colour = I.GetPixel( x_pixel, y_pixel ); if ( Lang13.Bool( this_colour ) ) { colours.Add( this_colour ); } }; }; if ( !( colours.len != 0 ) ) { return null; } final_average = colours[1]; colour = null; foreach (dynamic _c in colours - colours[1] ) { colour = _c; final_average = GlobalFuncs.BlendRGB( final_average, colour, 1 ); }; return final_average; }
// Function from file: parrot.dm public override string Hear(string message = null, dynamic speaker = null, int message_langs = 0, dynamic raw_message = null, dynamic radio_freq = null, ByTable spans = null) { if (speaker != this && Rand13.PercentChance(50)) { if (!Lang13.Bool(radio_freq) || Rand13.PercentChance(10)) { if (this.speech_buffer.len >= 500) { this.speech_buffer.Remove(Rand13.PickFromTable(this.speech_buffer)); } this.speech_buffer.Or(String13.HtmlDecode(raw_message)); } } base.Hear(message, (object)(speaker), message_langs, (object)(raw_message), (object)(radio_freq), spans); return(null); }
// Function from file: parrot.dm public override bool handle_automated_movement( ) { ByTable newspeak = null; dynamic possible_phrase = null; bool useradio = false; dynamic possible_phrase2 = null; Ent_Dynamic AM = null; dynamic L = null; if (!(this.loc is Tile) || !this.canmove || this.buckled != null) { return(false); } if (this.parrot_state == 1) { if (this.parrot_perch != null && this.parrot_perch.loc != this.loc) { if (Map13.FetchInView(null, this).Contains(this.parrot_perch)) { this.parrot_state = 34; this.icon_state = "parrot_fly"; return(false); } else { this.parrot_state = 4; this.icon_state = "parrot_fly"; return(false); } } if (--this.parrot_sleep_dur != 0) { return(false); } else { this.parrot_sleep_dur = this.parrot_sleep_max; if (this.speak.len != 0) { newspeak = new ByTable(); if (this.available_channels.len != 0 && Lang13.Bool(this.ears)) { foreach (dynamic _a in Lang13.Enumerate(this.speak)) { possible_phrase = _a; useradio = false; if (Rand13.PercentChance(50)) { useradio = true; } if (GlobalVars.department_radio_keys.Contains(String13.SubStr(possible_phrase, 1, 3))) { possible_phrase = "" + (useradio ? Rand13.PickFromTable(this.available_channels) : ((dynamic)(""))) + String13.SubStr(possible_phrase, 3, 0); } else { possible_phrase = "" + (useradio ? Rand13.PickFromTable(this.available_channels) : ((dynamic)(""))) + possible_phrase; } newspeak.Add(possible_phrase); } } else { foreach (dynamic _b in Lang13.Enumerate(this.speak)) { possible_phrase2 = _b; if (GlobalVars.department_radio_keys.Contains(String13.SubStr(possible_phrase2, 1, 3))) { possible_phrase2 = "" + String13.SubStr(possible_phrase2, 3, Lang13.Length(possible_phrase2) + 1); } newspeak.Add(possible_phrase2); } } this.speak = newspeak; } this.parrot_interest = this.search_for_item(); if (Lang13.Bool(this.parrot_interest)) { this.emote("me", 1, "looks in " + this.parrot_interest + "'s direction and takes flight."); this.parrot_state = 10; this.icon_state = "parrot_fly"; } return(false); } } else if (this.parrot_state == 4) { Map13.Walk(this, 0, 0); this.parrot_interest = null; if (Rand13.PercentChance(90)) { Map13.Step(this, Convert.ToInt32(Rand13.PickFromTable(GlobalVars.cardinal))); return(false); } if (!Lang13.Bool(this.held_item) && !(this.parrot_perch != null)) { AM = this.search_for_perch_and_item(); if (AM != null) { if (AM is Obj_Item || AM is Mob_Living) { this.parrot_interest = AM; this.emote("me", 1, "turns and flies towards " + this.parrot_interest + "."); this.parrot_state = 10; return(false); } else { this.parrot_perch = AM; this.parrot_state = 34; return(false); } } return(false); } if (Map13.FetchInView(null, this).Contains(Lang13.Bool(this.parrot_interest) && Lang13.Bool(this.parrot_interest))) { this.parrot_state = 10; return(false); } if (Map13.FetchInView(null, this).Contains(this.parrot_perch != null && this.parrot_perch != null)) { this.parrot_state = 34; return(false); } else { this.parrot_perch = this.search_for_perch(); if (this.parrot_perch != null) { this.parrot_state = 34; return(false); } } } else if (this.parrot_state == 10) { Map13.Walk(this, 0, 0); if (!Lang13.Bool(this.parrot_interest) || Lang13.Bool(this.held_item)) { this.parrot_state = 34; return(false); } if (!Map13.FetchInView(null, this).Contains(this.parrot_interest)) { this.parrot_state = 34; return(false); } if (this.Adjacent(this.parrot_interest)) { if (this.parrot_interest is Mob_Living) { this.steal_from_mob(); } else if (!(this.parrot_perch != null) || this.parrot_interest.loc != this.parrot_perch.loc) { this.held_item = this.parrot_interest; this.parrot_interest.loc = this; this.visible_message("" + this + " grabs " + this.held_item + "!", "<span class='notice'>You grab " + this.held_item + "!</span>", "<span class='italics'>You hear the sounds of wings flapping furiously.</span>"); } this.parrot_interest = null; this.parrot_state = 34; return(false); } Map13.WalkTowards(this, this.parrot_interest, 1, this.parrot_speed); if (this.isStuck()) { return(false); } return(false); } else if (this.parrot_state == 34) { Map13.Walk(this, 0, 0); if (!(this.parrot_perch != null) || !(this.parrot_perch.loc is Tile)) { this.parrot_perch = null; this.parrot_state = 4; return(false); } if (this.Adjacent(this.parrot_perch)) { this.loc = this.parrot_perch.loc; this.drop_held_item_player(); this.parrot_state = 1; this.icon_state = "parrot_sit"; return(false); } Map13.WalkTowards(this, this.parrot_perch, 1, this.parrot_speed); if (this.isStuck()) { return(false); } return(false); } else if (this.parrot_state == 66) { Map13.Walk(this, 0, 0); if (!Lang13.Bool(this.parrot_interest) || !(this.parrot_interest is Mob_Living)) { this.parrot_state = 4; } Map13.WalkAway(this, this.parrot_interest, 1, this.parrot_speed); if (this.isStuck()) { return(false); } return(false); } else if (this.parrot_state == 18) { if (!Lang13.Bool(this.parrot_interest) || !(this.parrot_interest is Mob_Living)) { this.parrot_interest = null; this.parrot_state = 4; return(false); } L = this.parrot_interest; if (this.melee_damage_upper == 0) { this.melee_damage_upper = this.parrot_damage_upper; this.a_intent = "harm"; } if (this.Adjacent(this.parrot_interest)) { if (Lang13.Bool(L.stat)) { this.parrot_interest = null; if (!Lang13.Bool(this.held_item)) { this.held_item = this.steal_from_ground(); if (!Lang13.Bool(this.held_item)) { this.held_item = this.steal_from_mob(); } } if (Map13.FetchInView(null, this).Contains(this.parrot_perch)) { this.parrot_state = 34; } else { this.parrot_state = 4; } return(false); } this.attacktext = Rand13.Pick(new object [] { "claws at", "chomps" }); ((Ent_Static)L).attack_animal(this); } else { Map13.WalkTowards(this, this.parrot_interest, 1, this.parrot_speed); if (this.isStuck()) { return(false); } } return(false); } else { Map13.Walk(this, 0, 0); this.parrot_interest = null; this.parrot_perch = null; this.drop_held_item_player(); this.parrot_state = 4; return(false); } return(false); }
// Function from file: parrot.dm public override dynamic Topic(string href = null, ByTable href_list = null, dynamic hsrc = null) { dynamic remove_from = null; dynamic possible_phrase = null; dynamic add_to = null; dynamic item_to_add = null; dynamic headset_to_add = null; dynamic ch = null; if (Task13.User.incapacitated() || !Task13.User.Adjacent(this.loc)) { return(null); } if (Task13.User is Mob_Living_Carbon_Human || Task13.User is Mob_Living_Carbon_Monkey || Task13.User is Mob_Living_Silicon_Robot || Task13.User is Mob_Living_Carbon_Alien_Humanoid) { if (Lang13.Bool(href_list["remove_inv"])) { remove_from = href_list["remove_inv"]; dynamic _b = remove_from; // Was a switch-case, sorry for the mess. if (_b == "ears") { if (Lang13.Bool(this.ears)) { if (!(this.stat != 0)) { if (this.available_channels.len != 0) { this.say("" + Rand13.PickFromTable(this.available_channels) + " BAWWWWWK LEAVE THE HEADSET BAWKKKKK!"); } else { this.say("BAWWWWWK LEAVE THE HEADSET BAWKKKKK!"); } } this.ears.loc = this.loc; this.ears = null; foreach (dynamic _a in Lang13.Enumerate(this.speak)) { possible_phrase = _a; if (GlobalVars.department_radio_keys.Contains(String13.SubStr(possible_phrase, 1, 3))) { possible_phrase = String13.SubStr(possible_phrase, 3, 0); } } } else { Task13.User.WriteMsg("<span class='warning'>There is nothing to remove from its " + remove_from + "!</span>"); return(null); } } } else if (Lang13.Bool(href_list["add_inv"])) { add_to = href_list["add_inv"]; if (!Lang13.Bool(Task13.User.get_active_hand())) { Task13.User.WriteMsg("<span class='warning'>You have nothing in your hand to put on its " + add_to + "!</span>"); return(null); } dynamic _e = add_to; // Was a switch-case, sorry for the mess. if (_e == "ears") { if (Lang13.Bool(this.ears)) { Task13.User.WriteMsg("<span class='warning'>It's already wearing something!</span>"); return(null); } else { item_to_add = Task13.User.get_active_hand(); if (!Lang13.Bool(item_to_add)) { return(null); } if (!(item_to_add is Obj_Item_Device_Radio_Headset)) { Task13.User.WriteMsg("<span class='warning'>This object won't fit!</span>"); return(null); } headset_to_add = item_to_add; Task13.User.drop_item(); headset_to_add.loc = this; this.ears = headset_to_add; Task13.User.WriteMsg("<span class='notice'>You fit the headset onto " + this + ".</span>"); GlobalFuncs.clearlist(this.available_channels); foreach (dynamic _d in Lang13.Enumerate(headset_to_add.channels)) { ch = _d; dynamic _c = ch; // Was a switch-case, sorry for the mess. if (_c == "Engineering") { this.available_channels.Add(":e"); } else if (_c == "Command") { this.available_channels.Add(":c"); } else if (_c == "Security") { this.available_channels.Add(":s"); } else if (_c == "Science") { this.available_channels.Add(":n"); } else if (_c == "Medical") { this.available_channels.Add(":m"); } else if (_c == "Supply") { this.available_channels.Add(":u"); } else if (_c == "Service") { this.available_channels.Add(":v"); } } if (Lang13.Bool(headset_to_add.translate_binary)) { this.available_channels.Add(":b"); } } } } else { base.Topic(href, href_list, (object)(hsrc)); } } return(null); }
// Range: -1 Access: 0 Flags: ( 0, 4, 255 ) public static void hgibs( dynamic location = null, ByTable viruses = null, Dna MobDNA = null ) { new Ent_Effect_Gibspawner_Human( location, viruses, MobDNA ); return; }
// Function from file: filter.dm public override void atmosinit(ByTable node_connects = null) { this.set_frequency(this.frequency); base.atmosinit(node_connects); return; }
// Range: -1 Access: 0 Flags: ( 0, 4, 255 ) public static ByTable init_subtypes( Type prototype = null, ByTable L = null ) { dynamic path = null; if ( !( L is ByTable ) ) { L = new ByTable(); } path = null; foreach (dynamic _a in Lang13.get_all_types( prototype ) - prototype ) { path = _a; L += Lang13.call( path ); }; return L; }
// Range: -1 Access: 0 Flags: ( 0, 4, 255 ) public static string keywords_lookup( string msg = null ) { ByTable adminhelp_ignored_words = null; ByTable msglist = null; ByTable surnames = null; ByTable forenames = null; ByTable ckeys = null; dynamic M = null; ByTable indexing = null; dynamic _string = null; ByTable L = null; int? surname_found = null; int? i = null; string word = null; int? i2 = null; string word2 = null; bool ai_found = false; ByTable mobs_found = null; dynamic original_word = null; string word3 = null; dynamic found = null; adminhelp_ignored_words = new ByTable(new object [] { "unknown", "the", "a", "an", "of", "monkey", "alien", "as", "i" }); msglist = GlobalFuncs.text2list( msg, " " ); surnames = new ByTable(); forenames = new ByTable(); ckeys = new ByTable(); M = null; foreach (dynamic _b in GlobalVars.mob_list ) { M = _b; indexing = new ByTable(new object [] { M.real_name, M.name }); if ( Lang13.Bool( M.mind ) ) { indexing += M.mind.name; } _string = null; foreach (dynamic _a in indexing ) { _string = _a; L = GlobalFuncs.text2list( _string, " " ); surname_found = 0; i = null; i = L.len; while (( i ??0) >= 1) { word = String13.ckey( L[i] ); if ( Lang13.Bool( word ) ) { surnames[word] = M; surname_found = i; break; } i--; } i2 = null; i2 = 1; while (( i2 ??0) < ( surname_found ??0)) { word2 = String13.ckey( L[i2] ); if ( Lang13.Bool( word2 ) ) { forenames[word2] = M; } i2++; } ckeys[M.ckey] = M; }; }; ai_found = false; msg = ""; mobs_found = new ByTable(); original_word = null; foreach (dynamic _c in msglist ) { original_word = _c; word3 = String13.ckey( original_word ); if ( Lang13.Bool( word3 ) ) { if ( !adminhelp_ignored_words.contains( word3 ) ) { if ( word3 == "ai" ) { ai_found = true; } else { found = ckeys[word3]; if ( !Lang13.Bool( found ) ) { found = surnames[word3]; if ( !Lang13.Bool( found ) ) { found = forenames[word3]; } } if ( Lang13.Bool( found ) ) { if ( !mobs_found.contains( found ) ) { mobs_found += found; if ( !ai_found && found is Mob_Living_Silicon_Ai ) { ai_found = true; } msg += ((dynamic)new Txt()).item( original_word ).str( "<font size='1' color='black'>(<A HREF='?_src_=holder;adminmoreinfo=" ).Ref( found ).str( "'>?</A>|<A HREF='?_src_=holder;adminplayerobservefollow=" ).Ref( found ).str( "'>F</A>)</font> " ); continue; } } } } } msg += "" + original_word + " "; }; return msg; }
// Range: -1 Access: 0 Flags: ( 0, 4, 255 ) public static bool is_type_in_list( dynamic A = null, ByTable L = null ) { dynamic type = null; type = null; foreach (dynamic _a in L ) { type = _a; if ( Lang13.Bool( type.IsInstanceOfType( A ) ) ) { return true; } }; return false; }
// Range: -1 Access: 0 Flags: ( 0, 4, 255 ) public static dynamic list2stickyban( ByTable ban = null ) { dynamic _default = null; if ( !( ban != null ) || !( ban is ByTable ) ) { return null; } _default = ban.Copy(); if ( Lang13.Bool( _default["keys"] ) ) { _default["keys"] = GlobalFuncs.list2text( _default["keys"], "," ); } if ( Lang13.Bool( _default["type"] ) ) { _default["type"] = GlobalFuncs.list2text( _default["type"], "," ); } if ( Lang13.Bool( _default["IP"] ) ) { _default["IP"] = GlobalFuncs.list2text( _default["IP"], "," ); } if ( Lang13.Bool( _default["computer_id"] ) ) { _default["computer_id"] = GlobalFuncs.list2text( _default["computer_id"], "," ); } _default = String13.conv_list2urlParams( _default ); return _default; }
// Function from file: filter.dm public override int?ui_act(string action = null, ByTable _params = null, Tgui ui = null, UiState state = null) { int?_default = null; dynamic pressure = null; string filter_name = null; dynamic gas = null; if (Lang13.Bool(base.ui_act(action, _params, ui, state))) { return(_default); } switch ((string)(action)) { case "power": this.on = !this.on; this.investigate_log("was turned " + (this.on ? "on" : "off") + " by " + GlobalFuncs.key_name(Task13.User), "atmos"); _default = GlobalVars.TRUE; break; case "pressure": pressure = _params["pressure"]; if (pressure == "max") { pressure = 4500; _default = GlobalVars.TRUE; } else if (pressure == "input") { pressure = Interface13.Input("New output pressure (0-" + 4500 + " kPa):", this.name, this.target_pressure, null, null, InputType.Num | InputType.Null); if (!(pressure == null) && !Lang13.Bool(base.ui_act(action, _params, ui, state))) { _default = GlobalVars.TRUE; } } else if (String13.ParseNumber(pressure) != null) { pressure = String13.ParseNumber(pressure); _default = GlobalVars.TRUE; } if (Lang13.Bool(_default)) { this.target_pressure = Num13.MaxInt(0, Num13.MinInt(Convert.ToInt32(pressure), 4500)); this.investigate_log("was set to " + this.target_pressure + " kPa by " + GlobalFuncs.key_name(Task13.User), "atmos"); } break; case "filter": this.filter_type = ""; filter_name = "nothing"; gas = _params["mode"]; if (GlobalVars.meta_gas_info.Contains(gas)) { this.filter_type = gas; filter_name = GlobalVars.meta_gas_info[gas][2]; } this.investigate_log("was set to filter " + filter_name + " by " + GlobalFuncs.key_name(Task13.User), "atmos"); _default = GlobalVars.TRUE; break; } this.update_icon(); return(_default); }
// Function from file: brand_intelligence.dm public override void tick( ) { Obj_Machinery_Vending saved = null; Obj_Machinery_Vending upriser = null; Mob_Living_SimpleAnimal_Hostile_Mimic_Copy M = null; dynamic rebel = null; if (!Lang13.Bool(this.originMachine) || Lang13.Bool(this.originMachine.gc_destroyed) || Lang13.Bool(this.originMachine.shut_up) || Lang13.Bool(((Wires)this.originMachine.wires).is_all_cut())) { foreach (dynamic _a in Lang13.Enumerate(this.infectedMachines, typeof(Obj_Machinery_Vending))) { saved = _a; saved.shoot_inventory = false; } if (Lang13.Bool(this.originMachine)) { ((Obj_Machinery_Vending)this.originMachine).speak("I am... vanquished. My people will remem...ber...meeee."); ((Ent_Static)this.originMachine).visible_message("" + this.originMachine + " beeps and seems lifeless."); } this.kill(); return; } this.vendingMachines = GlobalFuncs.removeNullsFromList(this.vendingMachines); if (!(this.vendingMachines.len != 0)) { foreach (dynamic _b in Lang13.Enumerate(this.infectedMachines, typeof(Obj_Machinery_Vending))) { upriser = _b; if (Rand13.PercentChance(70) && !Lang13.Bool(upriser.gc_destroyed)) { M = new Mob_Living_SimpleAnimal_Hostile_Mimic_Copy(upriser.loc, upriser, null, true); M.faction = new ByTable(new object [] { "profit" }); M.speak = this.rampant_speeches.Copy(); M.speak_chance = 7; } else { GlobalFuncs.explosion(upriser.loc, -1, 1, 2, 4, 0); GlobalFuncs.qdel(upriser); } } this.kill(); return; } if (GlobalFuncs.IsMultiple(this.activeFor, 4)) { rebel = Rand13.PickFromTable(this.vendingMachines); this.vendingMachines.Remove(rebel); this.infectedMachines.Add(rebel); rebel.shut_up = 0; rebel.shoot_inventory = true; if (GlobalFuncs.IsMultiple(this.activeFor, 8)) { ((Obj_Machinery_Vending)this.originMachine).speak(Rand13.PickFromTable(this.rampant_speeches)); } } return; }
// Range: -1 Access: 0 Flags: ( 0, 4, 255 ) public static ByTable kick_clients_in_lobby( string message = null, double? kick_only_afk = null ) { ByTable kicked_client_names = null; dynamic C = null; if ( kick_only_afk == null ) { kick_only_afk = 0; } kicked_client_names = new ByTable(); C = null; foreach (dynamic _a in GlobalVars.clients ) { C = _a; if ( !Lang13.Bool( ((dynamic)typeof(Client)).IsInstanceOfType( C ) ) ) { continue; } if ( C.mob is Mob_NewPlayer ) { if ( Lang13.Bool( kick_only_afk ) && !Lang13.Bool( ((dynamic)C).is_afk() ) ) { continue; } if ( Lang13.Bool( message ) ) { C.write( message ); } kicked_client_names.Add( "" + C.ckey ); Lang13.delete( C ); C = null; } }; return kicked_client_names; }
// Function from file: port_gen.dm public override dynamic Topic(string href = null, ByTable href_list = null, dynamic hsrc = null) { if (Lang13.Bool(base.Topic(href, href_list, (object)(hsrc)))) { return(null); } this.add_fingerprint(Task13.User); if (Lang13.Bool(href_list["action"])) { if (href_list["action"] == "enable") { if (!this.active && this.HasFuel() && !this.crit_fail) { this.active = true; this.icon_state = "portgen1"; this.updateUsrDialog(); } } if (href_list["action"] == "disable") { if (this.active) { this.active = false; this.icon_state = "portgen0"; this.updateUsrDialog(); } } if (href_list["action"] == "eject") { if (!this.active) { this.DropFuel(); this.updateUsrDialog(); } } if (href_list["action"] == "lower_power") { if (this.power_output > 1) { this.power_output--; this.updateUsrDialog(); } } if (href_list["action"] == "higher_power") { if (this.power_output < 4 || Lang13.Bool(this.emagged)) { this.power_output++; this.updateUsrDialog(); } } if (href_list["action"] == "close") { Interface13.Browse(Task13.User, null, "window=port_gen"); Task13.User.unset_machine(); } } return(null); }
// Range: -1 Access: 0 Flags: ( 0, 4, 255 ) public static void listclearnulls( ByTable L = null ) { int i = 0; dynamic thing = null; if ( L is ByTable ) { i = 1; thing = null; foreach (dynamic _a in L ) { thing = _a; if ( thing != null ) { i++; continue; } L.Cut( i, i + 1 ); }; } return; }
// Function from file: telesci_computer.dm public override dynamic Topic(string href = null, ByTable href_list = null, dynamic hsrc = null) { dynamic new_rot = null; dynamic new_angle = null; dynamic index = null; dynamic new_z = null; if (Lang13.Bool(base.Topic(href, href_list, (object)(hsrc)))) { return(null); } if (!(this.telepad != null)) { this.updateDialog(); return(null); } if (Lang13.Bool(((dynamic)this.telepad).panel_open)) { this.temp_msg = "Telepad undergoing physical maintenance operations."; } if (Lang13.Bool(href_list["setrotation"])) { new_rot = Interface13.Input("Please input desired bearing in degrees.", this.name, this.rotation, null, null, InputType.Num); if (Lang13.Bool(base.Topic(href, href_list, (object)(hsrc)))) { return(null); } this.rotation = Num13.MaxInt(-900, Num13.MinInt(Convert.ToInt32(new_rot), 900)); this.rotation = Num13.Round(this.rotation ?? 0, 0.01); } if (Lang13.Bool(href_list["setangle"])) { new_angle = Interface13.Input("Please input desired elevation in degrees.", this.name, this.angle, null, null, InputType.Num); if (Lang13.Bool(base.Topic(href, href_list, (object)(hsrc)))) { return(null); } this.angle = Num13.MaxInt(1, Num13.MinInt(((int)(Num13.Round(Convert.ToDouble(new_angle), 0.1))), 9999)); } if (Lang13.Bool(href_list["setpower"])) { index = href_list["setpower"]; index = String13.ParseNumber(index); if (index != null && Lang13.Bool(this.power_options[index])) { if (this.crystals.len + Convert.ToDouble(((dynamic)this.telepad).efficiency) >= Convert.ToDouble(index)) { this.power = Convert.ToInt32(this.power_options[index]); } } } if (Lang13.Bool(href_list["setz"])) { new_z = Interface13.Input("Please input desired sector.", this.name, this.z_co, null, null, InputType.Num); if (Lang13.Bool(base.Topic(href, href_list, (object)(hsrc)))) { return(null); } this.z_co = Num13.MaxInt(1, Num13.MinInt(Num13.Floor(Convert.ToDouble(new_z)), 10)); } if (Lang13.Bool(href_list["ejectGPS"])) { if (Lang13.Bool(this.inserted_gps)) { this.inserted_gps.loc = this.loc; this.inserted_gps = null; } } if (Lang13.Bool(href_list["setMemory"])) { if (this.last_target != null && Lang13.Bool(this.inserted_gps)) { this.inserted_gps.locked_location = this.last_target; this.temp_msg = "Location saved."; } else { this.temp_msg = "ERROR!<BR>No data was stored."; } } if (Lang13.Bool(href_list["send"])) { this.sending = true; this.teleport(Task13.User); } if (Lang13.Bool(href_list["receive"])) { this.sending = false; this.teleport(Task13.User); } if (Lang13.Bool(href_list["recal"])) { this.recalibrate(); this.sparks(); this.temp_msg = "NOTICE:<BR>Calibration successful."; } if (Lang13.Bool(href_list["eject"])) { this.eject(); this.temp_msg = "NOTICE:<BR>Bluespace crystals ejected."; } this.updateDialog(); return(null); }
// Range: -1 Access: 0 Flags: ( 0, 4, 255 ) public static void load_admins( ) { dynamic C = null; ByTable rank_names = null; AdminRank R = null; ByTable Lines = null; dynamic line = null; ByTable List = null; string ckey = null; string rank = null; Admins D = null; DBQuery query = null; string ckey2 = null; string rank2 = null; Admins D2 = null; GlobalVars.admin_datums.Cut(); C = null; foreach (dynamic _a in GlobalVars.admins ) { C = _a; if ( !Lang13.Bool( ((dynamic)typeof(Client)).IsInstanceOfType( C ) ) ) { continue; } ((dynamic)C).remove_admin_verbs(); C.holder = null; }; GlobalVars.admins.Cut(); GlobalFuncs.load_admin_ranks(); rank_names = new ByTable(); R = null; foreach (dynamic _b in GlobalVars.admin_ranks ) { if ( !( _b is AdminRank ) ) { continue; } R = _b; rank_names[R.name] = R; }; if ( GlobalVars.config.admin_legacy_system ) { Lines = GlobalFuncs.file2list( "config/admins.txt" ); line = null; foreach (dynamic _c in Lines ) { line = _c; if ( !Lang13.Bool( line.Length ) ) { continue; } if ( String13.find_exact_case( line, "#", 1, 2 ) != 0 ) { continue; } List = GlobalFuncs.text2list( line, "=" ); if ( !( List.len != 0 ) ) { continue; } ckey = String13.ckey( List[1] ); if ( !Lang13.Bool( ckey ) ) { continue; } rank = ""; if ( List.len >= 2 ) { rank = String13.ckey_preserve_case( List[2] ); } D = new Admins( rank_names[rank], ckey ); if ( !( D != null ) ) { continue; } D.associate( GlobalVars.directory[ckey] ); }; } else { GlobalFuncs.establish_db_connection(); if ( !GlobalVars.dbcon.IsConnected() ) { ((dynamic)Game13.log).write( "Failed to connect to database in load_admins(). Reverting to legacy system." ); ((dynamic)GlobalVars.diary).write( "Failed to connect to database in load_admins(). Reverting to legacy system." ); GlobalVars.config.admin_legacy_system = true; GlobalFuncs.load_admins(); return; } query = GlobalVars.dbcon.NewQuery( "SELECT ckey, rank FROM " + GlobalFuncs.format_table_name( "admin" ) ); query.Execute(); while (query.NextRow()) { ckey2 = String13.ckey( query.item[1] ); rank2 = String13.ckey_preserve_case( query.item[2] ); if ( rank_names[rank2] == null ) { GlobalFuncs.warning( "" + ( "Admin rank (" + rank2 + ") does not exist." ) + " in " + "code/modules/admin/admin_ranks.dm" + " at line " + 183 + " src: " + Task13.source + " usr: "******"." ); continue; } D2 = new Admins( rank_names[rank2], ckey2 ); if ( !( D2 != null ) ) { continue; } D2.associate( GlobalVars.directory[ckey2] ); } } return; }
// Function from file: Hallucination.dm public Obj_Effect_Hallucination_Whispers(dynamic loc = null, Mob_Living_Carbon T = null) : base((object)(loc)) { ByTable speak_messages = null; ByTable radio_messages = null; ByTable people = null; dynamic person = null; Mob_Living_Carbon H = null; ByTable humans = null; Mob_Living_Carbon_Human H2 = null; this.target = T; speak_messages = new ByTable(new object [] { "I'm watching you...", "" + this.target.name + "!", "Go away!", "Kchck-Chkck? Kchchck!", "Did you hear that?", "What did you do ?", "Why?", "Give me that!", "Honk!", "HELP!!" }); radio_messages = new ByTable(new object [] { "Xenos!", "Singularity loose!", "They are arming the nuke!", "They butchered Ian!", "H-help!", "" + Rand13.PickFromTable(GlobalVars.teleportlocs) + "!!", "Where's " + this.target.name + "?", "Call the shuttle!" }); people = new ByTable(); person = null; foreach (dynamic _a in Lang13.Enumerate(Map13.FetchInView(null, this.target), typeof(Mob_Living_Carbon))) { H = _a; if (H == this.target) { continue; } if (!Lang13.Bool(person)) { person = H; } else if (Map13.GetDistance(this.target, H) < Map13.GetDistance(this.target, person)) { person = H; } people.Add(H); } if (Lang13.Bool(person)) { ((dynamic)this.target).WriteMsg(((dynamic)this.target).compose_message(person, person.languages, Rand13.PickFromTable(speak_messages), null, person.get_spans())); } else { humans = new ByTable(); foreach (dynamic _b in Lang13.Enumerate(GlobalVars.living_mob_list, typeof(Mob_Living_Carbon_Human))) { H2 = _b; humans.Add(H2); } person = Rand13.PickFromTable(humans); ((dynamic)this.target).WriteMsg(((dynamic)this.target).compose_message(person, person.languages, Rand13.PickFromTable(radio_messages), "1459", person.get_spans())); } GlobalFuncs.qdel(this); return; }
// Range: -1 Access: 0 Flags: ( 0, 4, 255 ) public static int maprotate( ) { int _default = 0; int players = 0; ByTable mapvotes = null; dynamic c = null; dynamic vote = null; dynamic map = null; dynamic VM = null; dynamic pickedmap = null; dynamic VM2 = null; return _default; players = GlobalVars.clients.len; mapvotes = new ByTable(); c = null; foreach (dynamic _a in GlobalVars.clients ) { c = _a; if ( !Lang13.Bool( ((dynamic)typeof(Client)).IsInstanceOfType( c ) ) ) { continue; } vote = c.prefs.preferred_map; if ( !Lang13.Bool( vote ) ) { if ( Lang13.Bool( GlobalVars.config.defaultmap ) ) { mapvotes[GlobalVars.config.defaultmap.name] += 1; } continue; } mapvotes[vote] += 1; }; map = null; foreach (dynamic _b in mapvotes ) { map = _b; if ( !Lang13.Bool( map ) ) { mapvotes.Remove( map ); } if ( !GlobalVars.config.maplist.contains( map ) ) { mapvotes.Remove( map ); continue; } VM = GlobalVars.config.maplist[map]; if ( !Lang13.Bool( VM ) ) { mapvotes.Remove( map ); continue; } if ( Lang13.Double( VM.voteweight ) <= 0 ) { mapvotes.Remove( map ); continue; } if ( Lang13.Double( VM.minusers ) > 0 && players < Lang13.Double( VM.minusers ) ) { mapvotes.Remove( map ); continue; } if ( Lang13.Double( VM.maxusers ) > 0 && players > Lang13.Double( VM.maxusers ) ) { mapvotes.Remove( map ); continue; } mapvotes[map] = mapvotes[map] * VM.voteweight; }; pickedmap = GlobalFuncs.pickweight( mapvotes ); if ( !Lang13.Bool( pickedmap ) ) { return _default; } VM2 = GlobalVars.config.maplist[pickedmap]; GlobalFuncs.message_admins( "Randomly rotating map to " + VM2.name + "(" + VM2.friendlyname + ")" ); _default = GlobalFuncs.changemap( VM2 ); if ( _default == 0 ) { Game13.write( "<span class='boldannounce'>Map rotation has chosen " + VM2.friendlyname + " for next round!</span>" ); } return _default; }
// Function from file: pipe_dispenser.dm public override dynamic Topic(string href = null, ByTable href_list = null, dynamic hsrc = null) { double?tube_type = null; Obj_Structure_CTransitTube C = null; Obj_Structure_CTransitTube_Station C2 = null; Obj_Structure_CTransitTube_Station_Reverse C3 = null; Obj_Structure_CTransitTube_Station_Block C4 = null; Obj_Structure_CTransitTubePod C5 = null; if (Lang13.Bool(base.Topic(href, href_list, (object)(hsrc)))) { return(1); } Task13.User.set_machine(this); this.add_fingerprint(Task13.User); if (!this.wait) { if (Lang13.Bool(href_list["tube"])) { tube_type = String13.ParseNumber(href_list["tube"]); if ((tube_type ?? 0) <= 4) { C = new Obj_Structure_CTransitTube(this.loc); switch ((int?)(tube_type)) { case 0: C.icon_state = "E-W"; break; case 1: C.icon_state = "E-W-Pass"; break; case 2: C.icon_state = "S-NE"; break; case 3: C.icon_state = "NE-SW"; break; case 4: C.icon_state = "W-NE-SE"; break; } C.add_fingerprint(Task13.User); } else { switch ((int?)(tube_type)) { case 5: C2 = new Obj_Structure_CTransitTube_Station(this.loc); C2.add_fingerprint(Task13.User); break; case 6: C3 = new Obj_Structure_CTransitTube_Station_Reverse(this.loc); C3.add_fingerprint(Task13.User); break; case 7: C4 = new Obj_Structure_CTransitTube_Station_Block(this.loc); C4.add_fingerprint(Task13.User); break; case 8: C5 = new Obj_Structure_CTransitTubePod(this.loc); C5.add_fingerprint(Task13.User); break; } } this.wait = true; Task13.Schedule(15, (Task13.Closure)(() => { this.wait = false; return; })); } } return(null); }
// Range: -1 Access: 0 Flags: ( 0, 4, 255 ) public static string mix_color_from_reagents( ByTable reagent_list = null ) { string color = null; double vol_counter = 0; double vol_temp = 0; Reagent R = null; if ( !( reagent_list is ByTable ) ) { return null; } vol_counter = 0; R = null; foreach (dynamic _a in reagent_list ) { if ( !( _a is Reagent ) ) { continue; } R = _a; vol_temp = R.volume; vol_counter += vol_temp; if ( !Lang13.Bool( color ) ) { color = R.color; } else if ( color.Length >= R.color.Length ) { color = GlobalFuncs.BlendRGB( color, R.color, vol_temp / vol_counter ); } else { color = GlobalFuncs.BlendRGB( R.color, color, vol_temp / vol_counter ); } }; return color; }
// Function from file: headset.dm public override void talk_into(dynamic M = null, dynamic input = null, dynamic channel = null, ByTable spans = null) { if (!this.listening) { return; } base.talk_into((object)(M), (object)(input), (object)(channel), spans); return; }
// Range: -1 Access: 0 Flags: ( 0, 4, 255 ) public static void moveRange( ByTable L = null, dynamic fromIndex = null, dynamic toIndex = null, dynamic len = null ) { dynamic distance = null; dynamic i = null; dynamic i2 = null; if ( len == null ) { len = 1; } distance = Math.Abs( Lang13.Double( toIndex - fromIndex ) ); if ( Lang13.Double( len ) >= Lang13.Double( distance ) ) { if ( Lang13.Double( fromIndex ) <= Lang13.Double( toIndex ) ) { return; } fromIndex += len; i = null; i = 0; while (Lang13.Double( i ) < Lang13.Double( distance )) { L.Insert( Lang13.Int( fromIndex ), null ); L.Swap( Lang13.Int( fromIndex ), Lang13.Int( toIndex ) ); L.Cut( Lang13.IntNullable( toIndex ), Lang13.Int( toIndex + 1 ) ); i++; } } else { if ( Lang13.Double( fromIndex ) > Lang13.Double( toIndex ) ) { fromIndex += len; } i2 = null; i2 = 0; while (Lang13.Double( i2 ) < Lang13.Double( len )) { L.Insert( Lang13.Int( toIndex ), null ); L.Swap( Lang13.Int( fromIndex ), Lang13.Int( toIndex ) ); L.Cut( Lang13.IntNullable( fromIndex ), Lang13.Int( fromIndex + 1 ) ); i2++; } } return; }
// Function from file: portable_turret.dm public ByTable calculate_targets( ) { ByTable targets = null; ByTable turretview = null; dynamic A = null; dynamic SA = null; dynamic C = null; dynamic M = null; targets = new ByTable(); //turretview = Map13.FetchInView( this.v_base, this.scan_range ); // FIXME this is broken for some reason Engine.NewLib.Logger.DebugMinor("fixme!"); foreach (dynamic _a in Lang13.Enumerate(turretview)) { A = _a; if (this.check_anomalies) { if (A is Mob_Living_SimpleAnimal) { SA = A; if (Lang13.Bool(SA.stat) || this.in_faction(SA)) { continue; } targets.Add(SA); } } if (A is Mob_Living_Carbon) { C = A; if (!Lang13.Bool(this.emagged) && (Lang13.Bool(C.stat) || Lang13.Bool(C.handcuffed) || Lang13.Bool(C.lying))) { continue; } if (Lang13.Bool(this.emagged) && Convert.ToInt32(C.stat) == 2) { continue; } if (C is Mob_Living_Carbon_Human && !this.in_faction(C)) { if (this.assess_perp(C) >= 4) { targets.Add(C); } } else if (this.check_anomalies) { if (!this.in_faction(C)) { targets.Add(C); } } } if (A is Obj_Mecha) { M = A; if (Lang13.Bool(M.occupant) && !this.in_faction(M.occupant)) { if (this.assess_perp(M.occupant) >= 4) { targets.Add(M); } } } } return(targets); }
// Range: -1 Access: 0 Flags: ( 0, 4, 255 ) public static void NukeNameAssign( string lastname = null, ByTable syndicates = null ) { Mind synd_mind = null; dynamic H = null; synd_mind = null; foreach (dynamic _a in syndicates ) { if ( !( _a is Mind ) ) { continue; } synd_mind = _a; H = synd_mind.current; synd_mind.name = ((dynamic)H.dna.species).random_name( H.gender, 0, lastname ); synd_mind.current.real_name = synd_mind.name; }; return; }
// Function from file: electropack.dm public override dynamic Topic(string href = null, ByTable href_list = null, dynamic hsrc = null) { Mob C = null; dynamic M = null; dynamic M2 = null; C = Task13.User; if (Task13.User.stat != 0 || Task13.User.restrained() || ((dynamic)C).back == this) { return(null); } if (Task13.User is Mob_Living_Carbon_Human && (!(GlobalVars.ticker != null) || GlobalVars.ticker != null && GlobalVars.ticker.mode != "monkey") && Task13.User.contents.Find(this) != 0 || Task13.User.contents.Find(this.master) != 0 || Map13.GetDistance(this, Task13.User) <= 1 && this.loc is Tile) { Task13.User.set_machine(this); if (Lang13.Bool(href_list["freq"])) { GlobalVars.SSradio.remove_object(this, this.frequency); this.frequency = GlobalFuncs.sanitize_frequency(this.frequency + (String13.ParseNumber(href_list["freq"]) ?? 0)); GlobalVars.SSradio.add_object(this, this.frequency, GlobalVars.RADIO_CHAT); } else if (Lang13.Bool(href_list["code"])) { this.code += String13.ParseNumber(href_list["code"]) ?? 0; this.code = Num13.Floor(this.code); this.code = Num13.MinInt(100, ((int)(this.code))); this.code = Num13.MaxInt(1, ((int)(this.code))); } else if (Lang13.Bool(href_list["power"])) { this.on = !this.on; this.icon_state = "electropack" + this.on; } if (!Lang13.Bool(this.master)) { if (this.loc is Mob) { this.attack_self(this.loc); } else { foreach (dynamic _a in Lang13.Enumerate(Map13.FetchViewers(this, 1))) { M = _a; if (Lang13.Bool(M.client)) { this.attack_self(M); } } } } else if (this.master.loc is Mob) { this.attack_self(this.master.loc); } else { foreach (dynamic _b in Lang13.Enumerate(Map13.FetchViewers(this.master, 1))) { M2 = _b; if (Lang13.Bool(M2.client)) { this.attack_self(M2); } } } } else { Interface13.Browse(Task13.User, null, "window=radio"); return(null); } return(null); }
// Range: -1 Access: 0 Flags: ( 0, 4, 255 ) public static dynamic pickweight( ByTable L = null ) { double total = 0; dynamic item = null; total = 0; foreach (dynamic _a in L ) { item = _a; if ( !Lang13.Bool( L[item] ) ) { L[item] = 1; } total += Lang13.Double( L[item] ); }; total = Rand13.Int( 1, ((int)( total )) ); foreach (dynamic _b in L ) { item = _b; total -= Lang13.Double( L[item] ); if ( total <= 0 ) { return item; } }; return null; }
// Function from file: narsie.dm public void pickcultist( ) { ByTable cultists = null; ByTable noncultists = null; Mob_Living_Carbon food = null; dynamic pos = null; Mob_Dead_Observer ghost = null; dynamic pos2 = null; cultists = new ByTable(); noncultists = new ByTable(); foreach (dynamic _a in Lang13.Enumerate(GlobalVars.living_mob_list, typeof(Mob_Living_Carbon))) { food = _a; pos = GlobalFuncs.get_turf(food); if (Convert.ToInt32(pos.z) != this.z) { continue; } if (GlobalFuncs.iscultist(food)) { cultists.Add(food); } else { noncultists.Add(food); } if (cultists.len != 0) { this.acquire(Rand13.PickFromTable(cultists)); return; } if (noncultists.len != 0) { this.acquire(Rand13.PickFromTable(noncultists)); return; } } foreach (dynamic _b in Lang13.Enumerate(GlobalVars.player_list, typeof(Mob_Dead_Observer))) { ghost = _b; if (!(ghost.client != null)) { continue; } pos2 = GlobalFuncs.get_turf(ghost); if (Convert.ToInt32(pos2.z) != this.z) { continue; } cultists.Add(ghost); } if (cultists.len != 0) { this.acquire(Rand13.PickFromTable(cultists)); return; } return; }
// Range: -1 Access: 0 Flags: ( 0, 4, 255 ) public static void power_failure( ) { Ent_Machinery_Power_Smes S = null; ByTable skipped_areas = null; dynamic A = null; bool skip = false; dynamic area_type = null; BaseStatic AT = null; Ent_Machinery_Power_Apc C = null; dynamic A2 = null; bool skip2 = false; dynamic area_type2 = null; GlobalFuncs.priority_announce( "Abnormal activity detected in " + GlobalFuncs.station_name() + "'s powernet. As a precautionary measure, the station's power will be shut off for an indeterminate duration.", "Critical Power Failure", "sound/AI/poweroff.ogg" ); S = null; foreach (dynamic _a in GlobalVars.machines ) { if ( !( _a is Ent_Machinery_Power_Smes ) ) { continue; } S = _a; if ( GlobalFuncs.get_area( S ) is Zone_TurretProtected || Lang13.Bool( ((dynamic)S).z ) != true ) { continue; } S.charge = 0; S.output_level = 0; S.output_attempt = 0; S.update_icon(); S.power_change(); }; skipped_areas = new ByTable(new object [] { typeof(Zone_Engine_Engineering), typeof(Zone_TurretProtected_Ai) }); A = null; foreach (dynamic _d in Game13.contents ) { A = _d; if ( !Lang13.Bool( A.requires_power ) || Lang13.Bool( A.always_unpowered ) ) { continue; } skip = false; area_type = null; foreach (dynamic _b in skipped_areas ) { area_type = _b; if ( Lang13.Bool( area_type.IsInstanceOfType( A ) ) ) { skip = true; break; } }; if ( Lang13.Bool( A.contents ) ) { AT = null; foreach (dynamic _c in A.contents ) { if ( !( _c is BaseStatic ) ) { continue; } AT = _c; if ( Lang13.Bool( ((dynamic)AT).z ) != true ) { skip = true; } break; }; } if ( skip ) { continue; } A.power_light = 0; A.power_equip = 0; A.power_environ = 0; ((Zone)A).power_change(); }; C = null; foreach (dynamic _f in GlobalVars.apcs_list ) { if ( !( _f is Ent_Machinery_Power_Apc ) ) { continue; } C = _f; if ( Lang13.Bool( C.cell ) && Lang13.Bool( ((dynamic)C).z ) == true ) { A2 = GlobalFuncs.get_area( C ); skip2 = false; area_type2 = null; foreach (dynamic _e in skipped_areas ) { area_type2 = _e; if ( Lang13.Bool( area_type2.IsInstanceOfType( A2 ) ) ) { skip2 = true; break; } }; if ( skip2 ) { continue; } C.cell.charge = 0; } }; return; }
// Function from file: lib_machines.dm public override dynamic Topic(string href = null, ByTable href_list = null, dynamic hsrc = null) { Obj_Item_Weapon_Storage_Book_Bible B = null; Borrowbook b = null; dynamic b2 = null; dynamic b3 = null; string newauthor = null; dynamic newcategory = null; dynamic choice = null; string sqltitle = null; string sqlauthor = null; string sqlcontent = null; string sqlcategory = null; DBQuery query = null; dynamic orderid = null; string sqlid = null; DBQuery query2 = null; dynamic author = null; dynamic title = null; dynamic content = null; Obj_Item_Weapon_Book B2 = null; if (Lang13.Bool(base.Topic(href, href_list, (object)(hsrc)))) { Interface13.Browse(Task13.User, null, "window=library"); GlobalFuncs.onclose(Task13.User, "library"); return(null); } if (Lang13.Bool(href_list["page"]) && this.screenstate == 4) { this.page = String13.ParseNumber(href_list["page"]); } if (Lang13.Bool(href_list["switchscreen"])) { dynamic _a = href_list["switchscreen"]; // Was a switch-case, sorry for the mess. if (_a == "0") { this.screenstate = 0; } else if (_a == "1") { this.screenstate = 1; } else if (_a == "2") { this.screenstate = 2; } else if (_a == "3") { this.screenstate = 3; } else if (_a == "4") { this.screenstate = 4; } else if (_a == "5") { this.screenstate = 5; } else if (_a == "6") { if (!this.bibledelay) { B = new Obj_Item_Weapon_Storage_Book_Bible(this.loc); if (GlobalVars.ticker != null && Lang13.Bool(GlobalVars.ticker.Bible_icon_state) && Lang13.Bool(GlobalVars.ticker.Bible_item_state)) { B.icon_state = GlobalVars.ticker.Bible_icon_state; B.item_state = GlobalVars.ticker.Bible_item_state; B.name = GlobalVars.ticker.Bible_name; B.deity_name = GlobalVars.ticker.Bible_deity_name; } this.bibledelay = true; Task13.Schedule(60, (Task13.Closure)(() => { this.bibledelay = false; return; })); } else { this.say("Bible printer currently unavailable, please wait a moment."); } } else if (_a == "7") { this.screenstate = 7; } } if (Lang13.Bool(href_list["arccheckout"])) { if (Lang13.Bool(this.emagged)) { this.arcanecheckout = true; } this.screenstate = 0; } if (Lang13.Bool(href_list["increasetime"])) { this.checkoutperiod += 1; } if (Lang13.Bool(href_list["decreasetime"])) { this.checkoutperiod -= 1; if (this.checkoutperiod < 1) { this.checkoutperiod = 1; } } if (Lang13.Bool(href_list["editbook"])) { this.buffer_book = String13.SubStr(GlobalFuncs.sanitize(Interface13.Input("Enter the book's title:", null, null, null, null, InputType.Str | InputType.Null)), 1, 1024); } if (Lang13.Bool(href_list["editmob"])) { this.buffer_mob = String13.SubStr(GlobalFuncs.sanitize(Interface13.Input("Enter the recipient's name:", null, null, null, null, InputType.Str | InputType.Null)), 1, 26); } if (Lang13.Bool(href_list["checkout"])) { b = new Borrowbook(); b.bookname = GlobalFuncs.sanitize(this.buffer_book); b.mobname = GlobalFuncs.sanitize(this.buffer_mob); b.getdate = Game13.time; b.duedate = Game13.time + this.checkoutperiod * 600; this.checkouts.Add(b); } if (Lang13.Bool(href_list["checkin"])) { b2 = Lang13.FindObj(href_list["checkin"]); this.checkouts.Remove(b2); } if (Lang13.Bool(href_list["delbook"])) { b3 = Lang13.FindObj(href_list["delbook"]); this.inventory.Remove(b3); } if (Lang13.Bool(href_list["setauthor"])) { newauthor = String13.SubStr(GlobalFuncs.sanitize(Interface13.Input("Enter the author's name: ", null, null, null, null, InputType.Str | InputType.Null)), 1, 1024); if (Lang13.Bool(newauthor)) { this.scanner.cache.author = newauthor; } } if (Lang13.Bool(href_list["setcategory"])) { newcategory = Interface13.Input("Choose a category: ", null, null, null, new ByTable(new object [] { "Fiction", "Non-Fiction", "Adult", "Reference", "Religion" }), InputType.Any); if (Lang13.Bool(newcategory)) { this.upload_category = newcategory; } } if (Lang13.Bool(href_list["upload"])) { if (this.scanner != null) { if (this.scanner.cache != null) { choice = Interface13.Input("Are you certain you wish to upload this title to the Archive?", null, null, null, new ByTable(new object [] { "Confirm", "Abort" }), InputType.Any); if (choice == "Confirm") { GlobalFuncs.establish_db_connection(); if (!GlobalVars.dbcon.IsConnected()) { Interface13.Alert("Connection to Archive has been severed. Aborting."); } else { sqltitle = GlobalFuncs.sanitizeSQL(this.scanner.cache.name); sqlauthor = GlobalFuncs.sanitizeSQL(this.scanner.cache.author); sqlcontent = GlobalFuncs.sanitizeSQL(this.scanner.cache.dat); sqlcategory = GlobalFuncs.sanitizeSQL(this.upload_category); query = GlobalVars.dbcon.NewQuery("INSERT INTO " + GlobalFuncs.format_table_name("library") + " (author, title, content, category, ckey, datetime) VALUES ('" + sqlauthor + "', '" + sqltitle + "', '" + sqlcontent + "', '" + sqlcategory + "', '" + Task13.User.ckey + "', Now())"); if (!query.Execute()) { Task13.User.WriteMsg(query.ErrorMsg()); } else { GlobalFuncs.log_game("" + Task13.User.name + "/" + Task13.User.key + " has uploaded the book titled " + this.scanner.cache.name + ", " + Lang13.Length(this.scanner.cache.dat) + " signs"); Interface13.Alert("Upload Complete. Uploaded title will be unavailable for printing for a short period"); } } } } } } if (Lang13.Bool(href_list["orderbyid"])) { orderid = Interface13.Input("Enter your order:", null, null, null, null, InputType.Num | InputType.Null); if (Lang13.Bool(orderid)) { if (Lang13.Bool(Lang13.IsNumber(orderid))) { href_list["targetid"] = orderid; } } } if (Lang13.Bool(href_list["targetid"])) { sqlid = GlobalFuncs.sanitizeSQL(href_list["targetid"]); GlobalFuncs.establish_db_connection(); if (!GlobalVars.dbcon.IsConnected()) { Interface13.Alert("Connection to Archive has been severed. Aborting."); } if (this.bibledelay) { this.say("Printer unavailable. Please allow a short time before attempting to print."); } else { this.bibledelay = true; Task13.Schedule(60, (Task13.Closure)(() => { this.bibledelay = false; return; })); query2 = GlobalVars.dbcon.NewQuery("SELECT * FROM " + GlobalFuncs.format_table_name("library") + " WHERE id=" + sqlid + " AND isnull(deleted)"); query2.Execute(); while (query2.NextRow()) { author = query2.item[2]; title = query2.item[3]; content = query2.item[4]; B2 = new Obj_Item_Weapon_Book(this.loc); B2.name = "Book: " + title; B2.title = title; B2.author = author; B2.dat = content; B2.icon_state = "book" + Rand13.Int(1, 8); this.visible_message("" + this + "'s printer hums as it produces a completely bound book. How did it do that?"); break; } } } this.add_fingerprint(Task13.User); this.updateUsrDialog(); return(null); }
// Range: -1 Access: 0 Flags: ( 0, 4, 255 ) public static ByTable power_list( Tile T = null, dynamic source = null, double d = 0, bool? unmarked = null, bool? cable_only = null ) { ByTable _default = null; dynamic AM = null; dynamic P = null; dynamic C = null; if ( unmarked == null ) { unmarked = false; } if ( cable_only == null ) { cable_only = false; } _default = new ByTable(); AM = null; foreach (dynamic _a in ((dynamic)T) ) { AM = _a; if ( AM == source ) { continue; } if ( !( cable_only == true ) && AM is Ent_Machinery_Power ) { P = AM; if ( Lang13.Bool( P.powernet ) == false ) { continue; } if ( !( unmarked == true ) || !Lang13.Bool( P.powernet ) ) { if ( d == 0 ) { _default += P; } } } else if ( AM is Ent_Structure_Cable ) { C = AM; if ( !( unmarked == true ) || !Lang13.Bool( C.powernet ) ) { if ( Lang13.Double( C.d1 ) == d || Lang13.Double( C.d2 ) == d ) { _default += C; } } } }; return _default; }
// Function from file: teleportation.dm public override dynamic Topic(string href = null, ByTable href_list = null, dynamic hsrc = null) { dynamic current_location = null; dynamic sr = null; Obj_Item_Device_Radio_Beacon W = null; dynamic tr = null; dynamic direct = null; Obj_Item_Weapon_Implant_Tracking W2 = null; Ent_Static M = null; dynamic tr2 = null; dynamic direct2 = null; dynamic M2 = null; base.Topic(href, href_list, (object)(hsrc)); if (Task13.User.stat != 0 || Task13.User.restrained()) { return(null); } current_location = GlobalFuncs.get_turf(Task13.User); if (!Lang13.Bool(current_location) || Convert.ToInt32(current_location.z) == 2) { Task13.User.WriteMsg("The " + this + " is malfunctioning."); return(null); } if (Task13.User.contents.Find(this) != 0 || Map13.GetDistance(this, Task13.User) <= 1 && this.loc is Tile) { Task13.User.set_machine(this); if (Lang13.Bool(href_list["refresh"])) { this.temp = "<B>Persistent Signal Locator</B><HR>"; sr = GlobalFuncs.get_turf(this); if (Lang13.Bool(sr)) { this.temp += "<B>Located Beacons:</B><BR>"; foreach (dynamic _a in Lang13.Enumerate(typeof(Game13), typeof(Obj_Item_Device_Radio_Beacon))) { W = _a; if (W.frequency == this.frequency) { tr = GlobalFuncs.get_turf(W); if (tr.z == sr.z && Lang13.Bool(tr)) { direct = Num13.MaxInt(((int)(Math.Abs(Convert.ToDouble(tr.x - sr.x)))), ((int)(Math.Abs(Convert.ToDouble(tr.y - sr.y))))); if (Convert.ToDouble(direct) < 5) { direct = "very strong"; } else if (Convert.ToDouble(direct) < 10) { direct = "strong"; } else if (Convert.ToDouble(direct) < 20) { direct = "weak"; } else { direct = "very weak"; } this.temp += "" + W.code + "-" + GlobalFuncs.dir2text(Map13.GetDistance(sr, tr)) + "-" + direct + "<BR>"; } } } this.temp += "<B>Extranneous Signals:</B><BR>"; foreach (dynamic _b in Lang13.Enumerate(GlobalVars.tracked_implants, typeof(Obj_Item_Weapon_Implant_Tracking))) { W2 = _b; if (!Lang13.Bool(W2.implanted) || !(W2.loc is Mob)) { continue; } else { M = W2.loc; if (Convert.ToInt32(((dynamic)M).stat) == 2) { if (Convert.ToDouble(((dynamic)M).timeofdeath + 6000) < Game13.time) { continue; } } } tr2 = GlobalFuncs.get_turf(W2); if (tr2.z == sr.z && Lang13.Bool(tr2)) { direct2 = Num13.MaxInt(((int)(Math.Abs(Convert.ToDouble(tr2.x - sr.x)))), ((int)(Math.Abs(Convert.ToDouble(tr2.y - sr.y))))); if (Convert.ToDouble(direct2) < 20) { if (Convert.ToDouble(direct2) < 5) { direct2 = "very strong"; } else if (Convert.ToDouble(direct2) < 10) { direct2 = "strong"; } else { direct2 = "weak"; } this.temp += "" + W2.imp_in.name + "-" + GlobalFuncs.dir2text(Map13.GetDistance(sr, tr2)) + "-" + direct2 + "<BR>"; } } } this.temp += new Txt("<B>You are at [").item(sr.x).str(",").item(sr.y).str(",").item(sr.z).str("]</B> in orbital coordinates.<BR><BR><A href='byond://?src=").Ref(this).str(";refresh=1'>Refresh</A><BR>").ToString(); } else { this.temp += "<B><FONT color='red'>Processing Error:</FONT></B> Unable to locate orbital position.<BR>"; } } else if (Lang13.Bool(href_list["freq"])) { this.frequency += String13.ParseNumber(href_list["freq"]) ?? 0; this.frequency = GlobalFuncs.sanitize_frequency(this.frequency); } else if (Lang13.Bool(href_list["temp"])) { this.temp = null; } if (this.loc is Mob) { this.attack_self(this.loc); } else { foreach (dynamic _c in Lang13.Enumerate(Map13.FetchViewers(this, 1))) { M2 = _c; if (Lang13.Bool(M2.client)) { this.attack_self(M2); } } } } return(null); }