// Function from file: smes.dm public void make_terminal(dynamic T = null) { this.terminal = new Obj_Machinery_Power_Terminal(T); this.terminal.dir = Map13.GetDistance(T, this); this.terminal.master = this; return; }
// Function from file: smes.dm public override void disconnect_terminal( ) { if (this.terminal != null) { this.terminal.master = null; this.terminal = null; } return; }
// Function from file: apc_frame.dm public override bool try_build(Tile_Simulated_Wall on_wall = null) { dynamic loc = null; Ent_Static A = null; Obj_Machinery_Power_Terminal T = null; Obj_Item_Stack_CableCoil C = null; if (!base.try_build(on_wall)) { return(false); } loc = GlobalFuncs.get_turf(Task13.User); A = loc.loc; if (Lang13.Bool(((dynamic)A).get_apc())) { Task13.User.WriteMsg("<span class='warning'>This area already has APC!</span>"); return(false); } foreach (dynamic _a in Lang13.Enumerate(loc, typeof(Obj_Machinery_Power_Terminal))) { T = _a; if (T.master != null) { Task13.User.WriteMsg("<span class='warning'>There is another network terminal here!</span>"); return(false); } else { C = new Obj_Item_Stack_CableCoil(loc); C.amount = 10; Task13.User.WriteMsg("<span class='notice'>You cut the cables and disassemble the unused power terminal.</span>"); GlobalFuncs.qdel(T); } } return(true); }
// Function from file: monitor.dm public override ByTable ui_data(dynamic user = null) { ByTable data = null; Obj_Machinery_Power_Terminal term = null; Obj_Machinery_Power A = null; data = new ByTable(); data["stored"] = this.record_size; data["interval"] = this.record_interval / 10; data["attached"] = (Lang13.Bool(this.attached) ? GlobalVars.TRUE : GlobalVars.FALSE); if (Lang13.Bool(this.attached)) { data["supply"] = this.attached.powernet.viewavail; data["demand"] = this.attached.powernet.viewload; } data["history"] = this.history; data["areas"] = new ByTable(); foreach (dynamic _a in Lang13.Enumerate(this.attached.powernet.nodes, typeof(Obj_Machinery_Power_Terminal))) { term = _a; A = term.master; if (A is Obj_Machinery_Power_Apc) { data["areas"] += new ByTable(new object [] { new ByTable() .Set("name", ((dynamic)A).area.name) .Set("charge", ((Obj_Item_Weapon_StockParts_Cell)((dynamic)A).cell).percent()) .Set("load", ((dynamic)A).lastused_total) .Set("charging", ((dynamic)A).charging) .Set("eqp", ((dynamic)A).equipment) .Set("lgt", ((dynamic)A).lighting) .Set("env", ((dynamic)A).environ) }); } } return(data); }
// Function from file: cart.dm public void generate_menu(Mob user = null) { Obj_Item_Radio_Integrated_Signal S = null; Data_Record t = null; int powercount = 0; Obj_Machinery_Computer_Monitor pMon = null; int count = 0; Obj_Machinery_Computer_Monitor pMon2 = null; ByTable L = null; Obj_Machinery_Power_Terminal term = null; Obj_Machinery_Power A = null; ByTable S2 = null; ByTable chg = null; Obj_Machinery_Power_Apc A2 = null; Data_Record R = null; Data_Record R2 = null; Data_Crime c = null; Data_Crime c2 = null; dynamic S3 = null; dynamic SO = null; dynamic S4 = null; dynamic SO2 = null; dynamic cl = null; dynamic ldat = null; Obj_Item_Weapon_Mop M = null; dynamic ml = null; double?direction = null; Obj_Structure_Janitorialcart B = null; dynamic bl = null; double? direction2 = null; Mob_Living_SimpleAnimal_Bot_Cleanbot B2 = null; dynamic bl2 = null; double? direction3 = null; Newscaster_FeedChannel current = null; Newscaster_FeedChannel chan = null; int i = 0; Newscaster_FeedMessage msg = null; Newscaster_FeedComment comment = null; switch ((int)(this.mode)) { case 40: S = this.radio; this.menu = "<h4><img src=pda_signaler.png> Remote Signaling System</h4>"; this.menu += new Txt("\n<a href='byond://?src=").Ref(this).str(";choice=Send Signal'>Send Signal</A><BR>\nFrequency:\n<a href='byond://?src=").Ref(this).str(";choice=Signal Frequency;sfreq=-10'>-</a>\n<a href='byond://?src=").Ref(this).str(";choice=Signal Frequency;sfreq=-2'>-</a>\n").item(GlobalFuncs.format_frequency(S.frequency)).str("\n<a href='byond://?src=").Ref(this).str(";choice=Signal Frequency;sfreq=2'>+</a>\n<a href='byond://?src=").Ref(this).str(";choice=Signal Frequency;sfreq=10'>+</a><br>\n<br>\nCode:\n<a href='byond://?src=").Ref(this).str(";choice=Signal Code;scode=-5'>-</a>\n<a href='byond://?src=").Ref(this).str(";choice=Signal Code;scode=-1'>-</a>\n").item(S.code).str("\n<a href='byond://?src=").Ref(this).str(";choice=Signal Code;scode=1'>+</a>\n<a href='byond://?src=").Ref(this).str(";choice=Signal Code;scode=5'>+</a><br>").ToString(); break; case 41: this.menu = "<h4><img src=pda_notes.png> Crew Manifest</h4>"; this.menu += "Entries cannot be modified from this terminal.<br><br>"; if (GlobalVars.data_core.general != null) { foreach (dynamic _a in Lang13.Enumerate(GlobalFuncs.sortRecord(GlobalVars.data_core.general), typeof(Data_Record))) { t = _a; this.menu += "" + t.fields["name"] + " - " + t.fields["rank"] + "<br>"; } } this.menu += "<br>"; break; case 42: this.menu = "<h4><img src=pda_status.png> Station Status Display Interlink</h4>"; this.menu += new Txt("[ <A HREF='?src=").Ref(this).str(";choice=Status;statdisp=blank'>Clear</A> ]<BR>").ToString(); this.menu += new Txt("[ <A HREF='?src=").Ref(this).str(";choice=Status;statdisp=shuttle'>Shuttle ETA</A> ]<BR>").ToString(); this.menu += new Txt("[ <A HREF='?src=").Ref(this).str(";choice=Status;statdisp=message'>Message</A> ]").ToString(); this.menu += new Txt("<ul><li> Line 1: <A HREF='?src=").Ref(this).str(";choice=Status;statdisp=setmsg1'>").item((Lang13.Bool(this.message1) ? this.message1 : ((dynamic)("(none)")))).str("</A>").ToString(); this.menu += new Txt("<li> Line 2: <A HREF='?src=").Ref(this).str(";choice=Status;statdisp=setmsg2'>").item((Lang13.Bool(this.message2) ? this.message2 : ((dynamic)("(none)")))).str("</A></ul><br>").ToString(); this.menu += new Txt("[ Alert: <A HREF='?src=").Ref(this).str(";choice=Status;statdisp=alert;alert=default'>None</A> |").ToString(); this.menu += new Txt(" <A HREF='?src=").Ref(this).str(";choice=Status;statdisp=alert;alert=redalert'>Red Alert</A> |").ToString(); this.menu += new Txt(" <A HREF='?src=").Ref(this).str(";choice=Status;statdisp=alert;alert=lockdown'>Lockdown</A> |").ToString(); this.menu += new Txt(" <A HREF='?src=").Ref(this).str(";choice=Status;statdisp=alert;alert=biohazard'>Biohazard</A> ]<BR>").ToString(); break; case 43: this.menu = "<h4><img src=pda_power.png> Power Monitors - Please select one</h4><BR>"; this.powmonitor = null; this.powermonitors = new ByTable(); powercount = 0; foreach (dynamic _b in Lang13.Enumerate(GlobalVars.machines, typeof(Obj_Machinery_Computer_Monitor))) { pMon = _b; if (!((pMon.stat & 3) != 0)) { powercount++; this.powermonitors.Add(pMon); } } if (!(powercount != 0)) { this.menu += "<span class='danger'>No connection<BR></span>"; } else { this.menu += "<FONT SIZE=-1>"; count = 0; foreach (dynamic _c in Lang13.Enumerate(this.powermonitors, typeof(Obj_Machinery_Computer_Monitor))) { pMon2 = _c; count++; this.menu += new Txt("<a href='byond://?src=").Ref(this).str(";choice=Power Select;target=").item(count).str("'>").item(pMon2).str(" </a><BR>").ToString(); } this.menu += "</FONT>"; } break; case 433: this.menu = "<h4><img src=pda_power.png> Power Monitor </h4><BR>"; if (!Lang13.Bool(this.powmonitor)) { this.menu += "<span class='danger'>No connection<BR></span>"; } else { L = new ByTable(); foreach (dynamic _d in Lang13.Enumerate(this.powmonitor.attached.powernet.nodes, typeof(Obj_Machinery_Power_Terminal))) { term = _d; if (term.master is Obj_Machinery_Power_Apc) { A = term.master; L.Add(A); } } this.menu += "<PRE>Total power: " + this.powmonitor.attached.powernet.viewavail + " W<BR>Total load: " + String13.NumberToString(this.powmonitor.attached.powernet.viewload, 10) + " W<BR>"; this.menu += "<FONT SIZE=-1>"; if (L.len > 0) { this.menu += "Area Eqp./Lgt./Env. Load Cell<HR>"; S2 = new ByTable(new object [] { " Off", "AOff", " On", " AOn" }); chg = new ByTable(new object [] { "N", "C", "F" }); foreach (dynamic _e in Lang13.Enumerate(L, typeof(Obj_Machinery_Power_Apc))) { A2 = _e; this.menu += String13.SubStr(GlobalFuncs.add_tspace(A2.area.name, 30), 1, 30); this.menu += " " + S2[(A2.equipment ?? 0) + 1] + " " + S2[(A2.lighting ?? 0) + 1] + " " + S2[(A2.environ ?? 0) + 1] + " " + GlobalFuncs.add_lspace(A2.lastused_total, 6) + " " + (Lang13.Bool(A2.cell) ? "" + GlobalFuncs.add_lspace(Num13.Floor(((Obj_Item_Weapon_StockParts_Cell)A2.cell).percent()), 3) + "% " + chg[A2.charging + 1] : " N/C") + "<BR>"; } } this.menu += "</FONT></PRE>"; } break; case 44: this.menu = "<h4><img src=pda_medical.png> Medical Record List</h4>"; if (GlobalVars.data_core.general != null) { foreach (dynamic _f in Lang13.Enumerate(GlobalFuncs.sortRecord(GlobalVars.data_core.general), typeof(Data_Record))) { R = _f; this.menu += new Txt("<a href='byond://?src=").Ref(this).str(";choice=Medical Records;target=").item(R.fields["id"]).str("'>").item(R.fields["id"]).str(": ").item(R.fields["name"]).str("<br>").ToString(); } } this.menu += "<br>"; break; case 441: this.menu = "<h4><img src=pda_medical.png> Medical Record</h4>"; if (GlobalVars.data_core.general.Contains(this.active1)) { this.menu += "Name: " + this.active1.fields["name"] + " ID: " + this.active1.fields["id"] + "<br>"; this.menu += "Sex: " + this.active1.fields["sex"] + "<br>"; this.menu += "Age: " + this.active1.fields["age"] + "<br>"; this.menu += "Rank: " + this.active1.fields["rank"] + "<br>"; this.menu += "Fingerprint: " + this.active1.fields["fingerprint"] + "<br>"; this.menu += "Physical Status: " + this.active1.fields["p_stat"] + "<br>"; this.menu += "Mental Status: " + this.active1.fields["m_stat"] + "<br>"; } else { this.menu += "<b>Record Lost!</b><br>"; } this.menu += "<br>"; this.menu += "<h4><img src=pda_medical.png> Medical Data</h4>"; if (GlobalVars.data_core.medical.Contains(this.active2)) { this.menu += "Blood Type: " + this.active2.fields["blood_type"] + "<br><br>"; this.menu += "Minor Disabilities: " + this.active2.fields["mi_dis"] + "<br>"; this.menu += "Details: " + this.active2.fields["mi_dis_d"] + "<br><br>"; this.menu += "Major Disabilities: " + this.active2.fields["ma_dis"] + "<br>"; this.menu += "Details: " + this.active2.fields["ma_dis_d"] + "<br><br>"; this.menu += "Allergies: " + this.active2.fields["alg"] + "<br>"; this.menu += "Details: " + this.active2.fields["alg_d"] + "<br><br>"; this.menu += "Current Diseases: " + this.active2.fields["cdi"] + "<br>"; this.menu += "Details: " + this.active2.fields["cdi_d"] + "<br><br>"; this.menu += "Important Notes: " + this.active2.fields["notes"] + "<br>"; } else { this.menu += "<b>Record Lost!</b><br>"; } this.menu += "<br>"; break; case 45: this.menu = "<h4><img src=pda_cuffs.png> Security Record List</h4>"; if (GlobalVars.data_core.general != null) { foreach (dynamic _g in Lang13.Enumerate(GlobalFuncs.sortRecord(GlobalVars.data_core.general), typeof(Data_Record))) { R2 = _g; this.menu += new Txt("<a href='byond://?src=").Ref(this).str(";choice=Security Records;target=").item(R2.fields["id"]).str("'>").item(R2.fields["id"]).str(": ").item(R2.fields["name"]).str("<br>").ToString(); } } this.menu += "<br>"; break; case 451: this.menu = "<h4><img src=pda_cuffs.png> Security Record</h4>"; if (GlobalVars.data_core.general.Contains(this.active1)) { this.menu += "Name: " + this.active1.fields["name"] + " ID: " + this.active1.fields["id"] + "<br>"; this.menu += "Sex: " + this.active1.fields["sex"] + "<br>"; this.menu += "Age: " + this.active1.fields["age"] + "<br>"; this.menu += "Rank: " + this.active1.fields["rank"] + "<br>"; this.menu += "Fingerprint: " + this.active1.fields["fingerprint"] + "<br>"; this.menu += "Physical Status: " + this.active1.fields["p_stat"] + "<br>"; this.menu += "Mental Status: " + this.active1.fields["m_stat"] + "<br>"; } else { this.menu += "<b>Record Lost!</b><br>"; } this.menu += "<br>"; this.menu += "<h4><img src=pda_cuffs.png> Security Data</h4>"; if (GlobalVars.data_core.security.Contains(this.active3)) { this.menu += "Criminal Status: " + this.active3.fields["criminal"] + "<br>"; this.menu += "<BR>\nMinor Crimes:"; this.menu += @"<table style=""text-align:center;"" border=""1"" cellspacing=""0"" width=""100%""> <tr> <th>Crime</th> <th>Details</th> <th>Author</th> <th>Time Added</th> </tr>"; foreach (dynamic _h in Lang13.Enumerate(this.active3.fields["mi_crim"], typeof(Data_Crime))) { c = _h; this.menu += "<tr><td>" + c.crimeName + "</td>"; this.menu += "<td>" + c.crimeDetails + "</td>"; this.menu += "<td>" + c.author + "</td>"; this.menu += "<td>" + c.time + "</td>"; this.menu += "</tr>"; } this.menu += "</table>"; this.menu += "<BR>\nMajor Crimes:"; this.menu += @"<table style=""text-align:center;"" border=""1"" cellspacing=""0"" width=""100%""> <tr> <th>Crime</th> <th>Details</th> <th>Author</th> <th>Time Added</th> </tr>"; foreach (dynamic _i in Lang13.Enumerate(this.active3.fields["ma_crim"], typeof(Data_Crime))) { c2 = _i; this.menu += "<tr><td>" + c2.crimeName + "</td>"; this.menu += "<td>" + c2.crimeDetails + "</td>"; this.menu += "<td>" + c2.author + "</td>"; this.menu += "<td>" + c2.time + "</td>"; this.menu += "</tr>"; } this.menu += "</table>"; this.menu += "<BR>\nImportant Notes:<br>"; this.menu += "" + this.active3.fields["notes"]; } else { this.menu += "<b>Record Lost!</b><br>"; } this.menu += "<br>"; break; case 47: this.menu = "<h4><img src=pda_crate.png> Supply Record Interlink</h4>"; this.menu += "<BR><B>Supply shuttle</B><BR>"; this.menu += "Location: "; switch ((int)(GlobalVars.SSshuttle.supply.mode)) { case 2: this.menu += "Moving to "; if (GlobalVars.SSshuttle.supply.z != 1) { this.menu += "station"; } else { this.menu += "centcomm"; } this.menu += " (" + GlobalVars.SSshuttle.supply.timeLeft(600) + " Mins)"; break; default: this.menu += "At "; if (GlobalVars.SSshuttle.supply.z != 1) { this.menu += "centcomm"; } else { this.menu += "station"; } break; } this.menu += "<BR>Current approved orders: <BR><ol>"; foreach (dynamic _k in Lang13.Enumerate(GlobalVars.SSshuttle.shoppinglist)) { S3 = _k; SO = S3; this.menu += "<li>#" + SO.id + " - " + SO.pack.name + " approved by " + SO.orderer + " " + (Lang13.Bool(SO.reason) ? "(" + SO.reason + ")" : "") + "</li>"; } this.menu += "</ol>"; this.menu += "Current requests: <BR><ol>"; foreach (dynamic _l in Lang13.Enumerate(GlobalVars.SSshuttle.requestlist)) { S4 = _l; SO2 = S4; this.menu += "<li>#" + SO2.id + " - " + SO2.pack.name + " requested by " + SO2.orderer + "</li>"; } this.menu += "</ol><font size=\"-3\">Upgrade NOW to Space Parts & Space Vendors PLUS for full remote order control and inventory management."; break; case 49: this.menu = "<h4><img src=pda_bucket.png> Persistent Custodial Object Locator</h4>"; cl = GlobalFuncs.get_turf(this); if (Lang13.Bool(cl)) { this.menu += "Current Orbital Location: <b>[" + cl.x + "," + cl.y + "]</b>"; this.menu += "<h4>Located Mops:</h4>"; ldat = null; foreach (dynamic _m in Lang13.Enumerate(typeof(Game13), typeof(Obj_Item_Weapon_Mop))) { M = _m; ml = GlobalFuncs.get_turf(M); if (Lang13.Bool(ml)) { if (ml.z != cl.z) { continue; } direction = Map13.GetDistance(this, M); ldat += "Mop - <b>[" + ml.x + "," + ml.y + " (" + String13.ToUpper(GlobalFuncs.dir2text(direction)) + ")]</b> - " + (Lang13.Bool(M.reagents.total_volume) ? "Wet" : "Dry") + "<br>"; } } if (!Lang13.Bool(ldat)) { this.menu += "None"; } else { this.menu += "" + ldat; } this.menu += "<h4>Located Janitorial Cart:</h4>"; ldat = null; foreach (dynamic _n in Lang13.Enumerate(typeof(Game13), typeof(Obj_Structure_Janitorialcart))) { B = _n; bl = GlobalFuncs.get_turf(B); if (Lang13.Bool(bl)) { if (bl.z != cl.z) { continue; } direction2 = Map13.GetDistance(this, B); ldat += "Cart - <b>[" + bl.x + "," + bl.y + " (" + String13.ToUpper(GlobalFuncs.dir2text(direction2)) + ")]</b> - Water level: " + B.reagents.total_volume + "/100<br>"; } } if (!Lang13.Bool(ldat)) { this.menu += "None"; } else { this.menu += "" + ldat; } this.menu += "<h4>Located Cleanbots:</h4>"; ldat = null; foreach (dynamic _o in Lang13.Enumerate(GlobalVars.living_mob_list, typeof(Mob_Living_SimpleAnimal_Bot_Cleanbot))) { B2 = _o; bl2 = GlobalFuncs.get_turf(B2); if (Lang13.Bool(bl2)) { if (bl2.z != cl.z) { continue; } direction3 = Map13.GetDistance(this, B2); ldat += "Cleanbot - <b>[" + bl2.x + "," + bl2.y + " (" + String13.ToUpper(GlobalFuncs.dir2text(direction3)) + ")]</b> - " + (Lang13.Bool(B2.on) ? "Online" : "Offline") + "<br>"; } } if (!Lang13.Bool(ldat)) { this.menu += "None"; } else { this.menu += "" + ldat; } } else { this.menu += "ERROR: Unable to determine current location."; } this.menu += new Txt("<br><br><A href='byond://?src=").Ref(this).str(";choice=49'>Refresh GPS Locator</a>").ToString(); break; case 53: this.menu = "<h4><img src=pda_notes.png> Newscaster Access</h4>"; this.menu += new Txt("<br> Current Newsfeed: <A href='byond://?src=").Ref(this).str(";choice=Newscaster Switch Channel'>").item((Lang13.Bool(this.current_channel) ? this.current_channel : "None")).str("</a> <br>").ToString(); current = null; foreach (dynamic _p in Lang13.Enumerate(GlobalVars.news_network.network_channels, typeof(Newscaster_FeedChannel))) { chan = _p; if (chan.channel_name == this.current_channel) { current = chan; } } if (!(current != null)) { this.menu += "<h5> ERROR : NO CHANNEL FOUND </h5>"; return; } i = 1; foreach (dynamic _r in Lang13.Enumerate(current.messages, typeof(Newscaster_FeedMessage))) { msg = _r; this.menu += "-" + msg.returnBody(-1) + " <BR><FONT SIZE=1>[Story by <FONT COLOR='maroon'>" + msg.returnAuthor(-1) + "</FONT>]</FONT><BR>"; this.menu += "<b><font size=1>" + msg.comments.len + " comment" + (msg.comments.len > 1 ? "s" : "") + "</font></b><br>"; if (msg.img != null) { Interface13.CacheBrowseResource(user, msg.img, "tmp_photo" + i + ".png"); this.menu += "<img src='tmp_photo" + i + ".png' width = '180'><BR>"; } i++; foreach (dynamic _q in Lang13.Enumerate(msg.comments, typeof(Newscaster_FeedComment))) { comment = _q; this.menu += "<font size=1><small>" + comment.body + "</font><br><font size=1><small><small><small>" + comment.author + " " + comment.time_stamp + "</small></small></small></small></font><br>"; } } this.menu += new Txt("<br> <A href='byond://?src=").Ref(this).str(";choice=Newscaster Message'>Post Message</a>").ToString(); break; case 54: this.menu = "<h4><img src=pda_medbot.png> Bots Interlink</h4>"; this.bot_control(); break; } return; }
// Function from file: powersink.dm public override int?process(dynamic seconds = null) { Powernet PN = null; int drained = 0; Obj_Machinery_Power_Terminal T = null; Obj_Machinery_Power A = null; if (!Lang13.Bool(this.attached)) { this.set_mode(GlobalVars.DISCONNECTED); return(null); } PN = this.attached.powernet; if (PN != null) { this.SetLuminosity(5); drained = Num13.MinInt(this.drain_rate, ((int)(PN.avail))); PN.load += drained; this.power_drained += drained; if (drained < this.drain_rate) { foreach (dynamic _a in Lang13.Enumerate(PN.nodes, typeof(Obj_Machinery_Power_Terminal))) { T = _a; if (T.master is Obj_Machinery_Power_Apc) { A = T.master; if (Lang13.Bool(((dynamic)A).operating) && Lang13.Bool(((dynamic)A).cell)) { ((dynamic)A).cell.charge = Num13.MaxInt(0, Convert.ToInt32(((dynamic)A).cell.charge - 50)); this.power_drained += 50; if (Convert.ToInt32(((dynamic)A).charging) == 2) { ((dynamic)A).charging = 1; } } } } } } if (this.power_drained > this.max_power * 0.98) { if (!this.admins_warned) { this.admins_warned = true; GlobalFuncs.message_admins("Power sink at (" + this.x + "," + this.y + "," + this.z + " - <A HREF='?_src_=holder;adminplayerobservecoodjump=1;X=" + this.x + ";Y=" + this.y + ";Z=" + this.z + "'>JMP</a>) is 95% full. Explosion imminent."); } GlobalFuncs.playsound(this, "sound/effects/screech.ogg", 100, 1, 1); } if (this.power_drained >= this.max_power) { GlobalVars.SSobj.processing.Remove(this); GlobalFuncs.explosion(this.loc, 4, 8, 16, 32); GlobalFuncs.qdel(this); } return(null); }
// Function from file: ninjaDrainAct.dm public override dynamic ninjadrain_act(Obj_Item_Clothing_Suit_Space_SpaceNinja S = null, Ent_Static H = null, Obj_Item_Clothing_Gloves_SpaceNinja G = null) { dynamic _default = null; bool maxcapacity = false; int drain = 0; Powernet PN = null; int drained = 0; Obj_Machinery_Power_Terminal T = null; Obj_Machinery_Power AP = null; if (!(S != null) || !(H != null) || !(G != null)) { return("INVALID"); } maxcapacity = false; drain = 0; _default = 0; PN = this.powernet; while (G.candrain && !maxcapacity && this != null) { drain = Num13.Floor(Rand13.Int(G.mindrain, G.maxdrain) / 2); drained = 0; if (PN != null && GlobalFuncs.do_after(H, 10, null, this)) { drained = Num13.MinInt(drain, ((int)(PN.avail))); PN.load += drained; if (drained < drain) { foreach (dynamic _a in Lang13.Enumerate(PN.nodes, typeof(Obj_Machinery_Power_Terminal))) { T = _a; if (T.master is Obj_Machinery_Power_Apc) { AP = T.master; if (Lang13.Bool(((dynamic)AP).operating) && Lang13.Bool(((dynamic)AP).cell) && Convert.ToDouble(((dynamic)AP).cell.charge) > 0) { ((dynamic)AP).cell.charge = Num13.MaxInt(0, Convert.ToInt32(((dynamic)AP).cell.charge - 5)); drained += 5; } } } } } else { break; } S.cell.charge += drained; if (Convert.ToDouble(S.cell.charge) > (S.cell.maxcharge ?? 0)) { _default += drained - Convert.ToDouble(S.cell.charge - S.cell.maxcharge); S.cell.charge = S.cell.maxcharge; maxcapacity = true; } else { _default += drained; } S.spark_system.start(); } return(_default); }
// Function from file: smes.dm public override dynamic attackby(dynamic A = null, dynamic user = null, string _params = null, bool?silent = null, bool?replace_spent = null) { Tile T = null; Obj_Machinery_Power_Terminal term = null; int dir = 0; dynamic T2 = null; dynamic C = null; dynamic N = null; EffectSystem_SparkSpread s = null; dynamic T3 = null; if (this.default_deconstruction_screwdriver(user, "" + Lang13.Initial(this, "icon_state") + "-o", Lang13.Initial(this, "icon_state"), A)) { this.update_icon(); return(null); } if (this.default_change_direction_wrench(user, A)) { this.terminal = null; T = Map13.GetStep(this, this.dir); foreach (dynamic _a in Lang13.Enumerate(T, typeof(Obj_Machinery_Power_Terminal))) { term = _a; if (term != null && term.dir == Num13.Rotate(this.dir, 180)) { this.terminal = term; this.terminal.master = this; user.WriteMsg("<span class='notice'>Terminal found.</span>"); break; } } if (!(this.terminal != null)) { user.WriteMsg("<span class='alert'>No power source found.</span>"); return(null); } this.stat &= 65534; this.update_icon(); return(null); } if (this.exchange_parts(user, A)) { return(null); } if (A is Obj_Item_Stack_CableCoil) { dir = Map13.GetDistance(user, this); if ((dir & dir - 1) != 0) { return(null); } if (this.terminal != null) { user.WriteMsg("<span class='warning'>This SMES already have a power terminal!</span>"); return(null); } if (!Lang13.Bool(this.panel_open)) { user.WriteMsg("<span class='warning'>You must open the maintenance panel first!</span>"); return(null); } T2 = GlobalFuncs.get_turf(user); if (T2.intact) { user.WriteMsg("<span class='warning'>You must first remove the floor plating!</span>"); return(null); } C = A; if (Convert.ToDouble(C.amount) < 10) { user.WriteMsg("<span class='warning'>You need more wires!</span>"); return(null); } user.WriteMsg("<span class='notice'>You start building the power terminal...</span>"); GlobalFuncs.playsound(this.loc, "sound/items/Deconstruct.ogg", 50, 1); if (GlobalFuncs.do_after(user, 20, null, this) && Convert.ToDouble(C.amount) >= 10) { N = ((Tile)T2).get_cable_node(); if (Rand13.PercentChance(50) && Lang13.Bool(GlobalFuncs.electrocute_mob(Task13.User, N, N))) { s = new EffectSystem_SparkSpread(); s.set_up(5, 1, this); s.start(); return(null); } C.use(10); ((Ent_Static)user).visible_message("" + user.name + " has built a power terminal.", "<span class='notice'>You build the power terminal.</span>"); this.make_terminal(T2); this.terminal.connect_to_network(); } return(null); } if (A is Obj_Item_Weapon_Wirecutters && this.terminal != null && Lang13.Bool(this.panel_open)) { this.terminal.dismantle(user); } T3 = GlobalFuncs.get_turf(this); if (this.default_deconstruction_crowbar(A)) { GlobalFuncs.message_admins(new Txt().item(this).str(" has been deconstructed by ").item(GlobalFuncs.key_name_admin(user)).str("(<A HREF='?_src_=holder;adminmoreinfo=").Ref(user).str("'>?</A>) (<A HREF='?_src_=holder;adminplayerobservefollow=").Ref(user).str("'>FLW</A>) in (").item(T3.x).str(",").item(T3.y).str(",").item(T3.z).str(" - <A HREF='?_src_=holder;adminplayerobservecoodjump=1;X=").item(T3.x).str(";Y=").item(T3.y).str(";Z=").item(T3.z).str("'>JMP</a>)").ToString()); GlobalFuncs.log_game("" + this + " has been deconstructed by " + GlobalFuncs.key_name(user)); this.investigate_log("SMES deconstructed by " + GlobalFuncs.key_name(user), "singulo"); } return(null); }
// Function from file: smes.dm public Obj_Machinery_Power_Smes(dynamic loc = null) : base((object)(loc)) { double i = 0; dynamic d = null; Tile T = null; Obj_Machinery_Power_Terminal term = null; // Warning: Super call was HERE! If anything above HERE is needed by the super call, it might break!; this.component_parts = new ByTable(); this.component_parts.Add(new Obj_Item_Weapon_Circuitboard_Smes(null)); foreach (dynamic _a in Lang13.IterateRange(1, 5)) { i = _a; this.component_parts.Add(new Obj_Item_Weapon_StockParts_Cell_High_Empty(null)); } this.component_parts.Add(new Obj_Item_Stack_CableCoil(null, 5)); this.component_parts.Add(new Obj_Item_Weapon_StockParts_Capacitor(null)); this.RefreshParts(); Task13.Schedule(5, (Task13.Closure)(() => { foreach (dynamic _c in Lang13.Enumerate(GlobalVars.cardinal)) { d = _c; T = Map13.GetStep(this, Convert.ToInt32(d)); string _loop_ctrl_1 = null; foreach (dynamic _b in Lang13.Enumerate(T, typeof(Obj_Machinery_Power_Terminal))) { term = _b; if (term != null && term.dir == Num13.Rotate(d, 180)) { this.terminal = term; _loop_ctrl_1 = "break"; break; } } if (_loop_ctrl_1 == "break") { break; } else if (_loop_ctrl_1 == "continue") { continue; } } if (!(this.terminal != null)) { this.stat |= 1; return; } this.terminal.master = this; this.update_icon(); return; })); return; }