Example #1
0
        // Function from file: movable_screen_objects.dm
        public override dynamic MouseDrop(dynamic over = null, dynamic src_location = null, dynamic over_location = null, string src_control = null, dynamic over_control = null, string _params = null)
        {
            ByTable PM = null;
            ByTable screen_loc_params = null;
            ByTable screen_loc_X      = null;
            ByTable screen_loc_Y      = null;
            double  pix_X             = 0;
            double  pix_Y             = 0;

            PM = String13.ParseUrlParams(_params);

            if (!(PM != null) || !Lang13.Bool(PM["screen-loc"]))
            {
                return(null);
            }
            screen_loc_params = GlobalFuncs.splittext(PM["screen-loc"], ",");
            screen_loc_X      = GlobalFuncs.splittext(screen_loc_params[1], ":");
            screen_loc_Y      = GlobalFuncs.splittext(screen_loc_params[2], ":");

            if (this.snap2grid)
            {
                this.screen_loc = "" + screen_loc_X[1] + "," + screen_loc_Y[1];
            }
            else
            {
                pix_X           = (String13.ParseNumber(screen_loc_X[2]) ?? 0) - 16;
                pix_Y           = (String13.ParseNumber(screen_loc_Y[2]) ?? 0) - 16;
                this.screen_loc = "" + screen_loc_X[1] + ":" + pix_X + "," + screen_loc_Y[1] + ":" + pix_Y;
            }
            this.moved = GlobalVars.TRUE;
            return(null);
        }
Example #2
0
        // Function from file: screen_objects.dm
        public override bool Click(dynamic loc = null, string control = null, string _params = null)
        {
            double?___x = null;
            double?___y = null;


            if (Task13.User is Mob_Living_Carbon_Human && Lang13.Bool(Task13.User.client.prefs.toggles & 32))
            {
                ___x = String13.ParseNumber(String13.ParseUrlParams(_params)["icon-x"]);
                ___y = String13.ParseNumber(String13.ParseUrlParams(_params)["icon-y"]);

                if ((___x ?? 0) <= 16 && (___y ?? 0) <= 16)
                {
                    Task13.User.a_intent_change("harm");
                }
                else if ((___x ?? 0) <= 16 && (___y ?? 0) >= 17)
                {
                    Task13.User.a_intent_change("help");
                }
                else if ((___x ?? 0) >= 17 && (___y ?? 0) <= 16)
                {
                    Task13.User.a_intent_change("grab");
                }
                else if ((___x ?? 0) >= 17 && (___y ?? 0) >= 17)
                {
                    Task13.User.a_intent_change("disarm");
                }
            }
            else
            {
                Task13.User.a_intent_change("right");
            }
            return(false);
        }
        // Function from file: book.dm
        public override dynamic Topic(string href = null, ByTable href_list = null, dynamic hsrc = null)
        {
            double? iconi     = null;
            dynamic biblename = null;
            dynamic B         = null;


            if (Lang13.Bool(href_list["seticon"]) && GlobalVars.ticker != null && !Lang13.Bool(GlobalVars.ticker.Bible_icon_state))
            {
                iconi        = String13.ParseNumber(href_list["seticon"]);
                biblename    = GlobalVars.biblenames[iconi];
                B            = Lang13.FindObj(href_list["src"]);
                B.icon_state = GlobalVars.biblestates[iconi];
                B.item_state = GlobalVars.bibleitemstates[iconi];
                this.setupbiblespecifics(B, Task13.User);

                if (GlobalVars.ticker != null)
                {
                    GlobalVars.ticker.Bible_icon_state = B.icon_state;
                    GlobalVars.ticker.Bible_item_state = B.item_state;
                }
                GlobalFuncs.feedback_set_details("religion_book", "" + biblename);
                Interface13.Browse(Task13.User, null, "window=editicon");
            }
            return(null);
        }
Example #4
0
        // Function from file: cable.dm
        public Obj_Structure_Cable(dynamic loc = null) : base((object)(loc))
        {
            int        dash = 0;
            Ent_Static T    = null;

            // Warning: Super call was HERE! If anything above HERE is needed by the super call, it might break!;
            dash    = String13.FindIgnoreCase(this.icon_state, "-", 1, 0);
            this.d1 = String13.ParseNumber(String13.SubStr(this.icon_state, 1, dash));
            this.d2 = String13.ParseNumber(String13.SubStr(this.icon_state, dash + 1, 0));
            T       = this.loc;

            if (this.level == 1)
            {
                this.hide(Lang13.Bool(((dynamic)T).intact));
            }
            GlobalVars.cable_list.Add(this);

            if (Lang13.Bool(this.d1))
            {
                this.stored = new Obj_Item_Stack_CableCoil(null, 2, this.cable_color);
            }
            else
            {
                this.stored = new Obj_Item_Stack_CableCoil(null, 1, this.cable_color);
            }
            return;
        }
Example #5
0
        // Function from file: computer.dm
        public override dynamic Topic(string href = null, ByTable href_list = null, dynamic hsrc = null)
        {
            Type    areapath = null;
            dynamic area     = null;
            double? safe     = null;


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

            if (!this.Adjacent(Task13.User) && !(Task13.User is Mob_Living_Silicon))
            {
                return(null);
            }
            Task13.User.set_machine(this);
            this.add_fingerprint(Task13.User);

            if (Lang13.Bool(href_list["loadarea"]))
            {
                areapath = Lang13.FindClass(href_list["loadarea"]);

                if (!Lang13.Bool(((dynamic)areapath).IsSubclassOf(typeof(Zone_Holodeck))))
                {
                    return(null);
                }
                area = Lang13.FindObj(areapath);

                if (!(area is Zone_Holodeck))
                {
                    return(null);
                }

                if (area == this.offline_program || this.program_cache.Contains(area) || Lang13.Bool(this.emagged) && this.emag_programs.Contains(area))
                {
                    this.load_program(area);
                }
            }
            else if (href_list.Contains("safety"))
            {
                safe         = String13.ParseNumber(href_list["safety"]);
                this.emagged = !Lang13.Bool(safe) ?1:0;

                if (!Lang13.Bool(this.program))
                {
                    return(null);
                }

                if (Lang13.Bool(safe) && this.emag_programs.Contains(this.program))
                {
                    this.emergency_shutdown();
                }
                this.nerf(safe);
            }
            this.updateUsrDialog();
            return(null);
        }
Example #6
0
        // Function from file: paper.dm
        public override dynamic Topic(string href = null, ByTable href_list = null, dynamic hsrc = null)
        {
            string  id       = null;
            dynamic t        = null;
            dynamic i        = null;
            bool?   iscrayon = null;

            base.Topic(href, href_list, (object)(hsrc));

            if (Task13.User.stat != 0 || Task13.User.restrained())
            {
                return(null);
            }

            if (Lang13.Bool(href_list["write"]))
            {
                id = href_list["write"];
                t  = GlobalFuncs.stripped_multiline_input("Enter what you want to write:", "Write");

                if (!Lang13.Bool(t))
                {
                    return(null);
                }
                i        = Task13.User.get_active_hand();
                iscrayon = false;

                if (!(i is Obj_Item_Weapon_Pen))
                {
                    if (!(i is Obj_Item_Toy_Crayon))
                    {
                        return(null);
                    }
                    iscrayon = true;
                }

                if (!(Map13.GetDistance(this, Task13.User) <= 1) && this.loc != Task13.User && !(this.loc is Obj_Item_Weapon_Clipboard) && this.loc.loc != Task13.User && Task13.User.get_active_hand() != i)
                {
                    return(null);
                }
                t = this.parsepencode(t, i, Task13.User, iscrayon);

                if (t != null)
                {
                    if (id != "end")
                    {
                        this.addtofield(String13.ParseNumber(id), t);
                    }
                    else
                    {
                        this.info += t;
                        this.updateinfolinks();
                    }
                    Interface13.Browse(Task13.User, "<HTML><HEAD><TITLE>" + this.name + "</TITLE></HEAD><BODY>" + this.info_links + "<HR>" + this.stamps + "</BODY></HTML>", "window=" + this.name);
                    this.update_icon();
                }
            }
            return(null);
        }
Example #7
0
        // Function from file: reader.dm
        public ByTable readlist(string text = null, string delimiter = null)
        {
            delimiter = delimiter ?? ",";

            ByTable to_return      = null;
            int     position       = 0;
            int     old_position   = 0;
            int     equal_position = 0;
            string  trim_left      = null;
            dynamic trim_right     = null;

            to_return    = new ByTable();
            old_position = 1;

            do
            {
                position       = this.find_next_delimiter_position(text, old_position, delimiter);
                equal_position = String13.FindIgnoreCase(text, "=", old_position, position);
                trim_left      = this.trim_text(String13.SubStr(text, old_position, (equal_position != 0 ? equal_position : position)), true);
                old_position   = position + 1;

                if (equal_position != 0)
                {
                    trim_right = this.trim_text(String13.SubStr(text, equal_position + 1, position));

                    if (String13.FindIgnoreCase(trim_right, this.quote, 1, 2) != 0)
                    {
                        trim_right = String13.SubStr(trim_right, 2, String13.FindIgnoreCase(trim_right, this.quote, 3, 0));
                    }
                    else if (Lang13.Bool(Lang13.IsNumber(String13.ParseNumber(trim_right))))
                    {
                        trim_right = String13.ParseNumber(trim_right);
                    }
                    else if (trim_right == "null")
                    {
                        trim_right = null;
                    }
                    else if (String13.SubStr(trim_right, 1, 5) == "list")
                    {
                        trim_right = this.readlist(String13.SubStr(trim_right, 6, Lang13.Length(trim_right)));
                    }
                    else if (String13.SubStr(trim_right, 1, 2) == "'")
                    {
                        trim_right = new File(String13.SubStr(trim_right, 2, Lang13.Length(trim_right)));
                    }
                    else if (Lang13.FindClass(trim_right) is Type)
                    {
                        trim_right = Lang13.FindClass(trim_right);
                    }
                    to_return[trim_left] = trim_right;
                }
                else
                {
                    to_return[trim_left] = null;
                }
            } while (position != 0);
            return(to_return);
        }
        // Function from file: chem_heater.dm
        public override int?ui_act(string action = null, ByTable _params = null, Tgui ui = null, UiState state = null)
        {
            int?_default = null;

            dynamic target = null;
            double? adjust = null;


            if (Lang13.Bool(base.ui_act(action, _params, ui, state)))
            {
                return(_default);
            }

            switch ((string)(action))
            {
            case "power":
                this.on  = !Lang13.Bool(this.on) ?1:0;
                _default = GlobalVars.TRUE;
                break;

            case "temperature":
                target = _params["target"];
                adjust = String13.ParseNumber(_params["adjust"]);

                if (target == "input")
                {
                    target = Interface13.Input("New target temperature:", this.name, this.target_temperature, null, null, InputType.Num | InputType.Null);

                    if (!(target == null) && !Lang13.Bool(base.ui_act(action, _params, ui, state)))
                    {
                        _default = GlobalVars.TRUE;
                    }
                }
                else if (Lang13.Bool(adjust))
                {
                    target = (this.target_temperature ?? 0) + (adjust ?? 0);
                }
                else if (String13.ParseNumber(target) != null)
                {
                    target   = String13.ParseNumber(target);
                    _default = GlobalVars.TRUE;
                }

                if (Lang13.Bool(_default))
                {
                    this.target_temperature = Num13.MaxInt(0, Num13.MinInt(Convert.ToInt32(target), 1000));
                }
                break;

            case "eject":
                this.on = GlobalVars.FALSE;
                this.eject_beaker();
                _default = GlobalVars.TRUE;
                break;
            }
            return(_default);
        }
Example #9
0
        private ByTable text2list(string text = null, string delimiter = null)
        {
            ByTable to_return      = null;
            int     position       = 0;
            int     old_position   = 0;
            int     equal_position = 0;
            string  trim_left      = null;
            dynamic trim_right     = null;

            if (delimiter == null)
            {
                delimiter = ",";
            }
            to_return    = new ByTable();
            old_position = 1;
            while (true)               // Was a do-while, sorry for the mess.
            {
                position       = this.find_next_delimiter_position(text, old_position, delimiter);
                equal_position = String13.Find(text, "=", old_position, position);
                trim_left      = this.trim_text(String13.SubStr(text, old_position, (equal_position != 0 ? equal_position : position)), true);
                old_position   = position + 1;
                if (equal_position != 0)
                {
                    trim_right = this.trim_text(String13.SubStr(text, equal_position + 1, position));
                    if (String13.Find(trim_right, this.quote, 1, 2) != 0)
                    {
                        trim_right = String13.SubStr(trim_right, 2, String13.Find(trim_right, this.quote, 3, 0));
                    }
                    else if (Lang13.Bool(Lang13.IsNumber(String13.ParseNumber(trim_right))))
                    {
                        trim_right = String13.ParseNumber(trim_right);
                    }
                    else if (trim_right == "null")
                    {
                        trim_right = null;
                    }
                    else if (String13.SubStr(trim_right, 1, 5) == "list")
                    {
                        trim_right = this.text2list(String13.SubStr(trim_right, 6, Lang13.Length(trim_right)));
                    }
                    else if (String13.SubStr(trim_right, 1, 2) == "'")
                    {
                        trim_right = new File(String13.SubStr(trim_right, 2, Lang13.Length(trim_right)));
                    }
                    to_return[trim_left] = trim_right;
                }
                else
                {
                    to_return[trim_left] = null;
                }
                if (!(position != 0))
                {
                    break;
                }
            }
            return(to_return);
        }
Example #10
0
        // Function from file: seed_extractor.dm
        public override dynamic Topic(string href = null, ByTable href_list = null, dynamic hsrc = null)
        {
            SeedPile N = null;
            Obj      T = null;
            Obj      O = null;


            if (Lang13.Bool(base.Topic(href, href_list, (object)(hsrc))))
            {
                return(null);
            }
            Task13.User.set_machine(this);
            href_list["li"]  = String13.ParseNumber(href_list["li"]);
            href_list["en"]  = String13.ParseNumber(href_list["en"]);
            href_list["ma"]  = String13.ParseNumber(href_list["ma"]);
            href_list["pr"]  = String13.ParseNumber(href_list["pr"]);
            href_list["yi"]  = String13.ParseNumber(href_list["yi"]);
            href_list["pot"] = String13.ParseNumber(href_list["pot"]);

            foreach (dynamic _a in Lang13.Enumerate(this.piles, typeof(SeedPile)))
            {
                N = _a;


                if (href_list["name"] == N.name && Lang13.Bool(href_list["li"]) == N.lifespan && Lang13.Bool(href_list["en"]) == N.endurance && Lang13.Bool(href_list["ma"]) == N.maturation && Lang13.Bool(href_list["pr"]) == N.production && Lang13.Bool(href_list["yi"]) == N.yield && Lang13.Bool(href_list["pot"]) == N.potency)
                {
                    if ((N.amount ?? 0) <= 0)
                    {
                        return(null);
                    }
                    N.amount = Num13.MaxInt((N.amount ?? 0) - 1, 0);

                    if ((N.amount ?? 0) <= 0)
                    {
                        this.piles.Remove(N);
                        GlobalFuncs.qdel(N);
                    }
                    break;
                }
            }

            foreach (dynamic _b in Lang13.Enumerate(this.contents, typeof(Obj)))
            {
                T = _b;

                O = T;

                if (((dynamic)O).plantname == href_list["name"] && ((dynamic)O).lifespan == href_list["li"] && ((dynamic)O).endurance == href_list["en"] && ((dynamic)O).maturation == href_list["ma"] && ((dynamic)O).production == href_list["pr"] && ((dynamic)O).yield == href_list["yi"] && ((dynamic)O).potency == href_list["pot"])
                {
                    O.loc = this.loc;
                    break;
                }
            }
            this.updateUsrDialog();
            return(null);
        }
Example #11
0
        // Function from file: thermomachine.dm
        public override int?ui_act(string action = null, ByTable _params = null, Tgui ui = null, UiState state = null)
        {
            int?_default = null;

            dynamic target = null;
            double? adjust = null;


            if (Lang13.Bool(base.ui_act(action, _params, ui, state)))
            {
                return(_default);
            }

            switch ((string)(action))
            {
            case "power":
                this.on        = !this.on;
                this.use_power = (this.on ?1:0) + 1;
                this.investigate_log("was turned " + (this.on ? "on" : "off") + " by " + GlobalFuncs.key_name(Task13.User), "atmos");
                _default = GlobalVars.TRUE;
                break;

            case "target":
                target = _params["target"];
                adjust = String13.ParseNumber(_params["adjust"]);

                if (target == "input")
                {
                    target = Interface13.Input("Set new target (" + this.min_temperature + "-" + this.max_temperature + " K):", this.name, this.target_temperature, null, null, InputType.Num | InputType.Null);

                    if (!(target == null) && !Lang13.Bool(base.ui_act(action, _params, ui, state)))
                    {
                        _default = GlobalVars.TRUE;
                    }
                }
                else if (Lang13.Bool(adjust))
                {
                    target   = this.target_temperature + (adjust ?? 0);
                    _default = GlobalVars.TRUE;
                }
                else if (String13.ParseNumber(target) != null)
                {
                    target   = String13.ParseNumber(target);
                    _default = GlobalVars.TRUE;
                }

                if (Lang13.Bool(_default))
                {
                    this.target_temperature = Num13.MaxInt(((int)(this.min_temperature)), Num13.MinInt(Convert.ToInt32(target), Convert.ToInt32(this.max_temperature)));
                    this.investigate_log("was set to " + this.target_temperature + " K by " + GlobalFuncs.key_name(Task13.User), "atmos");
                }
                break;
            }
            this.update_icon();
            return(_default);
        }
Example #12
0
        // Function from file: objective_items.dm
        public override bool check_special_completion(Obj T = null)
        {
            double?target_amount = null;
            double?found_amount  = null;

            target_amount = String13.ParseNumber(this.name);
            found_amount  = 0;
            found_amount += (Lang13.Bool(((dynamic)T).air_contents.gases["plasma"]) ? Lang13.Bool(((dynamic)T).air_contents.gases["plasma"][1]) : false) ?1:0;
            return((found_amount ?? 0) >= (target_amount ?? 0));
        }
        // Function from file: message_server.dm
        public void save_all_data_to_sql(  )
        {
            dynamic          round_id     = null;
            DBQuery          query        = null;
            string           sqlrowlist   = null;
            FeedbackVariable FV           = null;
            DBQuery          query_insert = null;


            if (!(this.feedback != null))
            {
                return;
            }
            this.round_end_data_gathering();
            GlobalFuncs.establish_db_connection();

            if (!GlobalVars.dbcon.IsConnected())
            {
                return;
            }
            query = GlobalVars.dbcon.NewQuery("SELECT MAX(round_id) AS round_id FROM " + GlobalFuncs.format_table_name("feedback"));
            query.Execute();

            while (query.NextRow())
            {
                round_id = query.item[1];
            }

            if (!Lang13.Bool(Lang13.IsNumber(round_id)))
            {
                round_id = String13.ParseNumber(round_id);
            }
            round_id++;
            sqlrowlist = "";

            foreach (dynamic _a in Lang13.Enumerate(this.feedback, typeof(FeedbackVariable)))
            {
                FV = _a;


                if (sqlrowlist != "")
                {
                    sqlrowlist += ", ";
                }
                sqlrowlist += "(null, Now(), " + round_id + ", \"" + GlobalFuncs.sanitizeSQL(FV.get_variable()) + "\", " + FV.get_value() + ", \"" + GlobalFuncs.sanitizeSQL(FV.get_details()) + "\")";
            }

            if (sqlrowlist == "")
            {
                return;
            }
            query_insert = GlobalVars.dbcon.NewQuery("INSERT DELAYED IGNORE INTO " + GlobalFuncs.format_table_name("feedback") + " VALUES " + sqlrowlist);
            query_insert.Execute();
            return;
        }
Example #14
0
        // Function from file: tanks.dm
        public override int?ui_act(string action = null, ByTable _params = null, Tgui ui = null, UiState state = null)
        {
            int?_default = null;

            dynamic pressure = null;


            if (Lang13.Bool(base.ui_act(action, _params, ui, state)))
            {
                return(_default);
            }

            switch ((string)(action))
            {
            case "pressure":
                pressure = _params["pressure"];

                if (pressure == "reset")
                {
                    pressure = 16;
                    _default = GlobalVars.TRUE;
                }
                else if (pressure == "min")
                {
                    pressure = 0;
                    _default = GlobalVars.TRUE;
                }
                else if (pressure == "max")
                {
                    pressure = 303.9749755859375;
                    _default = GlobalVars.TRUE;
                }
                else if (pressure == "input")
                {
                    pressure = Interface13.Input("New release pressure (" + 0 + "-" + 303.9749755859375 + " kPa):", this.name, this.distribute_pressure, null, null, InputType.Num | InputType.Null);

                    if (!(pressure == null) && !Lang13.Bool(base.ui_act(action, _params, ui, state)))
                    {
                        _default = GlobalVars.TRUE;
                    }
                }
                else if (String13.ParseNumber(pressure) != null)
                {
                    pressure = String13.ParseNumber(pressure);
                    _default = GlobalVars.TRUE;
                }

                if (Lang13.Bool(_default))
                {
                    this.distribute_pressure = Num13.MaxInt(0, Num13.MinInt(Num13.Floor(Convert.ToDouble(pressure)), ((int)(303.9749755859375))));
                }
                break;
            }
            return(_default);
        }
Example #15
0
        // Function from file: crew.dm
        public override dynamic Topic(string href = null, ByTable href_list = null, dynamic hsrc = null)
        {
            Mob_Living_Silicon_Ai AI = null;
            double?    x             = null;
            double?    y             = null;
            Tile       tile          = null;
            dynamic    C             = null;
            Ent_Static current_loc   = null;


            if (hsrc is HtmlInterfaceClient)
            {
                if (Lang13.Bool(hsrc) && Lang13.Bool(hsrc.client) && Lang13.Bool(hsrc.client.mob) && hsrc.client.mob is Mob_Living_Silicon_Ai)
                {
                    AI = hsrc.client.mob;

                    dynamic _a = href_list["action"];                     // Was a switch-case, sorry for the mess.
                    if (_a == "select_person")
                    {
                        AI.__CallVerb("track", href_list["name"]);
                    }
                    else if (_a == "select_position")
                    {
                        x    = String13.ParseNumber(href_list["x"]);
                        y    = String13.ParseNumber(href_list["y"]);
                        tile = Map13.GetTile(((int)(x ?? 0)), ((int)(y ?? 0)), AI.z);
                        C    = Lang13.FindIn(typeof(Obj_Machinery_Camera), Map13.FetchInRange(tile, 5));

                        if (!Lang13.Bool(C))
                        {
                            C = Lang13.FindIn(typeof(Obj_Machinery_Camera), GlobalFuncs.ultra_range(10, tile));
                        }

                        if (!Lang13.Bool(C))
                        {
                            C = Lang13.FindIn(typeof(Obj_Machinery_Camera), GlobalFuncs.ultra_range(15, tile));
                        }

                        if (Lang13.Bool(C))
                        {
                            current_loc = AI.eyeobj.loc;
                            Task13.Schedule(Num13.MinInt(30, ((int)(Map13.GetDistance(GlobalFuncs.get_turf(C), AI.eyeobj) / 4))), (Task13.Closure)(() => {
                                if (AI != null && AI.eyeobj != null && current_loc == AI.eyeobj.loc)
                                {
                                    AI.switchCamera(C);
                                }
                                return;
                            }));
                        }
                    }
                }
            }
            return(null);
        }
        // Function from file: other_tools.dm
        public override dynamic Topic(string href = null, ByTable href_list = null, dynamic hsrc = null)
        {
            base.Topic(href, href_list, (object)(hsrc));

            if (Lang13.Bool(href_list["mode"]))
            {
                this.mode = String13.ParseNumber(href_list["mode"]);
                GlobalFuncs.send_byjax(this.chassis.occupant, "exosuit.browser", new Txt().Ref(this).ToString(), this.get_equip_info());
            }
            return(null);
        }
Example #17
0
        // Function from file: airlock_controller.dm
        public override dynamic receive_signal(Signal signal = null, bool?receive_method = null, dynamic receive_param = null)
        {
            dynamic receive_tag = null;

            receive_tag = signal.data["tag"];

            if (!Lang13.Bool(receive_tag))
            {
                return(null);
            }

            if (receive_tag == this.sensor_tag)
            {
                if (Lang13.Bool(signal.data["pressure"]))
                {
                    this.sensor_pressure = String13.ParseNumber(signal.data["pressure"]);
                }
            }
            else if (receive_tag == this.exterior_door_tag)
            {
                this.memory["exterior_status"] = signal.data["door_status"];
            }
            else if (receive_tag == this.interior_door_tag)
            {
                this.memory["interior_status"] = signal.data["door_status"];
            }
            else if (receive_tag == this.airpump_tag)
            {
                if (Lang13.Bool(signal.data["power"]))
                {
                    this.memory["pump_status"] = signal.data["direction"];
                }
                else
                {
                    this.memory["pump_status"] = "off";
                }
            }
            else if (receive_tag == this.id_tag)
            {
                dynamic _a = signal.data["command"];                 // Was a switch-case, sorry for the mess.
                if (_a == "cycle")
                {
                    if (this.state < 0)
                    {
                        this.target_state = 2;
                    }
                    else
                    {
                        this.target_state = -2;
                    }
                }
            }
            return(null);
        }
Example #18
0
        // Function from file: topic_input.dm
        public dynamic getNum(string i = null)
        {
            dynamic t = null;

            t = this.get(i);

            if (Lang13.Bool(t))
            {
                t = String13.ParseNumber(t);
            }
            return(Lang13.Bool(Lang13.IsNumber(t)) ? t : null);
        }
        // Function from file: volume_pump.dm
        public override int?ui_act(string action = null, ByTable _params = null, Tgui ui = null, UiState state = null)
        {
            int?_default = null;

            dynamic rate = null;


            if (Lang13.Bool(base.ui_act(action, _params, ui, state)))
            {
                return(_default);
            }

            switch ((string)(action))
            {
            case "power":
                this.on = !Lang13.Bool(this.on) ?1:0;
                this.investigate_log("was turned " + (Lang13.Bool(this.on) ? "on" : "off") + " by " + GlobalFuncs.key_name(Task13.User), "atmos");
                _default = GlobalVars.TRUE;
                break;

            case "rate":
                rate = _params["rate"];

                if (rate == "max")
                {
                    rate     = 200;
                    _default = GlobalVars.TRUE;
                }
                else if (rate == "input")
                {
                    rate = Interface13.Input("New transfer rate (0-" + 200 + " L/s):", this.name, this.transfer_rate, null, null, InputType.Num | InputType.Null);

                    if (!(rate == null) && !Lang13.Bool(base.ui_act(action, _params, ui, state)))
                    {
                        _default = GlobalVars.TRUE;
                    }
                }
                else if (String13.ParseNumber(rate) != null)
                {
                    rate     = String13.ParseNumber(rate);
                    _default = GlobalVars.TRUE;
                }

                if (Lang13.Bool(_default))
                {
                    this.transfer_rate = Num13.MaxInt(0, Num13.MinInt(Convert.ToInt32(rate), 200));
                    this.investigate_log("was set to " + this.transfer_rate + " L/s by " + GlobalFuncs.key_name(Task13.User), "atmos");
                }
                break;
            }
            this.update_icon();
            return(_default);
        }
Example #20
0
        // Function from file: timer.dm
        public override dynamic Topic(string href = null, ByTable href_list = null, dynamic hsrc = null)
        {
            string timer_message = null;
            double?tp            = null;

            base.Topic(href, href_list, (object)(hsrc));

            if (Task13.User.incapacitated() || !(Map13.GetDistance(this.loc, Task13.User) <= 1))
            {
                Interface13.Browse(Task13.User, null, "window=timer");
                GlobalFuncs.onclose(Task13.User, "timer");
                return(null);
            }

            if (Lang13.Bool(href_list["time"]))
            {
                this.timing = String13.ParseNumber(href_list["time"]);

                if (Lang13.Bool(this.timing) && this.holder is Obj_Item_Device_TransferValve)
                {
                    timer_message = new Txt().item(GlobalFuncs.key_name_admin(Task13.User)).str("(<A HREF='?_src_=holder;adminmoreinfo=").Ref(Task13.User).str("'>?</A>) (<A HREF='?_src_=holder;adminplayerobservefollow=").Ref(Task13.User).str("'>FLW</A>) activated ").item(this).str(" attachment on ").item(this.holder).str(".").ToString();
                    GlobalFuncs.message_admins(timer_message);
                    GlobalVars.bombers.Add(timer_message);
                    GlobalFuncs.log_game("" + GlobalFuncs.key_name(Task13.User) + " activated " + this + " attachment for " + this.loc);
                }
                this.update_icon();
            }

            if (Lang13.Bool(href_list["repeat"]))
            {
                this.loop = String13.ParseNumber(href_list["repeat"]);
            }

            if (Lang13.Bool(href_list["tp"]))
            {
                tp              = String13.ParseNumber(href_list["tp"]);
                this.time      += tp ?? 0;
                this.time       = Num13.MinInt(Num13.MaxInt(Num13.Floor(this.time), 1), 600);
                this.saved_time = this.time;
            }

            if (Lang13.Bool(href_list["close"]))
            {
                Interface13.Browse(Task13.User, null, "window=timer");
                return(null);
            }

            if (Task13.User != null)
            {
                this.attack_self(Task13.User);
            }
            return(null);
        }
        // Function from file: disposal-unit.dm
        public override dynamic Topic(string href = null, ByTable href_list = null, dynamic hsrc = null)
        {
            if (Lang13.Bool(base.Topic(href, href_list, (object)(hsrc))))
            {
                return(null);
            }

            if (Task13.User.loc == this)
            {
                Task13.User.WriteMsg("<span class='warning'>You cannot reach the controls from inside!</span>");
                return(null);
            }

            if (this.mode == -1 && !Lang13.Bool(href_list["eject"]))
            {
                Task13.User.WriteMsg(new Txt("<span class='danger'>").The(this).item().str("'s power is disabled.</span>").ToString());
                return(null);
            }
            base.Topic(href, href_list, (object)(hsrc));
            Task13.User.set_machine(this);

            if (Lang13.Bool(href_list["close"]))
            {
                Task13.User.unset_machine();
                Interface13.Browse(Task13.User, null, "window=disposal");
                return(null);
            }

            if (Lang13.Bool(href_list["pump"]))
            {
                if (Lang13.Bool(String13.ParseNumber(href_list["pump"])))
                {
                    this.mode = 1;
                }
                else
                {
                    this.mode = 0;
                }
                this.update();
            }

            if (Lang13.Bool(href_list["handle"]))
            {
                this.flush = String13.ParseNumber(href_list["handle"]);
                this.update();
            }

            if (Lang13.Bool(href_list["eject"]))
            {
                this.eject();
            }
            return(null);
        }
Example #22
0
        // Function from file: holidays.dm
        public override string greet(  )
        {
            double game_age = 0;
            string Fact     = null;

            game_age = (String13.ParseNumber(String13.FormatTime(Game13.timeofday, "YY")) ?? 0) - 3;

            switch ((int)(game_age))
            {
            case 16:
                Fact = " SS13 is now old enough to drive!";
                break;

            case 18:
                Fact = " SS13 is now legal!";
                break;

            case 21:
                Fact = " SS13 can now drink!";
                break;

            case 26:
                Fact = " SS13 can now rent a car!";
                break;

            case 30:
                Fact = " SS13 can now go home and be a family man!";
                break;

            case 40:
                Fact = " SS13 can now suffer a midlife crisis!";
                break;

            case 50:
                Fact = " Happy golden anniversary!";
                break;

            case 65:
                Fact = " SS13 can now start thinking about retirement!";
                break;

            case 96:
                Fact = " Please send a time machine back to pick me up, I need to update the time formatting for this feature!";
                break;
            }

            if (!Lang13.Bool(Fact))
            {
                Fact = " SS13 is now " + game_age + " years old!";
            }
            return("Say 'Happy Birthday' to Space Station 13, first publicly playable on February 16th, 2003!" + Fact);
        }
Example #23
0
        // Function from file: outlet_injector.dm
        public override bool receive_signal(Signal signal = null, bool?receive_method = null, dynamic receive_param = null)
        {
            double? number       = null;
            dynamic air_contents = null;


            if (!Lang13.Bool(signal.data["tag"]) || signal.data["tag"] != this.id || signal.data["sigtype"] != "command")
            {
                return(false);
            }

            if (signal.data.Contains("power"))
            {
                this.on = String13.ParseNumber(signal.data["power"]);
            }

            if (signal.data.Contains("power_toggle"))
            {
                this.on = !Lang13.Bool(this.on) ?1:0;
            }

            if (signal.data.Contains("inject"))
            {
                Task13.Schedule(0, (Task13.Closure)(() => {
                    this.inject();
                    return;
                }));
                return(false);
            }

            if (signal.data.Contains("set_volume_rate"))
            {
                number           = String13.ParseNumber(signal.data["set_volume_rate"]);
                air_contents     = this.airs[1];
                this.volume_rate = Num13.MaxInt(0, Num13.MinInt(((int)(number ?? 0)), Convert.ToInt32(air_contents.volume)));
            }

            if (signal.data.Contains("status"))
            {
                Task13.Schedule(2, (Task13.Closure)(() => {
                    this.broadcast_status();
                    return;
                }));
                return(false);
            }
            Task13.Schedule(2, (Task13.Closure)(() => {
                this.broadcast_status();
                return;
            }));
            this.update_icon();
            return(false);
        }
        // Function from file: pipe_dispenser.dm
        public override dynamic Topic(string href = null, ByTable href_list = null, dynamic hsrc = null)
        {
            Type          p_type = null;
            double?       p_dir  = null;
            Obj_Item_Pipe P      = null;


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

            if (!Lang13.Bool(this.anchored) || !Task13.User.canmove || Task13.User.stat != 0 || Task13.User.restrained() || !(Map13.GetDistance(this.loc, Task13.User) <= 1))
            {
                Interface13.Browse(Task13.User, null, "window=pipedispenser");
                return(1);
            }
            Task13.User.set_machine(this);
            this.add_fingerprint(Task13.User);

            if (Lang13.Bool(href_list["make"]))
            {
                if (!this.wait)
                {
                    p_type = Lang13.FindClass(href_list["make"]);
                    p_dir  = String13.ParseNumber(href_list["dir"]);
                    P      = new Obj_Item_Pipe(this.loc, p_type, p_dir);
                    P.add_fingerprint(Task13.User);
                    this.wait = true;
                    Task13.Schedule(10, (Task13.Closure)(() => {
                        this.wait = false;
                        return;
                    }));
                }
            }

            if (Lang13.Bool(href_list["makemeter"]))
            {
                if (!this.wait)
                {
                    new Obj_Item_PipeMeter(this.loc);
                    this.wait = true;
                    Task13.Schedule(15, (Task13.Closure)(() => {
                        this.wait = false;
                        return;
                    }));
                }
            }
            return(null);
        }
Example #25
0
        // Function from file: firing.dm
        public bool throw_proj(dynamic target = null, dynamic targloc = null, dynamic user = null, string _params = null)
        {
            Ent_Static curloc        = null;
            ByTable    mouse_control = null;

            curloc = user.loc;

            if (!(targloc is Tile) || !(curloc is Tile) || !Lang13.Bool(this.BB))
            {
                return(false);
            }

            if (targloc == curloc)
            {
                if (Lang13.Bool(target))
                {
                    ((Ent_Static)target).bullet_act(this.BB, this.BB.def_zone);
                }
                GlobalFuncs.qdel(this.BB);
                this.BB = null;
                return(true);
            }
            this.BB.loc      = GlobalFuncs.get_turf(user);
            this.BB.starting = GlobalFuncs.get_turf(user);
            this.BB.current  = curloc;
            this.BB.yo       = Convert.ToDouble(targloc.y - curloc.y);
            this.BB.xo       = Convert.ToDouble(targloc.x - curloc.x);

            if (Lang13.Bool(_params))
            {
                mouse_control = String13.ParseUrlParams(_params);

                if (Lang13.Bool(mouse_control["icon-x"]))
                {
                    this.BB.p_x = String13.ParseNumber(mouse_control["icon-x"]);
                }

                if (Lang13.Bool(mouse_control["icon-y"]))
                {
                    this.BB.p_y = String13.ParseNumber(mouse_control["icon-y"]);
                }
            }

            if (Lang13.Bool(this.BB))
            {
                ((Obj_Item_Projectile)this.BB).fire();
            }
            this.BB = null;
            return(true);
        }
Example #26
0
        // Function from file: sortingmachinery.dm
        public override dynamic Topic(string href = null, ByTable href_list = null, dynamic hsrc = null)
        {
            double?n = null;

            this.add_fingerprint(Task13.User);

            if (Lang13.Bool(href_list["nextTag"]))
            {
                n            = String13.ParseNumber(href_list["nextTag"]);
                this.currTag = n;
            }
            this.openwindow(Task13.User);
            return(null);
        }
Example #27
0
        // Function from file: objective_items.dm
        public override bool check_special_completion(Obj T = null)
        {
            double?target_amount = null;
            double?found_amount  = null;

            target_amount = String13.ParseNumber(this.name);
            found_amount  = 0;

            if (Lang13.Bool(((dynamic)this.targetitem).IsInstanceOfType(T)))
            {
                found_amount = Lang13.DoubleNullable(((dynamic)T).amount);
            }
            return((found_amount ?? 0) >= (target_amount ?? 0));
        }
Example #28
0
        // Function from file: artstuff.dm
        public override dynamic attackby(dynamic A = null, dynamic user = null, string _params = null, bool?silent = null, bool?replace_spent = null)
        {
            ByTable click_params   = null;
            double? pixX           = null;
            double? pixY           = null;
            Icon    masterpiece    = null;
            string  thePix         = null;
            Icon    Ico            = null;
            string  theOriginalPix = null;
            dynamic C = null;

            click_params = String13.ParseUrlParams(_params);
            pixX         = String13.ParseNumber(click_params["icon-x"]);
            pixY         = String13.ParseNumber(click_params["icon-y"]);

            if (!(click_params != null) || !Lang13.Bool(click_params["icon-x"]) || !Lang13.Bool(click_params["icon-y"]))
            {
                return(null);
            }

            if (A is Obj_Item_Weapon_Soap || A is Obj_Item_Weapon_ReagentContainers_Glass_Rag)
            {
                masterpiece = new Icon(this.icon, this.icon_state);
                thePix      = masterpiece.GetPixel(pixX, pixY);
                Ico         = this.getGlobalBackup();

                if (!(Ico != null))
                {
                    GlobalFuncs.qdel(masterpiece);
                    return(null);
                }
                theOriginalPix = Ico.GetPixel(pixX, pixY);

                if (thePix != theOriginalPix)
                {
                    this.DrawPixelOn(theOriginalPix, pixX, pixY);
                }
                GlobalFuncs.qdel(masterpiece);
                return(null);
            }

            if (A is Obj_Item_Toy_Crayon)
            {
                C = A;
                this.DrawPixelOn(C.paint_color, pixX, pixY);
                return(null);
            }
            base.attackby((object)(A), (object)(user), _params, silent, replace_spent);
            return(null);
        }
        // Function from file: experimentor.dm
        public ByTable ConvertReqString2List(dynamic source_list = null)
        {
            ByTable temp_list = null;
            dynamic O         = null;

            temp_list = String13.ParseUrlParams(source_list);

            foreach (dynamic _a in Lang13.Enumerate(temp_list))
            {
                O = _a;

                temp_list[O] = String13.ParseNumber(temp_list[O]);
            }
            return(temp_list);
        }
Example #30
0
        // Function from file: dispenser.dm
        public override dynamic Topic(string href = null, ByTable href_list = null, dynamic hsrc = null)
        {
            if (Lang13.Bool(base.Topic(href, href_list, (object)(hsrc))))
            {
                return(null);
            }
            Task13.User.set_machine(this);

            if (Lang13.Bool(href_list["dispense"]))
            {
                this.Dispense(String13.ParseNumber(href_list["dispense"]));
            }
            this.updateUsrDialog();
            return(null);
        }