Example #1
0
        // Function from file: telecomunications.dm
        public override void initialize(  )
        {
            Obj_Machinery_Telecomms T  = null;
            Obj_Machinery_Telecomms T2 = null;


            if (this.autolinkers.len != 0)
            {
                if (!this.long_range_link)
                {
                    foreach (dynamic _a in Lang13.Enumerate(GlobalFuncs.ultra_range(20, this, true), typeof(Obj_Machinery_Telecomms)))
                    {
                        T = _a;

                        this.add_link(T);
                    }
                }
                else
                {
                    foreach (dynamic _b in Lang13.Enumerate(GlobalVars.telecomms_list, typeof(Obj_Machinery_Telecomms)))
                    {
                        T2 = _b;

                        this.add_link(T2);
                    }
                }
            }
            return;
        }
Example #2
0
        // Function from file: processor.dm
        public override void receive_information(Signal signal = null, Obj_Machinery_Telecomms machine_from = null)
        {
            if (this.is_freq_listening(signal))
            {
                if (this.process_mode)
                {
                    signal.data["compression"] = 0;
                }
                else
                {
                    signal.data["compression"] = 100;
                }

                if (machine_from is Obj_Machinery_Telecomms_Bus)
                {
                    this.relay_direct_information(signal, machine_from);
                }
                else
                {
                    signal.data["slow"] += Rand13.Int(5, 10);
                    this.relay_information(signal, "/obj/machinery/telecomms/server");
                }
            }
            return;
        }
Example #3
0
        // Function from file: telecomunications.dm
        public void add_link(Obj_Machinery_Telecomms T = null)
        {
            dynamic position   = null;
            dynamic T_position = null;
            dynamic x          = null;

            position   = GlobalFuncs.get_turf(this);
            T_position = GlobalFuncs.get_turf(T);

            if (position.z == T_position.z || this.long_range_link && T.long_range_link)
            {
                if (this != T)
                {
                    foreach (dynamic _a in Lang13.Enumerate(this.autolinkers))
                    {
                        x = _a;


                        if (T.autolinkers.Contains(x))
                        {
                            this.links.Or(T);
                            break;
                        }
                    }
                }
            }
            return;
        }
 // Function from file: relay.dm
 public override void receive_information(Signal signal = null, Obj_Machinery_Telecomms machine_from = null)
 {
     if (this.can_send(signal))
     {
         signal.data["level"] |= this.listening_level;
     }
     return;
 }
Example #5
0
        // Function from file: server.dm
        public override void receive_information(Signal signal = null, Obj_Machinery_Telecomms machine_from = null)
        {
            CommLogEntry log        = null;
            string       identifier = null;
            int?         can_send   = null;


            if (Lang13.Bool(signal.data["message"]))
            {
                if (this.is_freq_listening(signal))
                {
                    if (this.traffic > 0)
                    {
                        this.totaltraffic += this.traffic;
                    }

                    if (Convert.ToInt32(signal.data["type"]) != 4)
                    {
                        this.update_logs();
                        log = new CommLogEntry();
                        log.parameters["mobtype"]  = signal.data["mobtype"];
                        log.parameters["job"]      = signal.data["job"];
                        log.parameters["key"]      = signal.data["key"];
                        log.parameters["message"]  = signal.data["message"];
                        log.parameters["name"]     = signal.data["name"];
                        log.parameters["realname"] = signal.data["realname"];
                        log.parameters["uspeech"]  = signal.data["languages"] & 1;

                        if (Convert.ToDouble(signal.data["compression"]) > 0)
                        {
                            log.parameters["message"]  = GlobalFuncs.Gibberish(signal.data["message"], Convert.ToInt32(signal.data["compression"] + 50));
                            log.parameters["job"]      = GlobalFuncs.Gibberish(signal.data["job"], Convert.ToInt32(signal.data["compression"] + 50));
                            log.parameters["name"]     = GlobalFuncs.Gibberish(signal.data["name"], Convert.ToInt32(signal.data["compression"] + 50));
                            log.parameters["realname"] = GlobalFuncs.Gibberish(signal.data["realname"], Convert.ToInt32(signal.data["compression"] + 50));
                            log.input_type             = "Corrupt File";
                        }
                        this.log_entries.Add(log);

                        if (!this.stored_names.Contains(signal.data["name"]))
                        {
                            this.stored_names.Add(signal.data["name"]);
                        }
                        this.logs++;
                        signal.data["server"] = this;
                        identifier            = String13.NumberToString(Rand13.Int(-1000, 1000) + Game13.time);
                        log.name = "data packet (" + Num13.Md5(identifier) + ")";
                    }
                    can_send = this.relay_information(signal, "/obj/machinery/telecomms/hub");

                    if (!Lang13.Bool(can_send))
                    {
                        this.relay_information(signal, "/obj/machinery/telecomms/broadcaster");
                    }
                }
            }
            return;
        }
Example #6
0
        // Function from file: bus.dm
        public override void receive_information(Signal signal = null, Obj_Machinery_Telecomms machine_from = null)
        {
            int?    send_to_processor = null;
            ByTable try_send          = null;
            int     i        = 0;
            dynamic send     = null;
            int?    can_send = null;


            if (this.is_freq_listening(signal))
            {
                if (Lang13.Bool(this.change_frequency))
                {
                    if (signal.frequency != GlobalVars.SYND_FREQ)
                    {
                        signal.frequency = this.change_frequency;
                    }
                }

                if (!(machine_from is Obj_Machinery_Telecomms_Processor) && machine_from != this)
                {
                    send_to_processor = this.relay_information(signal, "/obj/machinery/telecomms/processor");

                    if (Lang13.Bool(send_to_processor))
                    {
                        return;
                    }
                    signal.data["slow"] += Rand13.Int(1, 5);
                    this.receive_information(signal, this);
                }
                try_send = new ByTable(new object [] { "/obj/machinery/telecomms/server", "/obj/machinery/telecomms/hub", "/obj/machinery/telecomms/broadcaster", "/obj/machinery/telecomms/bus" });
                i        = 0;

                foreach (dynamic _a in Lang13.Enumerate(try_send))
                {
                    send = _a;


                    if (i != 0)
                    {
                        signal.data["slow"] += Rand13.Int(0, 1);
                    }
                    i++;
                    can_send = this.relay_information(signal, send);

                    if (Lang13.Bool(can_send))
                    {
                        break;
                    }
                }
            }
            return;
        }
        // Function from file: communications_blackout.dm
        public override bool start(  )
        {
            Obj_Machinery_Telecomms T = null;


            foreach (dynamic _a in Lang13.Enumerate(GlobalVars.telecomms_list, typeof(Obj_Machinery_Telecomms)))
            {
                T = _a;

                T.emp_act(1);
            }
            return(false);
        }
Example #8
0
        // Function from file: telecomunications.dm
        public override dynamic Destroy(  )
        {
            Obj_Machinery_Telecomms comm = null;

            GlobalVars.telecomms_list.Remove(this);

            foreach (dynamic _a in Lang13.Enumerate(GlobalVars.telecomms_list, typeof(Obj_Machinery_Telecomms)))
            {
                comm = _a;

                comm.links.Remove(this);
            }
            this.links = new ByTable();
            return(base.Destroy());
        }
Example #9
0
 // Function from file: hub.dm
 public override void receive_information(Signal signal = null, Obj_Machinery_Telecomms machine_from = null)
 {
     if (this.is_freq_listening(signal))
     {
         if (machine_from is Obj_Machinery_Telecomms_Receiver)
         {
             this.relay_information(signal, "/obj/machinery/telecomms/bus", true);
         }
         else
         {
             this.relay_information(signal, "/obj/machinery/telecomms/relay", true);
             this.relay_information(signal, "/obj/machinery/telecomms/broadcaster", true);
         }
     }
     return;
 }
Example #10
0
        // Function from file: telecomunications.dm
        public int?relay_information(Signal signal = null, dynamic filter = null, bool?copysig = null, int?amount = null)
        {
            amount = amount ?? 20;

            int?send_count = null;
            int netlag     = 0;
            Obj_Machinery_Telecomms machine = null;
            Signal copy = null;


            if (!this.on)
            {
                return(null);
            }
            send_count = 0;
            netlag     = Num13.Floor(this.traffic / 50);

            if (netlag > Convert.ToDouble(signal.data["slow"]))
            {
                signal.data["slow"] = netlag;
            }

            foreach (dynamic _a in Lang13.Enumerate(this.links, typeof(Obj_Machinery_Telecomms)))
            {
                machine = _a;


                if (Lang13.Bool(filter) && !Lang13.Bool(((dynamic)Lang13.FindClass(filter)).IsInstanceOfType(machine)))
                {
                    continue;
                }

                if (!machine.on)
                {
                    continue;
                }

                if (Lang13.Bool(amount) && (send_count ?? 0) >= (amount ?? 0))
                {
                    break;
                }

                if (machine.loc.z != this.listening_level)
                {
                    if (!this.long_range_link && !machine.long_range_link)
                    {
                        continue;
                    }
                }
                copy = new Signal();

                if (copysig == true)
                {
                    copy.transmission_method = 2;
                    copy.frequency           = signal.frequency;
                    copy.data = new ByTable()
                                .Set("mob", signal.data["mob"])
                                .Set("mobtype", signal.data["mobtype"])
                                .Set("realname", signal.data["realname"])
                                .Set("name", signal.data["name"])
                                .Set("job", signal.data["job"])
                                .Set("key", signal.data["key"])
                                .Set("vmask", signal.data["vmask"])
                                .Set("compression", signal.data["compression"])
                                .Set("message", signal.data["message"])
                                .Set("radio", signal.data["radio"])
                                .Set("slow", signal.data["slow"])
                                .Set("traffic", signal.data["traffic"])
                                .Set("type", signal.data["type"])
                                .Set("server", signal.data["server"])
                                .Set("reject", signal.data["reject"])
                                .Set("level", signal.data["level"])
                                .Set("spans", signal.data["spans"])
                                .Set("verb_say", signal.data["verb_say"])
                                .Set("verb_ask", signal.data["verb_ask"])
                                .Set("verb_exclaim", signal.data["verb_exclaim"])
                                .Set("verb_yell", signal.data["verb_yell"])
                    ;

                    if (!Lang13.Bool(signal.data["original"]))
                    {
                        copy.data["original"] = signal;
                    }
                    else
                    {
                        copy.data["original"] = signal.data["original"];
                    }
                }
                else
                {
                    copy = null;
                }
                send_count++;

                if (machine.is_freq_listening(signal))
                {
                    machine.traffic++;
                }

                if (copysig == true && copy != null)
                {
                    machine.receive_information(copy, this);
                }
                else
                {
                    machine.receive_information(signal, this);
                }
            }

            if ((send_count ?? 0) > 0 && this.is_freq_listening(signal))
            {
                this.traffic++;
            }
            return(send_count);
        }
Example #11
0
        // Function from file: logbrowser.dm
        public override dynamic Topic(string href = null, ByTable href_list = null, dynamic hsrc = null)
        {
            Obj_Machinery_Telecomms        T  = null;
            Obj_Machinery_Telecomms_Server T2 = null;
            dynamic D      = null;
            string  newnet = null;


            if (Lang13.Bool(base.Topic(href, href_list, (object)(hsrc))))
            {
                return(null);
            }
            this.add_fingerprint(Task13.User);
            Task13.User.set_machine(this);

            if (Lang13.Bool(href_list["viewserver"]))
            {
                this.screen = true;

                foreach (dynamic _a in Lang13.Enumerate(this.servers, typeof(Obj_Machinery_Telecomms)))
                {
                    T = _a;


                    if (T.id == href_list["viewserver"])
                    {
                        this.SelectedServer = T;
                        break;
                    }
                }
            }

            if (Lang13.Bool(href_list["operation"]))
            {
                dynamic _c = href_list["operation"];                 // Was a switch-case, sorry for the mess.
                if (_c == "release")
                {
                    this.servers = new ByTable();
                    this.screen  = false;
                }
                else if (_c == "mainmenu")
                {
                    this.screen = false;
                }
                else if (_c == "scan")
                {
                    if (this.servers.len > 0)
                    {
                        this.temp = "<font color = #D70B00>- FAILED: CANNOT PROBE WHEN BUFFER FULL -</font color>";
                    }
                    else
                    {
                        foreach (dynamic _b in Lang13.Enumerate(GlobalFuncs.ultra_range(25, this), typeof(Obj_Machinery_Telecomms_Server)))
                        {
                            T2 = _b;


                            if (T2.network == this.network)
                            {
                                this.servers.Add(T2);
                            }
                        }

                        if (!(this.servers.len != 0))
                        {
                            this.temp = "<font color = #D70B00>- FAILED: UNABLE TO LOCATE SERVERS IN [" + this.network + "] -</font color>";
                        }
                        else
                        {
                            this.temp = "<font color = #336699>- " + this.servers.len + " SERVERS PROBED & BUFFERED -</font color>";
                        }
                        this.screen = false;
                    }
                }
            }

            if (Lang13.Bool(href_list["delete"]))
            {
                if (!this.allowed(Task13.User) && !Lang13.Bool(this.emagged))
                {
                    Task13.User.WriteMsg("<span class='danger'>ACCESS DENIED.</span>");
                    return(null);
                }

                if (this.SelectedServer != null)
                {
                    D         = ((dynamic)this.SelectedServer).log_entries[String13.ParseNumber(href_list["delete"])];
                    this.temp = "<font color = #336699>- DELETED ENTRY: " + D.name + " -</font color>";
                    ((dynamic)this.SelectedServer).log_entries.Remove(D);
                    GlobalFuncs.qdel(D);
                }
                else
                {
                    this.temp = "<font color = #D70B00>- FAILED: NO SELECTED MACHINE -</font color>";
                }
            }

            if (Lang13.Bool(href_list["network"]))
            {
                newnet = GlobalFuncs.stripped_input(Task13.User, "Which network do you want to view?", "Comm Monitor", this.network);

                if (Lang13.Bool(newnet) && (Map13.FetchInRange(this, 1).Contains(Task13.User) || Task13.User is Mob_Living_Silicon))
                {
                    if (Lang13.Length(newnet) > 15)
                    {
                        this.temp = "<font color = #D70B00>- FAILED: NETWORK TAG STRING TOO LENGHTLY -</font color>";
                    }
                    else
                    {
                        this.network = newnet;
                        this.screen  = false;
                        this.servers = new ByTable();
                        this.temp    = "<font color = #336699>- NEW NETWORK TAG SET IN ADDRESS [" + this.network + "] -</font color>";
                    }
                }
            }
            this.updateUsrDialog();
            return(null);
        }
Example #12
0
        // Function from file: logbrowser.dm
        public override dynamic attack_hand(dynamic a = null, bool?b = null, bool?c = null)
        {
            string dat = null;
            Obj_Machinery_Telecomms T = null;
            int          i            = 0;
            CommLogEntry C            = null;
            string       race         = null;
            string       language     = null;
            dynamic      mobtype      = null;
            dynamic      humans       = null;
            dynamic      monkeys      = null;
            dynamic      silicons     = null;
            dynamic      slimes       = null;
            dynamic      animals      = null;


            if (Lang13.Bool(base.attack_hand((object)(a), b, c)))
            {
                return(null);
            }
            ((Mob)a).set_machine(this);
            dat = "<TITLE>Telecommunication Server Monitor</TITLE><center><b>Telecommunications Server Monitor</b></center>";

            switch ((bool)(this.screen))
            {
            case false:
                dat += "<br>" + this.temp + "<br>";
                dat += new Txt("<br>Current Network: <a href='?src=").Ref(this).str(";network=1'>").item(this.network).str("</a><br>").ToString();

                if (this.servers.len != 0)
                {
                    dat += "<br>Detected Telecommunication Servers:<ul>";

                    foreach (dynamic _a in Lang13.Enumerate(this.servers, typeof(Obj_Machinery_Telecomms)))
                    {
                        T = _a;

                        dat += new Txt("<li><a href='?src=").Ref(this).str(";viewserver=").item(T.id).str("'>").Ref(T).str(" ").item(T.name).str("</a> (").item(T.id).str(")</li>").ToString();
                    }
                    dat += "</ul>";
                    dat += new Txt("<br><a href='?src=").Ref(this).str(";operation=release'>[Flush Buffer]</a>").ToString();
                }
                else
                {
                    dat += new Txt("<br>No servers detected. Scan for servers: <a href='?src=").Ref(this).str(";operation=scan'>[Scan]</a>").ToString();
                }
                break;

            case true:
                dat += "<br>" + this.temp + "<br>";
                dat += new Txt("<center><a href='?src=").Ref(this).str(";operation=mainmenu'>[Main Menu]</a>     <a href='?src=").Ref(this).str(";operation=refresh'>[Refresh]</a></center>").ToString();
                dat += "<br>Current Network: " + this.network;
                dat += "<br>Selected Server: " + this.SelectedServer.id;

                if (Convert.ToDouble(((dynamic)this.SelectedServer).totaltraffic) >= 1024)
                {
                    dat += "<br>Total recorded traffic: " + Num13.Floor(Convert.ToDouble(((dynamic)this.SelectedServer).totaltraffic / 1024)) + " Terrabytes<br><br>";
                }
                else
                {
                    dat += "<br>Total recorded traffic: " + ((dynamic)this.SelectedServer).totaltraffic + " Gigabytes<br><br>";
                }
                dat += "Stored Logs: <ol>";
                i    = 0;

                foreach (dynamic _b in Lang13.Enumerate(((dynamic)this.SelectedServer).log_entries, typeof(CommLogEntry)))
                {
                    C = _b;

                    i++;

                    if (C.input_type == "Speech File")
                    {
                        dat     += new Txt("<li><font color = #008F00>").item(C.name).str("</font color>  <font color = #FF0000><a href='?src=").Ref(this).str(";delete=").item(i).str("'>[X]</a></font color><br>").ToString();
                        race     = null;
                        language = "Human";
                        mobtype  = C.parameters["mobtype"];
                        humans   = Lang13.GetTypes(typeof(Mob_Living_Carbon_Human), typeof(Mob_Living_Carbon_Brain));
                        monkeys  = Lang13.GetTypes(typeof(Mob_Living_Carbon_Monkey));
                        silicons = Lang13.GetTypes(typeof(Mob_Living_Silicon));
                        slimes   = Lang13.GetTypes(typeof(Mob_Living_SimpleAnimal_Slime));
                        animals  = Lang13.GetTypes(typeof(Mob_Living_SimpleAnimal));

                        if (Lang13.Bool(humans.Contains(mobtype)))
                        {
                            race     = "Humanoid";
                            language = race;
                        }
                        else if (Lang13.Bool(slimes.Contains(mobtype)))
                        {
                            race     = "Slime";
                            language = race;
                        }
                        else if (Lang13.Bool(monkeys.Contains(mobtype)))
                        {
                            race     = "Monkey";
                            language = race;
                        }
                        else if (Lang13.Bool(((dynamic)(Lang13.Bool(silicons) || C.parameters["job"] == "AI")).Contains(mobtype)))
                        {
                            race     = "Artificial Life";
                            language = "Humanoid";
                        }
                        else if (mobtype is Obj)
                        {
                            race     = "Machinery";
                            language = race;
                        }
                        else if (Lang13.Bool(animals.Contains(mobtype)))
                        {
                            race     = "Domestic Animal";
                            language = race;
                        }
                        else
                        {
                            race     = "<i>Unidentifiable</i>";
                            language = race;
                        }

                        if (language == "Humanoid" || this.universal_translate || Lang13.Bool(C.parameters["uspeech"]))
                        {
                            dat += "<u><font color = #18743E>Data type</font color></u>: " + C.input_type + "<br>";
                            dat += "<u><font color = #18743E>Source</font color></u>: " + C.parameters["name"] + " (Job: " + C.parameters["job"] + ")<br>";
                            dat += "<u><font color = #18743E>Class</font color></u>: " + race + "<br>";
                            dat += "<u><font color = #18743E>Contents</font color></u>: \"" + C.parameters["message"] + "\"<br>";
                        }
                        else
                        {
                            dat += "<u><font color = #18743E>Data type</font color></u>: Audio File<br>";
                            dat += "<u><font color = #18743E>Source</font color></u>: <i>Unidentifiable</i><br>";
                            dat += "<u><font color = #18743E>Class</font color></u>: " + race + "<br>";
                            dat += "<u><font color = #18743E>Contents</font color></u>: <i>Unintelligble</i><br>";
                        }
                        dat += "</li><br>";
                    }
                    else if (C.input_type == "Execution Error")
                    {
                        dat += new Txt("<li><font color = #990000>").item(C.name).str("</font color>  <font color = #FF0000><a href='?src=").Ref(this).str(";delete=").item(i).str("'>[X]</a></font color><br>").ToString();
                        dat += "<u><font color = #787700>Output</font color></u>: \"" + C.parameters["message"] + "\"<br>";
                        dat += "</li><br>";
                    }
                }
                dat += "</ol>";
                break;
            }
            Interface13.Browse(a, dat, "window=comm_monitor;size=575x400");
            GlobalFuncs.onclose(a, "server_control");
            this.temp = "";
            return(null);
        }
Example #13
0
        // Function from file: telemonitor.dm
        public override dynamic Topic(string href = null, ByTable href_list = null, dynamic hsrc = null)
        {
            Obj_Machinery_Telecomms T  = null;
            Obj_Machinery_Telecomms T2 = null;
            string newnet = null;


            if (Lang13.Bool(base.Topic(href, href_list, (object)(hsrc))))
            {
                return(null);
            }
            this.add_fingerprint(Task13.User);
            Task13.User.set_machine(this);

            if (Lang13.Bool(href_list["viewmachine"]))
            {
                this.screen = true;

                foreach (dynamic _a in Lang13.Enumerate(this.machinelist, typeof(Obj_Machinery_Telecomms)))
                {
                    T = _a;


                    if (T.id == href_list["viewmachine"])
                    {
                        this.SelectedMachine = T;
                        break;
                    }
                }
            }

            if (Lang13.Bool(href_list["operation"]))
            {
                dynamic _c = href_list["operation"];                 // Was a switch-case, sorry for the mess.
                if (_c == "release")
                {
                    this.machinelist = new ByTable();
                    this.screen      = false;
                }
                else if (_c == "mainmenu")
                {
                    this.screen = false;
                }
                else if (_c == "probe")
                {
                    if (this.machinelist.len > 0)
                    {
                        this.temp = "<font color = #D70B00>- FAILED: CANNOT PROBE WHEN BUFFER FULL -</font color>";
                    }
                    else
                    {
                        foreach (dynamic _b in Lang13.Enumerate(GlobalFuncs.ultra_range(25, this), typeof(Obj_Machinery_Telecomms)))
                        {
                            T2 = _b;


                            if (T2.network == this.network)
                            {
                                this.machinelist.Add(T2);
                            }
                        }

                        if (!(this.machinelist.len != 0))
                        {
                            this.temp = "<font color = #D70B00>- FAILED: UNABLE TO LOCATE NETWORK ENTITIES IN [" + this.network + "] -</font color>";
                        }
                        else
                        {
                            this.temp = "<font color = #336699>- " + this.machinelist.len + " ENTITIES LOCATED & BUFFERED -</font color>";
                        }
                        this.screen = false;
                    }
                }
            }

            if (Lang13.Bool(href_list["network"]))
            {
                newnet = GlobalFuncs.stripped_input(Task13.User, "Which network do you want to view?", "Comm Monitor", this.network);

                if (Lang13.Bool(newnet) && (Map13.FetchInRange(this, 1).Contains(Task13.User) || Task13.User is Mob_Living_Silicon))
                {
                    if (Lang13.Length(newnet) > 15)
                    {
                        this.temp = "<font color = #D70B00>- FAILED: NETWORK TAG STRING TOO LENGHTLY -</font color>";
                    }
                    else
                    {
                        this.network     = newnet;
                        this.screen      = false;
                        this.machinelist = new ByTable();
                        this.temp        = "<font color = #336699>- NEW NETWORK TAG SET IN ADDRESS [" + this.network + "] -</font color>";
                    }
                }
            }
            this.updateUsrDialog();
            return(null);
        }
Example #14
0
        // Function from file: broadcaster.dm
        public override void receive_information(Signal signal = null, Obj_Machinery_Telecomms machine_from = null)
        {
            dynamic original       = null;
            string  signal_message = null;


            if (Lang13.Bool(signal.data["reject"]))
            {
                return;
            }

            if (Lang13.Bool(signal.data["message"]))
            {
                signal.data["done"] = 1;
                original            = signal.data["original"];

                if (Lang13.Bool(original))
                {
                    original.data["done"]        = 1;
                    original.data["compression"] = signal.data["compression"];
                    original.data["level"]       = signal.data["level"];
                }
                signal_message = "" + signal.frequency + ":" + signal.data["message"] + ":" + signal.data["realname"];

                if (GlobalVars.recentmessages.Contains(signal_message))
                {
                    return;
                }
                GlobalVars.recentmessages.Add(signal_message);

                if (Convert.ToDouble(signal.data["slow"]) > 0)
                {
                    Task13.Sleep(Convert.ToInt32(signal.data["slow"]));
                }
                signal.data["level"] |= this.listening_level;

                if (Lang13.Bool(signal.data["type"]) == false)
                {
                    GlobalFuncs.Broadcast_Message(signal.data["mob"], Lang13.Bool(signal.data["vmask"]), signal.data["radio"], signal.data["message"], signal.data["name"], signal.data["job"], signal.data["realname"], 0, Lang13.Bool(signal.data["compression"]), signal.data["level"], signal.frequency, signal.data["spans"], signal.data["verb_say"], signal.data["verb_ask"], signal.data["verb_exclaim"], signal.data["verb_yell"]);
                }

                if (Lang13.Bool(signal.data["type"]) == true)
                {
                    GlobalFuncs.Broadcast_SimpleMessage(signal.data["name"], signal.frequency, signal.data["message"], null, null, Lang13.Bool(signal.data["compression"]), this.listening_level);
                }

                if (Convert.ToInt32(signal.data["type"]) == 2)
                {
                    GlobalFuncs.Broadcast_Message(signal.data["mob"], Lang13.Bool(signal.data["vmask"]), signal.data["radio"], signal.data["message"], signal.data["name"], signal.data["job"], signal.data["realname"], 4, Lang13.Bool(signal.data["compression"]), signal.data["level"], signal.frequency, signal.data["spans"], signal.data["verb_say"], signal.data["verb_ask"], signal.data["verb_exclaim"], signal.data["verb_yell"]);
                }

                if (!GlobalVars.message_delay)
                {
                    GlobalVars.message_delay = true;
                    Task13.Schedule(10, (Task13.Closure)(() => {
                        GlobalVars.message_delay  = false;
                        GlobalVars.recentmessages = new ByTable();
                        return;
                    }));
                }
                Icon13.Flick("broadcaster_send", this);
            }
            return;
        }
Example #15
0
        // Function from file: machine_interactions.dm
        public override dynamic attack_hand(dynamic a = null, bool?b = null, bool?c = null)
        {
            dynamic P   = null;
            string  dat = null;
            int     i   = 0;
            Obj_Machinery_Telecomms T = null;
            dynamic x  = null;
            dynamic T2 = null;


            if (!(a is Mob_Living_Silicon))
            {
                if (!(((Mob)a).get_active_hand() is Obj_Item_Device_Multitool))
                {
                    return(null);
                }
            }

            if ((this.stat & 3) != 0)
            {
                return(null);
            }
            P = this.get_multitool(a);
            ((Mob)a).set_machine(this);
            dat  = "<font face = \"Courier\"><HEAD><TITLE>" + this.name + "</TITLE></HEAD><center><H3>" + this.name + " Access</H3></center>";
            dat += "<br>" + this.temp + "<br>";
            dat += new Txt("<br>Power Status: <a href='?src=").Ref(this).str(";input=toggle'>").item((this.toggled ? "On" : "Off")).str("</a>").ToString();

            if (this.on && this.toggled)
            {
                if (this.id != "" && Lang13.Bool(this.id))
                {
                    dat += new Txt("<br>Identification String: <a href='?src=").Ref(this).str(";input=id'>").item(this.id).str("</a>").ToString();
                }
                else
                {
                    dat += new Txt("<br>Identification String: <a href='?src=").Ref(this).str(";input=id'>NULL</a>").ToString();
                }
                dat += new Txt("<br>Network: <a href='?src=").Ref(this).str(";input=network'>").item(this.network).str("</a>").ToString();
                dat += "<br>Prefabrication: " + (this.autolinkers.len != 0 ? "TRUE" : "FALSE");

                if (this.v_hide)
                {
                    dat += "<br>Shadow Link: ACTIVE</a>";
                }
                dat += this.Options_Menu();
                dat += "<br>Linked Network Entities: <ol>";
                i    = 0;

                foreach (dynamic _a in Lang13.Enumerate(this.links, typeof(Obj_Machinery_Telecomms)))
                {
                    T = _a;

                    i++;

                    if (T.v_hide && !this.v_hide)
                    {
                        continue;
                    }
                    dat += new Txt("<li>").Ref(T).str(" ").item(T.name).str(" (").item(T.id).str(")  <a href='?src=").Ref(this).str(";unlink=").item(i).str("'>[X]</a></li>").ToString();
                }
                dat += "</ol>";
                dat += "<br>Filtering Frequencies: ";
                i    = 0;

                if (Lang13.Length(this.freq_listening) != 0)
                {
                    foreach (dynamic _b in Lang13.Enumerate(this.freq_listening))
                    {
                        x = _b;

                        i++;

                        if (i < Lang13.Length(this.freq_listening))
                        {
                            dat += new Txt().item(GlobalFuncs.format_frequency(x)).str(" GHz<a href='?src=").Ref(this).str(";delete=").item(x).str("'>[X]</a>; ").ToString();
                        }
                        else
                        {
                            dat += new Txt().item(GlobalFuncs.format_frequency(x)).str(" GHz<a href='?src=").Ref(this).str(";delete=").item(x).str("'>[X]</a>").ToString();
                        }
                    }
                }
                else
                {
                    dat += "NONE";
                }
                dat += new Txt("<br>  <a href='?src=").Ref(this).str(";input=freq'>[Add Filter]</a>").ToString();
                dat += "<hr>";

                if (Lang13.Bool(P))
                {
                    T2 = P.buffer;

                    if (T2 is Obj_Machinery_Telecomms)
                    {
                        dat += new Txt("<br><br>MULTITOOL BUFFER: ").item(T2).str(" (").item(T2.id).str(") <a href='?src=").Ref(this).str(";link=1'>[Link]</a> <a href='?src=").Ref(this).str(";flush=1'>[Flush]").ToString();
                    }
                    else
                    {
                        dat += new Txt("<br><br>MULTITOOL BUFFER: <a href='?src=").Ref(this).str(";buffer=1'>[Add Machine]</a>").ToString();
                    }
                }
            }
            dat      += "</font>";
            this.temp = "";
            Interface13.Browse(a, dat, "window=tcommachine;size=520x500;can_resize=0");
            GlobalFuncs.onclose(a, "dormitory");
            return(null);
        }
Example #16
0
        // Function from file: telemonitor.dm
        public override dynamic attack_hand(dynamic a = null, bool?b = null, bool?c = null)
        {
            string dat = null;
            Obj_Machinery_Telecomms T  = null;
            Obj_Machinery_Telecomms T2 = null;


            if (Lang13.Bool(base.attack_hand((object)(a), b, c)))
            {
                return(null);
            }
            ((Mob)a).set_machine(this);
            dat = "<TITLE>Telecommunications Monitor</TITLE><center><b>Telecommunications Monitor</b></center>";

            switch ((bool)(this.screen))
            {
            case false:
                dat += "<br>" + this.temp + "<br><br>";
                dat += new Txt("<br>Current Network: <a href='?src=").Ref(this).str(";network=1'>").item(this.network).str("</a><br>").ToString();

                if (this.machinelist.len != 0)
                {
                    dat += "<br>Detected Network Entities:<ul>";

                    foreach (dynamic _a in Lang13.Enumerate(this.machinelist, typeof(Obj_Machinery_Telecomms)))
                    {
                        T = _a;

                        dat += new Txt("<li><a href='?src=").Ref(this).str(";viewmachine=").item(T.id).str("'>").Ref(T).str(" ").item(T.name).str("</a> (").item(T.id).str(")</li>").ToString();
                    }
                    dat += "</ul>";
                    dat += new Txt("<br><a href='?src=").Ref(this).str(";operation=release'>[Flush Buffer]</a>").ToString();
                }
                else
                {
                    dat += new Txt("<a href='?src=").Ref(this).str(";operation=probe'>[Probe Network]</a>").ToString();
                }
                break;

            case true:
                dat += "<br>" + this.temp + "<br>";
                dat += new Txt("<center><a href='?src=").Ref(this).str(";operation=mainmenu'>[Main Menu]</a></center>").ToString();
                dat += "<br>Current Network: " + this.network + "<br>";
                dat += "Selected Network Entity: " + this.SelectedMachine.name + " (" + this.SelectedMachine.id + ")<br>";
                dat += "Linked Entities: <ol>";

                foreach (dynamic _b in Lang13.Enumerate(this.SelectedMachine.links, typeof(Obj_Machinery_Telecomms)))
                {
                    T2 = _b;


                    if (!T2.v_hide)
                    {
                        dat += new Txt("<li><a href='?src=").Ref(this).str(";viewmachine=").item(T2.id).str("'>").Ref(T2.id).str(" ").item(T2.name).str("</a> (").item(T2.id).str(")</li>").ToString();
                    }
                }
                dat += "</ol>";
                break;
            }
            Interface13.Browse(a, dat, "window=comm_monitor;size=575x400");
            GlobalFuncs.onclose(a, "server_control");
            this.temp = "";
            return(null);
        }
Example #17
0
 // Function from file: telecomunications.dm
 public void relay_direct_information(Signal signal = null, Obj_Machinery_Telecomms machine = null)
 {
     machine.receive_information(signal, this);
     return;
 }
Example #18
0
 // Function from file: telecomunications.dm
 public virtual void receive_information(Signal signal = null, Obj_Machinery_Telecomms machine_from = null)
 {
     Lang13.SuperCall(signal, machine_from);
     return;
 }
Example #19
0
        // Function from file: machine_interactions.dm
        public override dynamic Topic(string href = null, ByTable href_list = null, dynamic hsrc = null)
        {
            dynamic P                  = null;
            string  newid              = null;
            string  newnet             = null;
            Obj_Machinery_Telecomms T  = null;
            dynamic newfreq            = null;
            double? x                  = null;
            Obj_Machinery_Telecomms T2 = null;
            Obj_Machinery_Telecomms T3 = null;


            if (Lang13.Bool(base.Topic(href, href_list, (object)(hsrc))))
            {
                return(null);
            }

            if (!(Task13.User is Mob_Living_Silicon))
            {
                if (!(Task13.User.get_active_hand() is Obj_Item_Device_Multitool))
                {
                    return(null);
                }
            }
            P = this.get_multitool(Task13.User);

            if (Lang13.Bool(href_list["input"]))
            {
                dynamic _b = href_list["input"];                 // Was a switch-case, sorry for the mess.
                if (_b == "toggle")
                {
                    this.toggled = !this.toggled;
                    this.temp    = "<font color = #666633>-% " + this + " has been " + (this.toggled ? "activated" : "deactivated") + ".</font color>";
                    this.update_power();
                }
                else if (_b == "id")
                {
                    newid = String13.SubStr(GlobalFuncs.reject_bad_text(Interface13.Input(Task13.User, "Specify the new ID for this machine", this, this.id, null, InputType.Str | InputType.Null)), 1, 1024);

                    if (Lang13.Bool(newid) && this.canAccess(Task13.User))
                    {
                        this.id   = newid;
                        this.temp = "<font color = #666633>-% New ID assigned: \"" + this.id + "\" %-</font color>";
                    }
                }
                else if (_b == "network")
                {
                    newnet = GlobalFuncs.stripped_input(Task13.User, "Specify the new network for this machine. This will break all current links.", this, this.network);

                    if (Lang13.Bool(newnet) && this.canAccess(Task13.User))
                    {
                        if (Lang13.Length(newnet) > 15)
                        {
                            this.temp = "<font color = #666633>-% Too many characters in new network tag %-</font color>";
                        }
                        else
                        {
                            foreach (dynamic _a in Lang13.Enumerate(this.links, typeof(Obj_Machinery_Telecomms)))
                            {
                                T = _a;

                                T.links.Remove(this);
                            }
                            this.network = newnet;
                            this.links   = new ByTable();
                            this.temp    = "<font color = #666633>-% New network tag assigned: \"" + this.network + "\" %-</font color>";
                        }
                    }
                }
                else if (_b == "freq")
                {
                    newfreq = Interface13.Input(Task13.User, "Specify a new frequency to filter (GHz). Decimals assigned automatically.", this, this.network, null, InputType.Num | InputType.Null);

                    if (Lang13.Bool(newfreq) && this.canAccess(Task13.User))
                    {
                        if (String13.FindIgnoreCase(String13.NumberToString(Convert.ToDouble(newfreq)), ".", 1, 0) != 0)
                        {
                            newfreq *= 10;
                        }

                        if (newfreq == GlobalVars.SYND_FREQ)
                        {
                            this.temp = "<font color = #FF0000>-% Error: Interference preventing filtering frequency: \"" + newfreq + " GHz\" %-</font color>";
                        }
                        else if (!this.freq_listening.Contains(newfreq) && Convert.ToDouble(newfreq) < 10000)
                        {
                            this.freq_listening.Add(newfreq);
                            this.temp = "<font color = #666633>-% New frequency filter assigned: \"" + newfreq + " GHz\" %-</font color>";
                        }
                    }
                }
            }

            if (Lang13.Bool(href_list["delete"]))
            {
                x         = String13.ParseNumber(href_list["delete"]);
                this.temp = "<font color = #666633>-% Removed frequency filter " + x + " %-</font color>";
                this.freq_listening.Remove(x);
            }

            if (Lang13.Bool(href_list["unlink"]))
            {
                if ((String13.ParseNumber(href_list["unlink"]) ?? 0) <= Lang13.Length(this.links))
                {
                    T2 = this.links[String13.ParseNumber(href_list["unlink"])];

                    if (T2 != null)
                    {
                        this.temp = new Txt("<font color = #666633>-% Removed ").Ref(T2).str(" ").item(T2.name).str(" from linked entities. %-</font color>").ToString();

                        if (T2.links != null)
                        {
                            T2.links.Remove(this);
                        }
                        this.links.Remove(T2);
                    }
                    else
                    {
                        this.temp = "<font color = #666633>-% Unable to locate machine to unlink from, try again. %-</font color>";
                    }
                }
            }

            if (Lang13.Bool(href_list["link"]))
            {
                if (Lang13.Bool(P))
                {
                    T3 = P.buffer;

                    if (T3 is Obj_Machinery_Telecomms && T3 != this)
                    {
                        if (!T3.links.Contains(this))
                        {
                            T3.links.Add(this);
                        }

                        if (!this.links.Contains(T3))
                        {
                            this.links.Add(T3);
                        }
                        this.temp = new Txt("<font color = #666633>-% Successfully linked with ").Ref(T3).str(" ").item(T3.name).str(" %-</font color>").ToString();
                    }
                    else
                    {
                        this.temp = "<font color = #666633>-% Unable to acquire buffer %-</font color>";
                    }
                }
            }

            if (Lang13.Bool(href_list["buffer"]))
            {
                P.buffer  = this;
                this.temp = new Txt("<font color = #666633>-% Successfully stored ").Ref(P.buffer).str(" ").item(P.buffer.name).str(" in buffer %-</font color>").ToString();
            }

            if (Lang13.Bool(href_list["flush"]))
            {
                this.temp = "<font color = #666633>-% Buffer successfully flushed. %-</font color>";
                P.buffer  = null;
            }
            this.Options_Topic(href, href_list);
            Task13.User.set_machine(this);
            this.updateUsrDialog();
            return(null);
        }