예제 #1
0
파일: Powernet.cs 프로젝트: Somnium13/SS13
        // Function from file: powernet.dm
        public void remove_machine(Obj_Machinery_Power M = null)
        {
            this.nodes.Remove(M);
            M.powernet = null;

            if (this.is_empty())
            {
                GlobalFuncs.qdel(this);
            }
            return;
        }
예제 #2
0
파일: Powernet.cs 프로젝트: Somnium13/SS13
 // Function from file: powernet.dm
 public void add_machine(Obj_Machinery_Power M = null)
 {
     if (Lang13.Bool(M.powernet))
     {
         if (M.powernet == this)
         {
             return;
         }
         else
         {
             M.disconnect_from_network();
         }
     }
     M.powernet    = this;
     this.nodes[M] = M;
     return;
 }
        // 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: solar.dm
        public void search_for_connected(  )
        {
            Obj_Machinery_Power M = null;
            Obj_Machinery_Power S = null;
            Obj_Machinery_Power T = null;


            if (Lang13.Bool(this.powernet))
            {
                foreach (dynamic _a in Lang13.Enumerate(this.powernet.nodes, typeof(Obj_Machinery_Power)))
                {
                    M = _a;


                    if (M is Obj_Machinery_Power_Solar)
                    {
                        S = M;

                        if (!Lang13.Bool(((dynamic)S).control))
                        {
                            ((dynamic)S).set_control(this);
                        }
                    }
                    else if (M is Obj_Machinery_Power_Tracker)
                    {
                        if (!(this.connected_tracker != null))
                        {
                            T = M;

                            if (!Lang13.Bool(((dynamic)T).control))
                            {
                                ((Obj_Machinery_Power_Tracker)T).set_control(this);
                            }
                        }
                    }
                }
            }
            return;
        }
예제 #5
0
파일: Powernet.cs 프로젝트: Somnium13/SS13
        // Function from file: powernet.dm
        public override dynamic Destroy(  )
        {
            Obj_Structure_Cable C = null;
            Obj_Machinery_Power M = null;


            foreach (dynamic _a in Lang13.Enumerate(this.cables, typeof(Obj_Structure_Cable)))
            {
                C = _a;

                this.cables.Remove(C);
                C.powernet = null;
            }

            foreach (dynamic _b in Lang13.Enumerate(this.nodes, typeof(Obj_Machinery_Power)))
            {
                M = _b;

                this.nodes.Remove(M);
                M.powernet = null;
            }
            GlobalVars.SSmachine.powernets.Remove(this);
            return(base.Destroy());
        }
예제 #6
0
        // 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;
        }
예제 #7
0
        // 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);
        }
예제 #8
0
        // 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);
        }
예제 #9
0
        // Function from file: cable.dm
        public void mergeConnectedNetworksOnTurf(  )
        {
            ByTable             to_connect = null;
            Powernet            newPN      = null;
            dynamic             AM         = null;
            dynamic             C          = null;
            dynamic             N          = null;
            dynamic             M          = null;
            Obj_Machinery_Power PM         = null;

            to_connect = new ByTable();

            if (!(this.powernet != null))
            {
                newPN = new Powernet();
                newPN.add_cable(this);
            }

            foreach (dynamic _a in Lang13.Enumerate(this.loc))
            {
                AM = _a;


                if (AM is Obj_Structure_Cable)
                {
                    C = AM;

                    if (C.d1 == this.d1 || C.d2 == this.d1 || C.d1 == this.d2 || C.d2 == this.d2)
                    {
                        if (C.powernet == this.powernet)
                        {
                            continue;
                        }

                        if (Lang13.Bool(C.powernet))
                        {
                            GlobalFuncs.merge_powernets(this.powernet, C.powernet);
                        }
                        else
                        {
                            this.powernet.add_cable(C);
                        }
                    }
                }
                else if (AM is Obj_Machinery_Power_Apc)
                {
                    N = AM;

                    if (!Lang13.Bool(N.terminal))
                    {
                        continue;
                    }

                    if (N.terminal.powernet == this.powernet)
                    {
                        continue;
                    }
                    to_connect.Add(N.terminal);
                }
                else if (AM is Obj_Machinery_Power)
                {
                    M = AM;

                    if (M.powernet == this.powernet)
                    {
                        continue;
                    }
                    to_connect.Add(M);
                }
            }

            foreach (dynamic _b in Lang13.Enumerate(to_connect, typeof(Obj_Machinery_Power)))
            {
                PM = _b;


                if (!PM.connect_to_network())
                {
                    PM.disconnect_from_network();
                }
            }
            return;
        }
예제 #10
0
        // Function from file: cable.dm
        public void cut_cable_from_powernet(  )
        {
            Ent_Static          T1     = null;
            ByTable             P_list = null;
            Obj_Machinery_Power P      = null;
            dynamic             O      = null;
            Powernet            newPN  = null;
            Obj_Machinery_Power P2     = null;

            T1 = this.loc;

            if (!(T1 != null))
            {
                return;
            }

            if (Lang13.Bool(this.d1))
            {
                T1     = Map13.GetStep(T1, ((int)(this.d1 ?? 0)));
                P_list = GlobalFuncs.power_list(T1, this, Num13.Rotate(this.d1, 180), false, true);
            }
            P_list.Add(GlobalFuncs.power_list(this.loc, this, this.d1, false, true));

            if (P_list.len == 0)
            {
                this.powernet.remove_cable(this);

                foreach (dynamic _a in Lang13.Enumerate(T1, typeof(Obj_Machinery_Power)))
                {
                    P = _a;


                    if (!P.connect_to_network())
                    {
                        P.disconnect_from_network();
                    }
                }
                return;
            }
            O        = P_list[1];
            this.loc = null;
            this.powernet.remove_cable(this);
            Task13.Schedule(0, (Task13.Closure)(() => {
                if (Lang13.Bool(O) && !Lang13.Bool(GlobalFuncs.qdeleted(O)))
                {
                    newPN = new Powernet();
                    GlobalFuncs.propagate_network(O, newPN);
                }
                return;
            }));

            if (this.d1 == 0)
            {
                foreach (dynamic _b in Lang13.Enumerate(T1, typeof(Obj_Machinery_Power)))
                {
                    P2 = _b;


                    if (!P2.connect_to_network())
                    {
                        P2.disconnect_from_network();
                    }
                }
            }
            return;
        }