Exemple #1
0
        // Function from file: access.dm
        public bool check_access_list(ByTable L = null)
        {
            dynamic req  = null;
            dynamic req2 = null;


            if (!Lang13.Bool(this.req_access) && !Lang13.Bool(this.req_one_access))
            {
                return(true);
            }

            if (!(this.req_access is ByTable))
            {
                return(true);
            }

            if (!(this.req_access.len != 0) && (!Lang13.Bool(this.req_one_access) || !(this.req_one_access.len != 0)))
            {
                return(true);
            }

            if (!(L != null))
            {
                return(false);
            }

            if (!(L is ByTable))
            {
                return(false);
            }

            foreach (dynamic _a in Lang13.Enumerate(this.req_access))
            {
                req = _a;


                if (!L.Contains(req))
                {
                    return(false);
                }
            }

            if (Lang13.Bool(this.req_one_access) && this.req_one_access.len != 0)
            {
                foreach (dynamic _b in Lang13.Enumerate(this.req_one_access))
                {
                    req2 = _b;


                    if (L.Contains(req2))
                    {
                        return(true);
                    }
                }
                return(false);
            }
            return(true);
        }
Exemple #2
0
        // Function from file: objs.dm
        public void updateUsrDialog(  )
        {
            bool    is_in_use = false;
            ByTable nearby    = null;
            dynamic M         = null;
            Mob     H         = null;


            if (this.in_use)
            {
                is_in_use = false;
                nearby    = Map13.FetchViewers(this, 1);

                foreach (dynamic _a in Lang13.Enumerate(nearby))
                {
                    M = _a;


                    if (Lang13.Bool(M.client) && M.machine == this)
                    {
                        is_in_use = true;
                        this.attack_hand(M);
                    }
                }

                if (Task13.User is Mob_Living_Silicon_Ai || Task13.User is Mob_Living_Silicon_Robot || Lang13.Bool(GlobalFuncs.IsAdminGhost(Task13.User)))
                {
                    if (!nearby.Contains(Task13.User))
                    {
                        if (Task13.User.client != null && Task13.User.machine == this)
                        {
                            is_in_use = true;
                            this.attack_ai(Task13.User);
                        }
                    }
                }

                if (Task13.User is Mob_Living_Carbon_Human)
                {
                    H = Task13.User;

                    if (!nearby.Contains(Task13.User))
                    {
                        if (Task13.User.client != null && Task13.User.machine == this)
                        {
                            if (((Dna)((dynamic)H).dna).check_mutation("Telekinesis") != 0)
                            {
                                is_in_use = true;
                                this.attack_hand(Task13.User);
                            }
                        }
                    }
                }
                this.in_use = is_in_use;
            }
            return;
        }
Exemple #3
0
        // Function from file: receiver.dm
        public bool check_receive_level(Signal signal = null)
        {
            Obj_Machinery_Telecomms_Hub H   = null;
            ByTable connected_levels        = null;
            Obj_Machinery_Telecomms_Relay R = null;


            if (Lang13.IntNullable(signal.data["level"]) != this.listening_level)
            {
                foreach (dynamic _b in Lang13.Enumerate(this.links, typeof(Obj_Machinery_Telecomms_Hub)))
                {
                    H = _b;

                    connected_levels = new ByTable();

                    foreach (dynamic _a in Lang13.Enumerate(H.links, typeof(Obj_Machinery_Telecomms_Relay)))
                    {
                        R = _a;


                        if (R.can_receive(signal))
                        {
                            connected_levels.Or(R.listening_level);
                        }
                    }

                    if (connected_levels.Contains(signal.data["level"]))
                    {
                        return(true);
                    }
                }
                return(false);
            }
            return(true);
        }
Exemple #4
0
        // Function from file: html_interface.dm
        public override dynamic Topic(string href = null, ByTable href_list = null, dynamic hsrc = null)
        {
            dynamic hclient = null;

            hclient = this.getClient(Task13.User.client);

            if (hclient is HtmlInterfaceClient)
            {
                if (href_list.Contains("html_interface_action"))
                {
                    dynamic _a = href_list["html_interface_action"];                     // Was a switch-case, sorry for the mess.
                    if (_a == "onload")
                    {
                        hclient.layout = null;
                        hclient.content_elements.len = 0;
                        this._renderTitle(hclient, GlobalVars.TRUE, GlobalVars.TRUE);
                        this._renderLayout(hclient, GlobalVars.TRUE);
                        hclient.is_loaded = GlobalVars.TRUE;
                    }
                    else if (_a == "onclose")
                    {
                        this.hide(hclient);
                    }
                }
                else if (this.v_ref != null && Lang13.Bool(hclient.active))
                {
                    this.v_ref.Topic(href, href_list, hclient);
                }
            }
            return(null);
        }
Exemple #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);
        }
Exemple #6
0
        // Function from file: electrical_storm.dm
        public override bool start(  )
        {
            ByTable                 epicentreList      = null;
            int?                    i                  = null;
            ByTable                 possibleEpicentres = null;
            Obj_Effect_Landmark     newEpicentre       = null;
            Obj_Effect_Landmark     epicentre          = null;
            Obj_Machinery_Power_Apc apc                = null;

            epicentreList = new ByTable();
            i             = null;
            i             = 1;

            while ((i ?? 0) <= (this.lightsoutAmount ?? 0))
            {
                possibleEpicentres = new ByTable();

                foreach (dynamic _a in Lang13.Enumerate(GlobalVars.landmarks_list, typeof(Obj_Effect_Landmark)))
                {
                    newEpicentre = _a;


                    if (newEpicentre.name == "lightsout" && !epicentreList.Contains(newEpicentre))
                    {
                        possibleEpicentres.Add(newEpicentre);
                    }
                }

                if (possibleEpicentres.len != 0)
                {
                    epicentreList.Add(Rand13.PickFromTable(possibleEpicentres));
                }
                else
                {
                    break;
                }
                i++;
            }

            if (!(epicentreList.len != 0))
            {
                return(false);
            }

            foreach (dynamic _c in Lang13.Enumerate(epicentreList, typeof(Obj_Effect_Landmark)))
            {
                epicentre = _c;


                foreach (dynamic _b in Lang13.Enumerate(GlobalFuncs.ultra_range(this.lightsoutRange, epicentre), typeof(Obj_Machinery_Power_Apc)))
                {
                    apc = _b;

                    apc.overload_lighting();
                }
            }
            return(false);
        }
Exemple #7
0
        // Function from file: LINDA_system.dm
        public ByTable GetAtmosAdjacentTurfs(int?alldir = null)
        {
            alldir = alldir ?? 0;

            ByTable adjacent_turfs     = null;
            Tile    curloc             = null;
            dynamic direction          = null;
            int     matchingDirections = 0;
            Tile    S = null;
            dynamic checkDirection = null;
            Tile    checkTurf      = null;


            if (!(this is Tile_Simulated))
            {
                return(new ByTable());
            }
            adjacent_turfs = this.atmos_adjacent_turfs.Copy();

            if (!Lang13.Bool(alldir))
            {
                return(adjacent_turfs);
            }
            curloc = this;

            foreach (dynamic _b in Lang13.Enumerate(GlobalVars.diagonals))
            {
                direction = _b;

                matchingDirections = 0;
                S = Map13.GetStep(curloc, Convert.ToInt32(direction));

                foreach (dynamic _a in Lang13.Enumerate(GlobalVars.cardinal))
                {
                    checkDirection = _a;

                    checkTurf = Map13.GetStep(S, Convert.ToInt32(checkDirection));

                    if (!S.atmos_adjacent_turfs.Contains(checkTurf))
                    {
                        continue;
                    }

                    if (adjacent_turfs.Contains(checkTurf))
                    {
                        matchingDirections++;
                    }

                    if (matchingDirections >= 2)
                    {
                        adjacent_turfs.Add(S);
                        break;
                    }
                }
            }
            return(adjacent_turfs);
        }
        // Function from file: atmosmachinery.dm
        public virtual void atmosinit(ByTable node_connects = null)
        {
            double  I  = 0;
            dynamic D  = null;
            double  I2 = 0;
            Obj_Machinery_Atmospherics target = null;


            if (!(node_connects != null))
            {
                node_connects     = new ByTable();
                node_connects.len = this.device_type;

                foreach (dynamic _b in Lang13.IterateRange(1, this.device_type))
                {
                    I = _b;


                    foreach (dynamic _a in Lang13.Enumerate(GlobalVars.cardinal))
                    {
                        D = _a;


                        if (Lang13.Bool(D & this.GetInitDirections()))
                        {
                            if (node_connects.Contains(D))
                            {
                                continue;
                            }
                            node_connects[I] = D;
                            break;
                        }
                    }
                }
            }

            foreach (dynamic _d in Lang13.IterateRange(1, this.device_type))
            {
                I2 = _d;


                foreach (dynamic _c in Lang13.Enumerate(Map13.GetStep(this, Convert.ToInt32(node_connects[I2])), typeof(Obj_Machinery_Atmospherics)))
                {
                    target = _c;


                    if (this.can_be_node(target, I2))
                    {
                        this.nodes[I2] = target;
                        break;
                    }
                }
            }
            this.update_icon();
            return;
        }
Exemple #9
0
        // Function from file: server.dm
        public override void initialize(  )
        {
            ByTable no_id_servers       = null;
            ByTable server_ids          = null;
            Obj_Machinery_RND_Server S  = null;
            Obj_Machinery_RND_Server S2 = null;
            int num = 0;

            base.initialize();
            no_id_servers = new ByTable();
            server_ids    = new ByTable();

            foreach (dynamic _b in Lang13.Enumerate(GlobalVars.machines, typeof(Obj_Machinery_RND_Server)))
            {
                S = _b;


                switch ((int?)(S.server_id))
                {
                case -1:
                    continue;
                    break;

                case 0:
                    no_id_servers.Add(S);
                    break;

                default:
                    server_ids.Add(S.server_id);
                    break;
                }
            }

            foreach (dynamic _c in Lang13.Enumerate(no_id_servers, typeof(Obj_Machinery_RND_Server)))
            {
                S2 = _c;

                num = 1;

                while (!Lang13.Bool(S2.server_id))
                {
                    if (server_ids.Contains(num))
                    {
                        num++;
                    }
                    else
                    {
                        S2.server_id = num;
                        server_ids.Add(num);
                    }
                }
                no_id_servers.Remove(S2);
            }
            return;
        }
        // Function from file: uplink.dm
        public override int?ui_act(string action = null, ByTable _params = null, Tgui ui = null, UiState state = null)
        {
            int?_default = null;

            dynamic item          = null;
            ByTable uplink_items  = null;
            ByTable buyable_items = null;
            dynamic category      = null;
            dynamic I             = null;


            if (!Lang13.Bool(this.active))
            {
                return(_default);
            }

            switch ((string)(action))
            {
            case "buy":
                item          = _params["item"];
                uplink_items  = GlobalFuncs.get_uplink_items(this.gamemode);
                buyable_items = new ByTable();

                foreach (dynamic _a in Lang13.Enumerate(uplink_items))
                {
                    category = _a;

                    buyable_items.Add(uplink_items[category]);
                }

                if (buyable_items.Contains(item))
                {
                    I = buyable_items[item];
                    I.buy(Task13.User, this);
                    _default = GlobalVars.TRUE;
                }
                break;

            case "lock":
                this.active = GlobalVars.FALSE;
                GlobalVars.SStgui.close_uis(this);
                break;
            }
            return(_default);
        }
        // Function from file: station_alert.dm
        public bool cancelAlarm(string _class = null, Zone A = null, Ent_Static origin = null)
        {
            dynamic L       = null;
            bool    cleared = false;
            dynamic I       = null;
            dynamic alarm   = null;
            ByTable srcs    = null;


            if ((this.stat & 1) != 0)
            {
                return(false);
            }
            L       = this.alarms[_class];
            cleared = false;

            foreach (dynamic _a in Lang13.Enumerate(L))
            {
                I = _a;


                if (I == A.name)
                {
                    alarm = L[I];
                    srcs  = alarm[3];

                    if (srcs.Contains(origin))
                    {
                        srcs.Remove(origin);
                    }

                    if (srcs.len == 0)
                    {
                        cleared = true;
                        L      -= I;
                    }
                }
            }
            return(!cleared);
        }
Exemple #12
0
        // Function from file: pool.dm
        public void createVariables(params object[] _)
        {
            ByTable _args = new ByTable(new object[] {  }).Extend(_);

            ByTable exclude = null;
            dynamic key     = null;

            GlobalVars.pooledvariables[this.type] = new ByTable();
            exclude = GlobalVars.exclude + _args;

            foreach (dynamic _a in Lang13.Enumerate(this.vars))
            {
                key = _a;


                if (exclude.Contains(key))
                {
                    continue;
                }
                GlobalVars.pooledvariables[this.type][key] = Lang13.Initial(this, key);
            }
            return;
        }
        // Function from file: camera_bug.dm
        public string camera_report(  )
        {
            string          dat   = null;
            ByTable         seen  = null;
            ByTable         names = null;
            Obj_Singularity S     = null;
            int             stage = 0;
            Obj_Mecha       M     = null;
            Mob_Living      M2    = null;

            dat = "";

            if (Lang13.Bool(this.current) && ((Obj_Machinery_Camera)this.current).can_use())
            {
                seen  = ((Obj_Machinery_Camera)this.current).can_see();
                names = new ByTable();

                foreach (dynamic _a in Lang13.Enumerate(seen, typeof(Obj_Singularity)))
                {
                    S = _a;


                    if (names.Contains(S.name))
                    {
                        names[S.name]++;
                        dat += "" + S.name + " (" + names[S.name] + ")";
                    }
                    else
                    {
                        names[S.name] = 1;
                        dat          += "" + S.name;
                    }
                    stage = Num13.Floor((S.current_size ?? 0) / 2) + 1;
                    dat  += " (Stage " + stage + ")";
                    dat  += new Txt(" <a href='?").Ref(this).str(";track=").Ref(S).str("'>[Track]</a><br>").ToString();
                }

                foreach (dynamic _b in Lang13.Enumerate(seen, typeof(Obj_Mecha)))
                {
                    M = _b;


                    if (names.Contains(M.name))
                    {
                        names[M.name]++;
                        dat += "" + M.name + " (" + names[M.name] + ")";
                    }
                    else
                    {
                        names[M.name] = 1;
                        dat          += "" + M.name;
                    }
                    dat += new Txt(" <a href='?").Ref(this).str(";track=").Ref(M).str("'>[Track]</a><br>").ToString();
                }

                foreach (dynamic _c in Lang13.Enumerate(seen, typeof(Mob_Living)))
                {
                    M2 = _c;


                    if (names.Contains(M2.name))
                    {
                        names[M2.name]++;
                        dat += "" + M2.name + " (" + names[M2.name] + ")";
                    }
                    else
                    {
                        names[M2.name] = 1;
                        dat           += "" + M2.name;
                    }

                    if (M2.buckled != null && !Lang13.Bool(M2.lying))
                    {
                        dat += " (Sitting)";
                    }

                    if (Lang13.Bool(M2.lying))
                    {
                        dat += " (Laying down)";
                    }
                    dat += new Txt(" <a href='?").Ref(this).str(";track=").Ref(M2).str("'>[Track]</a><br>").ToString();
                }

                if (Lang13.Length(dat) == 0)
                {
                    dat += "No motion detected.";
                }
                return(dat);
            }
            else
            {
                return("Camera Offline<br>");
            }
        }
Exemple #14
0
        // Function from file: ticker.dm
        public bool declare_completion(  )
        {
            bool                     station_evacuated = false;
            int                      num_survivors     = 0;
            int                      num_escapees      = 0;
            dynamic                  Player            = null;
            StationState             end_state         = null;
            int                      station_integrity = 0;
            Mob_Living_Silicon_Ai    aiPlayer          = null;
            string                   robolist          = null;
            Mob_Living_Silicon_Robot robo              = null;
            Mob_Living_Silicon_Robot robo2             = null;
            dynamic                  handler           = null;
            ByTable                  total_antagonists = null;
            Mind                     Mind              = null;
            string                   temprole          = null;
            dynamic                  i      = null;
            string                   dellog = null;
            dynamic                  path   = null;


            if (GlobalVars.SSshuttle.emergency.mode >= 5)
            {
                station_evacuated = true;
            }
            num_survivors = 0;
            num_escapees  = 0;
            Game13.WriteMsg("<BR><BR><BR><FONT size=3><B>The round has ended.</B></FONT>");

            foreach (dynamic _a in Lang13.Enumerate(GlobalVars.mob_list))
            {
                Player = _a;


                if (Lang13.Bool(Player.mind) && !(Player is Mob_NewPlayer))
                {
                    if (Convert.ToInt32(Player.stat) != 2 && !(Player is Mob_Living_Carbon_Brain))
                    {
                        num_survivors++;

                        if (station_evacuated)
                        {
                            if (!((Ent_Static)Player).onCentcom() && !((Ent_Static)Player).onSyndieBase())
                            {
                                Player.WriteMsg("<font color='blue'><b>You managed to survive, but were marooned on " + GlobalFuncs.station_name() + "...</b></FONT>");
                            }
                            else
                            {
                                num_escapees++;
                                Player.WriteMsg("<font color='green'><b>You managed to survive the events on " + GlobalFuncs.station_name() + " as " + Player.real_name + ".</b></FONT>");
                            }
                        }
                        else
                        {
                            Player.WriteMsg("<font color='green'><b>You managed to survive the events on " + GlobalFuncs.station_name() + " as " + Player.real_name + ".</b></FONT>");
                        }
                    }
                    else
                    {
                        Player.WriteMsg("<font color='red'><b>You did not survive the events on " + GlobalFuncs.station_name() + "...</b></FONT>");
                    }
                }
            }
            end_state = new StationState();
            end_state.count();
            station_integrity = Num13.MinInt(((int)(Num13.Round(GlobalVars.start_state.score(end_state) * 100, 0.1))), 100);
            Game13.WriteMsg("<BR>" + GlobalVars.TAB + "Shift Duration: <B>" + Num13.Floor(Game13.time / 36000) + ":" + GlobalFuncs.add_zero("" + Game13.time / 600 % 60, 2) + ":" + Game13.time / 100 % 6 + Game13.time / 100 % 10 + "</B>");
            Game13.WriteMsg("<BR>" + GlobalVars.TAB + "Station Integrity: <B>" + (this.mode.station_was_nuked ? "<font color='red'>Destroyed</font>" : "" + station_integrity + "%") + "</B>");

            if (GlobalVars.joined_player_list.len != 0)
            {
                Game13.WriteMsg("<BR>" + GlobalVars.TAB + "Total Population: <B>" + GlobalVars.joined_player_list.len + "</B>");

                if (station_evacuated)
                {
                    Game13.WriteMsg("<BR>" + GlobalVars.TAB + "Evacuation Rate: <B>" + num_escapees + " (" + Num13.Round(num_escapees / GlobalVars.joined_player_list.len * 100, 0.1) + "%)</B>");
                }
                Game13.WriteMsg("<BR>" + GlobalVars.TAB + "Survival Rate: <B>" + num_survivors + " (" + Num13.Round(num_survivors / GlobalVars.joined_player_list.len * 100, 0.1) + "%)</B>");
            }
            Game13.WriteMsg("<BR>");

            foreach (dynamic _c in Lang13.Enumerate(GlobalVars.mob_list, typeof(Mob_Living_Silicon_Ai)))
            {
                aiPlayer = _c;


                if (aiPlayer.stat != 2 && aiPlayer.mind != null)
                {
                    Game13.WriteMsg("<b>" + aiPlayer.name + " (Played by: " + aiPlayer.mind.key + ")'s laws at the end of the round were:</b>");
                    aiPlayer.show_laws(true);
                }
                else if (aiPlayer.mind != null)
                {
                    Game13.WriteMsg("<b>" + aiPlayer.name + " (Played by: " + aiPlayer.mind.key + ")'s laws when it was deactivated were:</b>");
                    aiPlayer.show_laws(true);
                }
                Game13.WriteMsg("<b>Total law changes: " + aiPlayer.law_change_counter + "</b>");

                if (aiPlayer.connected_robots.len != 0)
                {
                    robolist = "<b>" + aiPlayer.real_name + "'s minions were:</b> ";

                    foreach (dynamic _b in Lang13.Enumerate(aiPlayer.connected_robots, typeof(Mob_Living_Silicon_Robot)))
                    {
                        robo = _b;


                        if (robo.mind != null)
                        {
                            robolist += "" + robo.name + (robo.stat != 0 ? " (Deactivated) (Played by: " + robo.mind.key + "), " : " (Played by: " + robo.mind.key + "), ");
                        }
                    }
                    Game13.WriteMsg("" + robolist);
                }
            }

            foreach (dynamic _d in Lang13.Enumerate(GlobalVars.mob_list, typeof(Mob_Living_Silicon_Robot)))
            {
                robo2 = _d;


                if (!Lang13.Bool(robo2.connected_ai) && robo2.mind != null)
                {
                    if (robo2.stat != 2)
                    {
                        Game13.WriteMsg("<b>" + robo2.name + " (Played by: " + robo2.mind.key + ") survived as an AI-less borg! Its laws were:</b>");
                    }
                    else
                    {
                        Game13.WriteMsg("<b>" + robo2.name + " (Played by: " + robo2.mind.key + ") was unable to survive the rigors of being a cyborg without an AI. Its laws were:</b>");
                    }

                    if (robo2 != null)
                    {
                        robo2.laws.show_laws(typeof(Game13));
                    }
                }
            }
            this.mode.declare_completion();

            foreach (dynamic _e in Lang13.Enumerate(Lang13.GetTypes("/datum/game_mode/proc")))
            {
                handler = _e;


                if (String13.FindIgnoreCase("" + handler, "auto_declare_completion_", 1, 0) != 0)
                {
                    Lang13.Call(Lang13.BindFunc(this.mode, handler), this.force_ending);
                }
            }
            total_antagonists = new ByTable();

            foreach (dynamic _f in Lang13.Enumerate(this.minds, typeof(Mind)))
            {
                Mind = _f;

                temprole = Mind.special_role;

                if (Lang13.Bool(temprole))
                {
                    if (total_antagonists.Contains(temprole))
                    {
                        total_antagonists[temprole] += ", " + Mind.name + "(" + Mind.key + ")";
                    }
                    else
                    {
                        total_antagonists.Add(temprole);
                        total_antagonists[temprole] += ": " + Mind.name + "(" + Mind.key + ")";
                    }
                }
            }
            GlobalFuncs.log_game("Antagonists at round end were...");

            foreach (dynamic _g in Lang13.Enumerate(total_antagonists))
            {
                i = _g;

                GlobalFuncs.log_game("" + i + "s" + total_antagonists[i] + ".");
            }

            if (GlobalVars.SSgarbage.didntgc.len != 0)
            {
                dellog = "";

                foreach (dynamic _h in Lang13.Enumerate(GlobalVars.SSgarbage.didntgc))
                {
                    path = _h;

                    dellog += "Path : " + path + " \n";
                    dellog += "Failures : " + GlobalVars.SSgarbage.didntgc[path] + " \n";
                }
                Game13.log.WriteMsg(dellog);
            }
            return(true);
        }
Exemple #15
0
        // Function from file: airlock_maker.dm
        public override dynamic Topic(string href = null, ByTable href_list = null, dynamic hsrc = null)
        {
            string     newname     = null;
            double?    value       = null;
            Ent_Static t_loc       = null;
            dynamic    target_type = null;
            dynamic    final       = null;
            dynamic    D           = null;


            if (!(Task13.User != null))
            {
                return(null);
            }

            if (!(this != null) || !(this.linked != null) || !(this.linked.loc != null))
            {
                Interface13.Browse(Task13.User, null, "window=airlockmaker");
                return(null);
            }

            if (href_list.Contains("rename"))
            {
                newname = GlobalFuncs.stripped_input(Task13.User, "New airlock name:", "Name the airlock", this.doorname);

                if (Lang13.Bool(newname))
                {
                    this.doorname = newname;
                }
            }

            if (href_list.Contains("access"))
            {
                value = String13.ParseNumber(href_list["access"]);
                this.access_used.Xor(value);
            }

            if (href_list.Contains("reqall"))
            {
                this.require_all = !this.require_all;
            }

            if (href_list.Contains("paint"))
            {
                this.paintjob = href_list["paint"];
            }

            if (href_list.Contains("glass"))
            {
                this.glassdoor = !this.glassdoor;
            }

            if (href_list.Contains("cancel"))
            {
                Interface13.Browse(Task13.User, null, "window=airlockmaker");
                GlobalFuncs.qdel(this.linked);
                GlobalFuncs.qdel(this);
                return(null);
            }

            if (href_list.Contains("done"))
            {
                Interface13.Browse(Task13.User, null, "window=airlockmaker");
                t_loc = this.linked.loc;
                GlobalFuncs.qdel(this.linked);

                if (!(t_loc is Tile))
                {
                    return(null);
                }
                target_type = "/obj/machinery/door/airlock";

                if (this.glassdoor)
                {
                    if (this.paintjob != "none")
                    {
                        if (new ByTable(new object [] { "external", "highsecurity", "maintenance" }).Contains(this.paintjob))
                        {
                            target_type += "/" + this.paintjob;
                        }
                        else
                        {
                            target_type += "/glass_" + this.paintjob;
                        }
                    }
                    else
                    {
                        target_type += "/glass";
                    }
                }
                else if (this.paintjob != "none")
                {
                    target_type += "/" + this.paintjob;
                }
                final       = target_type;
                target_type = Lang13.FindClass(final);

                if (!Lang13.Bool(target_type))
                {
                    Task13.User.WriteMsg("Didn't work, contact Sayu with this: " + final);
                    Interface13.Browse(Task13.User, null, "window=airlockmaker");
                    return(null);
                }
                D      = Lang13.Call(target_type, t_loc);
                D.name = this.doorname;

                if (this.access_used.len == 0)
                {
                    D.req_access     = null;
                    D.req_one_access = null;
                }
                else if (this.require_all)
                {
                    D.req_access     = this.access_used.Copy();
                    D.req_one_access = null;
                }
                else
                {
                    D.req_access     = null;
                    D.req_one_access = this.access_used.Copy();
                }
                return(null);
            }
            this.interact();
            return(null);
        }
Exemple #16
0
        // Function from file: stack.dm
        public override dynamic interact(dynamic user = null, bool?flag1 = null)
        {
            string      t1             = null;
            int?        i              = null;
            StackRecipe R              = null;
            int         max_multiplier = 0;
            dynamic     title          = null;
            bool        can_build      = false;
            ByTable     multipliers    = null;
            dynamic     n              = null;


            if (!(this.recipes != null))
            {
                return(null);
            }

            if (!(this != null) || (this.get_amount() ?? 0) <= 0)
            {
                Interface13.Browse(user, null, "window=stack");
            }
            ((Mob)user).set_machine(this);
            t1 = "<HTML><HEAD><title>Constructions from " + this + "</title></HEAD><body><TT>Amount Left: " + this.get_amount() + "<br>";
            i  = null;
            i  = 1;

            while ((i ?? 0) <= this.recipes.len)
            {
                R = this.recipes[i];

                if (R == null)
                {
                    t1 += "<hr>";
                }
                else
                {
                    if ((i ?? 0) > 1 && !(this.recipes[(i ?? 0) - 1] == null))
                    {
                        t1 += "<br>";
                    }
                    max_multiplier = Num13.Floor((this.get_amount() ?? 0) / (R.req_amount ?? 0));
                    title          = null;
                    can_build      = true;
                    can_build      = can_build && max_multiplier > 0;

                    if ((R.res_amount ?? 0) > 1)
                    {
                        title += new Txt().item(R.res_amount).str("x ").item(R.title).s().ToString();
                    }
                    else
                    {
                        title += "" + R.title;
                    }
                    title += new Txt(" (").item(R.req_amount).str(" ").item(this.singular_name).s().str(")").ToString();

                    if (can_build)
                    {
                        t1 += new Txt("<A href='?src=").Ref(this).str(";make=").item(i).str(";multiplier=1'>").item(title).str("</A>  ").ToString();
                    }
                    else
                    {
                        t1 += "" + title;
                        i++;
                        continue;
                    }

                    if ((R.max_res_amount ?? 0) > 1 && max_multiplier > 1)
                    {
                        max_multiplier = Num13.MinInt(max_multiplier, Num13.Floor((R.max_res_amount ?? 0) / (R.res_amount ?? 0)));
                        t1            += " |";
                        multipliers    = new ByTable(new object [] { 5, 10, 25 });

                        foreach (dynamic _a in Lang13.Enumerate(multipliers))
                        {
                            n = _a;


                            if (max_multiplier >= Convert.ToDouble(n))
                            {
                                t1 += new Txt(" <A href='?src=").Ref(this).str(";make=").item(i).str(";multiplier=").item(n).str("'>").item(n * R.res_amount).str("x</A>").ToString();
                            }
                        }

                        if (!multipliers.Contains(max_multiplier))
                        {
                            t1 += new Txt(" <A href='?src=").Ref(this).str(";make=").item(i).str(";multiplier=").item(max_multiplier).str("'>").item(max_multiplier * (R.res_amount ?? 0)).str("x</A>").ToString();
                        }
                    }
                }
                i++;
            }
            t1 += "</TT></body></HTML>";
            Interface13.Browse(user, t1, "window=stack");
            GlobalFuncs.onclose(user, "stack");
            return(null);
        }
        // Function from file: photography.dm
        public void captureimage(dynamic target = null, dynamic user = null, bool?flag = null)
        {
            string  mobs  = null;
            bool    isAi  = false;
            ByTable seen  = null;
            ByTable turfs = null;
            dynamic T     = null;
            Icon    temp  = null;

            mobs = "";
            isAi = user is Mob_Living_Silicon_Ai;

            if (!isAi)
            {
                if (Lang13.Bool(user.client))
                {
                    seen = GlobalFuncs.get_hear(Game13.view, user.client.eye);
                }
                else
                {
                    seen = GlobalFuncs.get_hear(Game13.view, user);
                }
            }
            else
            {
                seen = GlobalFuncs.get_hear(Game13.view, target);
            }
            turfs = new ByTable();

            foreach (dynamic _a in Lang13.Enumerate(Map13.FetchInRange(target, 1)))
            {
                T = _a;


                if (seen.Contains(T))
                {
                    if (isAi && !GlobalVars.cameranet.checkTurfVis(T))
                    {
                        continue;
                    }
                    else
                    {
                        turfs.Add(T);
                        mobs += this.camera_get_mobs(T);
                    }
                }
            }
            temp = new Icon("icons/effects/96x96.dmi", "");
            temp.Blend("#000", 3);
            temp.Blend(this.camera_get_icon(turfs, target), 3);

            if (!(user is Mob_Living_Silicon))
            {
                this.printpicture(user, temp, mobs, flag);
            }
            else
            {
                this.aipicture(user, temp, mobs, isAi);
            }
            return;
        }
Exemple #18
0
        // Function from file: blueprints.dm
        public dynamic detect_room(dynamic first = null)
        {
            ByTable                   found     = null;
            ByTable                   pending   = null;
            ByTable                   border    = null;
            Ent_Static                T         = null;
            dynamic                   dir       = null;
            bool                      skip      = false;
            Obj_Structure_Window      W         = null;
            Obj_Machinery_Door_Window D         = null;
            Tile                      NT        = null;
            Ent_Static                A         = null;
            dynamic                   V         = null;
            dynamic                   F         = null;
            dynamic                   direction = null;
            Tile                      U         = null;

            found   = new ByTable();
            pending = new ByTable(new object [] { first });
            border  = new ByTable();

            while (pending.len != 0)
            {
                if (found.len + pending.len > 300)
                {
                    return(GlobalVars.ROOM_ERR_TOOLARGE);
                }
                T = pending[1];
                pending.Remove(T);

                foreach (dynamic _d in Lang13.Enumerate(GlobalVars.cardinal))
                {
                    dir = _d;

                    skip = false;

                    foreach (dynamic _a in Lang13.Enumerate(T, typeof(Obj_Structure_Window)))
                    {
                        W = _a;


                        if (dir == W.dir || new ByTable(new object [] { GlobalVars.NORTHEAST, GlobalVars.SOUTHEAST, GlobalVars.NORTHWEST, GlobalVars.SOUTHWEST }).Contains(W.dir))
                        {
                            skip = true;
                            break;
                        }
                    }

                    if (skip)
                    {
                        continue;
                    }

                    foreach (dynamic _b in Lang13.Enumerate(T, typeof(Obj_Machinery_Door_Window)))
                    {
                        D = _b;


                        if (dir == D.dir)
                        {
                            skip = true;
                            break;
                        }
                    }

                    if (skip)
                    {
                        continue;
                    }
                    NT = Map13.GetStep(T, Convert.ToInt32(dir));

                    if (!(NT is Tile) || found.Contains(NT) || pending.Contains(NT))
                    {
                        continue;
                    }

                    switch ((int)(this.check_tile_is_border(NT, dir)))
                    {
                    case 1:
                        pending.Add(NT);
                        break;

                    case 2:
                        A = NT.loc;

                        if (!Lang13.Bool(found[A.name]))
                        {
                            found[A.name] = NT.loc;
                        }
                        break;

                    case 3:
                        border[NT] += dir;
                        break;

                    case 4:
                        return(GlobalVars.ROOM_ERR_SPACE);

                        break;
                    }
                }
                found.Add(T);
            }

            foreach (dynamic _f in Lang13.Enumerate(border))
            {
                V = _f;

                F = V;

                foreach (dynamic _e in Lang13.Enumerate(GlobalVars.cardinal))
                {
                    direction = _e;


                    if (direction == border[F])
                    {
                        continue;
                    }
                    U = Map13.GetStep(F, Convert.ToInt32(direction));

                    if (border.Contains(U) || found.Contains(U))
                    {
                        continue;
                    }

                    if (this.check_tile_is_border(U, direction) == GlobalVars.BORDER_2NDTILE)
                    {
                        found.Add(U);
                    }
                }
                found.Or(F);
            }
            return(found);
        }
        // Function from file: anomaly_bluespace.dm
        public override void end(  )
        {
            dynamic T        = null;
            dynamic chosen   = null;
            ByTable possible = null;
            Obj_Item_Device_Radio_Beacon W = null;
            dynamic           FROM         = null;
            dynamic           TO           = null;
            ByTable           flashers     = null;
            Mob_Living_Carbon C            = null;
            double            y_distance   = 0;
            double            x_distance   = 0;
            Ent_Dynamic       A            = null;
            Tile        newloc             = null;
            Ent_Dynamic M          = null;
            Obj         blueeffect = null;


            if (this.newAnomaly.loc != null)
            {
                T = GlobalFuncs.safepick(GlobalFuncs.get_area_turfs(this.impact_area));

                if (Lang13.Bool(T))
                {
                    possible = new ByTable();

                    foreach (dynamic _a in Lang13.Enumerate(typeof(Game13), typeof(Obj_Item_Device_Radio_Beacon)))
                    {
                        W = _a;

                        possible.Add(W);
                    }

                    if (possible.len > 0)
                    {
                        chosen = Rand13.PickFromTable(possible);
                    }

                    if (Lang13.Bool(chosen))
                    {
                        FROM = T;
                        TO   = GlobalFuncs.get_turf(chosen);
                        GlobalFuncs.playsound(TO, "sound/effects/phasein.ogg", 100, 1);
                        GlobalFuncs.priority_announce("Massive bluespace translocation detected.", "Anomaly Alert");
                        flashers = new ByTable();

                        foreach (dynamic _b in Lang13.Enumerate(Map13.FetchViewers(null, TO), typeof(Mob_Living_Carbon)))
                        {
                            C = _b;


                            if (C.flash_eyes())
                            {
                                flashers.Add(C);
                            }
                        }
                        y_distance = Convert.ToDouble(TO.y - FROM.y);
                        x_distance = Convert.ToDouble(TO.x - FROM.x);

                        foreach (dynamic _c in Lang13.Enumerate(GlobalFuncs.ultra_range(12, FROM), typeof(Ent_Dynamic)))
                        {
                            A = _c;


                            if (A is Obj_Item_Device_Radio_Beacon)
                            {
                                continue;
                            }

                            if (Lang13.Bool(A.anchored))
                            {
                                continue;
                            }
                            newloc = Map13.GetTile(((int)(A.x + x_distance)), ((int)(A.y + y_distance)), Convert.ToInt32(TO.z));

                            if (!A.Move(newloc) && newloc != null)
                            {
                                A.loc = newloc;
                            }
                            Task13.Schedule(0, (Task13.Closure)(() => {
                                if (A is Mob && !flashers.Contains(A))
                                {
                                    M = A;

                                    if (Lang13.Bool(((dynamic)M).client))
                                    {
                                        blueeffect                  = new Obj(this);
                                        blueeffect.screen_loc       = "WEST,SOUTH to EAST,NORTH";
                                        blueeffect.icon             = "icons/effects/effects.dmi";
                                        blueeffect.icon_state       = "shieldsparkles";
                                        blueeffect.layer            = 17;
                                        blueeffect.mouse_opacity    = 0;
                                        ((dynamic)M).client.screen += blueeffect;
                                        Task13.Sleep(20);
                                        ((dynamic)M).client.screen -= blueeffect;
                                        GlobalFuncs.qdel(blueeffect);
                                    }
                                }
                                return;
                            }));
                        }
                    }
                    GlobalFuncs.qdel(this.newAnomaly);
                }
            }
            return;
        }
        // Function from file: hostile.dm
        public virtual bool MoveToTarget(ByTable possible_targets = null)
        {
            int target_distance = 0;

            this.stop_automated_movement = true;

            if (!Lang13.Bool(this.target) || !this.CanAttack(this.target))
            {
                this.LoseTarget();
                return(false);
            }

            if (possible_targets.Contains(this.target))
            {
                target_distance = Map13.GetDistance(this.targets_from, this.target);

                if (this.ranged)
                {
                    if (target_distance >= 2 && this.ranged_cooldown <= 0)
                    {
                        this.OpenFire(this.target);
                    }
                }

                if (!(this.Process_Spacemove() != 0))
                {
                    Map13.Walk(this, 0, 0);
                    return(true);
                }

                if (this.retreat_distance != null)
                {
                    if (target_distance <= Convert.ToDouble(this.retreat_distance))
                    {
                        Map13.WalkAway(this, this.target, Lang13.IntNullable(this.retreat_distance), this.move_to_delay);
                    }
                    else
                    {
                        this.Goto(this.target, this.move_to_delay, this.minimum_distance);
                    }
                }
                else
                {
                    this.Goto(this.target, this.move_to_delay, this.minimum_distance);
                }

                if (Lang13.Bool(this.target))
                {
                    if (this.targets_from.loc is Tile && ((Ent_Static)this.target).Adjacent(this.targets_from))
                    {
                        this.AttackingTarget();
                    }
                    return(true);
                }
                return(false);
            }

            if (this.environment_smash != 0)
            {
                if (this.target.loc != null && Map13.GetDistance(this.targets_from, this.target.loc) <= (this.vision_range ?? 0))
                {
                    if (this.environment_smash >= 2)
                    {
                        this.Goto(this.target, this.move_to_delay, this.minimum_distance);
                        this.FindHidden();
                        return(true);
                    }
                    else if (this.FindHidden())
                    {
                        return(true);
                    }
                }
            }
            this.LoseTarget();
            return(false);
        }
        // Function from file: dog.dm
        public override dynamic Topic(string href = null, ByTable href_list = null, dynamic hsrc = null)
        {
            dynamic remove_from   = null;
            dynamic add_to        = null;
            dynamic item_to_add   = null;
            ByTable allowed_types = null;
            dynamic i             = null;


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

            if (Lang13.Bool(href_list["remove_inv"]))
            {
                if (!this.Adjacent(Task13.User) || !(Task13.User is Mob_Living_Carbon_Human || Task13.User is Mob_Living_Carbon_Monkey || Task13.User is Mob_Living_Silicon_Robot || Task13.User is Mob_Living_Carbon_Alien_Humanoid))
                {
                    return(null);
                }
                remove_from = href_list["remove_inv"];

                dynamic _a = remove_from;                 // Was a switch-case, sorry for the mess.
                if (_a == "head")
                {
                    if (Lang13.Bool(this.inventory_head))
                    {
                        this.inventory_head.loc = this.loc;
                        this.inventory_head     = null;
                        this.update_corgi_fluff();
                        this.regenerate_icons();
                    }
                    else
                    {
                        Task13.User.WriteMsg("<span class='danger'>There is nothing to remove from its " + remove_from + ".</span>");
                        return(null);
                    }
                }
                else if (_a == "back")
                {
                    if (Lang13.Bool(this.inventory_back))
                    {
                        this.inventory_back.loc = this.loc;
                        this.inventory_back     = null;
                        this.update_corgi_fluff();
                        this.regenerate_icons();
                    }
                    else
                    {
                        Task13.User.WriteMsg("<span class='danger'>There is nothing to remove from its " + remove_from + ".</span>");
                        return(null);
                    }
                }
                this.show_inv(Task13.User);
            }
            else if (Lang13.Bool(href_list["add_inv"]))
            {
                if (!this.Adjacent(Task13.User) || !(Task13.User is Mob_Living_Carbon_Human || Task13.User is Mob_Living_Carbon_Monkey || Task13.User is Mob_Living_Silicon_Robot || Task13.User is Mob_Living_Carbon_Alien_Humanoid))
                {
                    return(null);
                }
                add_to = href_list["add_inv"];

                dynamic _c = add_to;                 // Was a switch-case, sorry for the mess.
                if (_c == "head")
                {
                    this.place_on_head(Task13.User.get_active_hand(), Task13.User);
                }
                else if (_c == "back")
                {
                    if (Lang13.Bool(this.inventory_back))
                    {
                        Task13.User.WriteMsg("<span class='warning'>It's already wearing something!</span>");
                        return(null);
                    }
                    else
                    {
                        item_to_add = Task13.User.get_active_hand();

                        if (!Lang13.Bool(item_to_add))
                        {
                            Task13.User.visible_message("" + Task13.User + " pets " + this + ".", "<span class='notice'>You rest your hand on " + this + "'s back for a moment.</span>");
                            return(null);
                        }

                        if (item_to_add is Obj_Item_Weapon_C4)
                        {
                            item_to_add.afterattack(this, Task13.User, 1);
                            return(null);
                        }
                        allowed_types = new ByTable(new object [] {
                            typeof(Obj_Item_Clothing_Suit_Armor_Vest),
                            typeof(Obj_Item_Clothing_Suit_Space_Hardsuit_Deathsquad),
                            typeof(Obj_Item_Device_Radio),
                            typeof(Obj_Item_Device_Radio_Off),
                            typeof(Obj_Item_Clothing_Suit_Cardborg),
                            typeof(Obj_Item_Weapon_Tank_Internals_Oxygen),
                            typeof(Obj_Item_Weapon_Tank_Internals_Air),
                            typeof(Obj_Item_Weapon_Extinguisher),
                            typeof(Obj_Item_Clothing_Suit_Hooded_IanCostume)
                        });

                        if (!allowed_types.Contains(item_to_add.type))
                        {
                            Task13.User.WriteMsg("<span class='warning'>You set " + item_to_add + " on " + this + "'s back, but it falls off!</span>");

                            if (!Task13.User.drop_item())
                            {
                                Task13.User.WriteMsg(new Txt("<span class='warning'>").The(item_to_add).item().str(" is stuck to your hand, you cannot put it on ").item(this).str("'s back!</span>").ToString());
                                return(null);
                            }
                            item_to_add.loc = this.loc;

                            if (Rand13.PercentChance(25))
                            {
                                Map13.StepRandom(item_to_add);
                            }

                            foreach (dynamic _b in Lang13.Enumerate(new ByTable(new object [] { 1, 2, 4, 8, 4, 8, 4, this.dir })))
                            {
                                i = _b;

                                this.dir = Convert.ToInt32(i);
                                Task13.Sleep(1);
                            }
                            return(null);
                        }
                        Task13.User.drop_item();
                        item_to_add.loc     = this;
                        this.inventory_back = item_to_add;
                        this.update_corgi_fluff();
                        this.regenerate_icons();
                    }
                }
                this.show_inv(Task13.User);
            }
            else
            {
                base.Topic(href, href_list, (object)(hsrc));
            }
            return(null);
        }
        // Function from file: camera_bug.dm
        public override dynamic Topic(string href = null, ByTable href_list = null, dynamic hsrc = null)
        {
            dynamic C  = null;
            dynamic A  = null;
            dynamic C2 = null;
            dynamic C3 = null;
            dynamic T  = null;


            if (Task13.User != this.loc)
            {
                Task13.User.unset_machine();
                Interface13.Browse(Task13.User, null, "window=camerabug");
                return(null);
            }
            Task13.User.set_machine(this);

            if (href_list.Contains("mode"))
            {
                this.track_mode = String13.ParseNumber(href_list["mode"]);
            }

            if (href_list.Contains("monitor"))
            {
                C = Lang13.FindObj(href_list["monitor"]);

                if (Lang13.Bool(C))
                {
                    this.track_mode = 1;
                    this.current    = C;
                    Task13.User.reset_perspective(null);
                    this.interact();
                }
            }

            if (href_list.Contains("track"))
            {
                A = Lang13.FindObj(href_list["track"]);

                if (Lang13.Bool(A))
                {
                    this.tracking     = A;
                    this.tracked_name = A.name;
                    this.last_found   = this.current.c_tag;
                    this.last_seen    = Game13.time;
                    this.track_mode   = 2;
                }
            }

            if (href_list.Contains("emp"))
            {
                C2 = Lang13.FindObj(href_list["emp"]);

                if (C2 is Obj_Machinery_Camera && C2.bug == this)
                {
                    ((Ent_Static)C2).emp_act(1);
                    C2.bug = null;
                    this.bugged_cameras.Remove(C2.c_tag);
                }
                this.interact();
                return(null);
            }

            if (href_list.Contains("close"))
            {
                Task13.User.unset_machine();
                this.current = null;
                return(null);
            }

            if (href_list.Contains("view"))
            {
                C3 = Lang13.FindObj(href_list["view"]);

                if (C3 is Obj_Machinery_Camera)
                {
                    if (!((Obj_Machinery_Camera)C3).can_use())
                    {
                        Task13.User.WriteMsg("<span class='warning'>Something's wrong with that camera!  You can't get a feed.</span>");
                        return(null);
                    }
                    T = GlobalFuncs.get_turf(this.loc);

                    if (!Lang13.Bool(T) || C3.z != T.z)
                    {
                        Task13.User.WriteMsg("<span class='warning'>You can't get a signal!</span>");
                        return(null);
                    }
                    this.current = C3;
                    Task13.Schedule(6, (Task13.Closure)(() => {
                        if (Lang13.Bool(this.check_eye(Task13.User)))
                        {
                            Task13.User.reset_perspective(C3);
                            this.interact();
                        }
                        else
                        {
                            Task13.User.unset_machine();
                            Interface13.Browse(Task13.User, null, "window=camerabug");
                        }
                        return;
                    }));
                    return(null);
                }
                else
                {
                    Task13.User.unset_machine();
                }
            }
            this.interact();
            return(null);
        }
        // Function from file: spell.dm
        public override void choose_targets(Mob user = null)
        {
            user = user ?? Task13.User;

            ByTable    targets          = null;
            Mob_Living target           = null;
            ByTable    possible_targets = null;
            Mob_Living M  = null;
            dynamic    M2 = null;
            Mob_Living L  = null;
            ByTable    possible_targets2 = null;
            Mob_Living target2           = null;
            int?       i       = null;
            dynamic    target3 = null;

            targets = new ByTable();

            switch ((int?)(this.max_targets))
            {
            case 0:

                foreach (dynamic _a in Lang13.Enumerate(GlobalFuncs.view_or_range(this.range, user, this.selection_type), typeof(Mob_Living)))
                {
                    target = _a;

                    targets.Add(target);
                }
                break;

            case 1:

                if ((this.range ?? 0) < 0)
                {
                    targets.Add(user);
                }
                else
                {
                    possible_targets = new ByTable();

                    foreach (dynamic _b in Lang13.Enumerate(GlobalFuncs.view_or_range(this.range, user, this.selection_type), typeof(Mob_Living)))
                    {
                        M = _b;


                        if (!this.include_user && user == M)
                        {
                            continue;
                        }
                        possible_targets.Add(M);
                    }
                    M2 = null;

                    if (!this.random_target)
                    {
                        M2 = Interface13.Input("Choose the target for the spell.", "Targeting", null, null, possible_targets, InputType.Mob | InputType.Null);
                    }
                    else
                    {
                        switch (this.random_target_priority)
                        {
                        case 2:
                            M2 = Rand13.PickFromTable(possible_targets);
                            break;

                        case 1:

                            foreach (dynamic _c in Lang13.Enumerate(possible_targets, typeof(Mob_Living)))
                            {
                                L = _c;


                                if (Lang13.Bool(M2))
                                {
                                    if (Map13.GetDistance(user, L) < Map13.GetDistance(user, M2))
                                    {
                                        if (this.los_check(user, L))
                                        {
                                            M2 = L;
                                        }
                                    }
                                }
                                else if (this.los_check(user, L))
                                {
                                    M2 = L;
                                }
                            }
                            break;
                        }
                    }

                    if (GlobalFuncs.view_or_range(this.range, user, this.selection_type).Contains(M2))
                    {
                        targets.Add(M2);
                    }
                }
                break;

            default:
                possible_targets2 = new ByTable();

                foreach (dynamic _e in Lang13.Enumerate(GlobalFuncs.view_or_range(this.range, user, this.selection_type), typeof(Mob_Living)))
                {
                    target2 = _e;

                    possible_targets2.Add(target2);
                }
                i = null;
                i = 1;

                while ((i ?? 0) <= (this.max_targets ?? 0))
                {
                    if (!(possible_targets2.len != 0))
                    {
                        break;
                    }

                    if (this.target_ignore_prev)
                    {
                        target3 = Rand13.PickFromTable(possible_targets2);
                        possible_targets2.Remove(target3);
                        targets.Add(target3);
                    }
                    else
                    {
                        targets.Add(Rand13.PickFromTable(possible_targets2));
                    }
                    i++;
                }
                break;
            }

            if (!this.include_user && targets.Contains(user))
            {
                targets.Remove(user);
            }

            if (!(targets.len != 0))
            {
                this.revert_cast(user);
                return;
            }
            this.perform(targets, null, user);
            return;
        }
Exemple #24
0
        // Function from file: blob_report.dm
        public void count(bool?count_territories = null)
        {
            dynamic T = null;
            Obj     O = null;
            ByTable valid_territories = null;
            dynamic A = null;


            foreach (dynamic _b in Lang13.Enumerate(Map13.FetchInBlock(Map13.GetTile(1, 1, 1), Map13.GetTile(Game13.map_size_x, Game13.map_size_y, 1))))
            {
                T = _b;


                if (T is Tile_Simulated_Floor)
                {
                    if (!T.burnt)
                    {
                        this.floor += 12;
                    }
                    else
                    {
                        this.floor += 1;
                    }
                }

                if (T is Tile_Simulated_Wall)
                {
                    if (T.intact)
                    {
                        this.wall += 2;
                    }
                    else
                    {
                        this.wall += 1;
                    }
                }

                if (T is Tile_Simulated_Wall_RWall)
                {
                    if (T.intact)
                    {
                        this.r_wall += 2;
                    }
                    else
                    {
                        this.r_wall += 1;
                    }
                }

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


                    if (O is Obj_Structure_Window)
                    {
                        this.window += 1;
                    }
                    else if (O is Obj_Structure_Grille && !Lang13.Bool(((dynamic)O).destroyed))
                    {
                        this.grille += 1;
                    }
                    else if (O is Obj_Machinery_Door)
                    {
                        this.door += 1;
                    }
                    else if (O is Obj_Machinery)
                    {
                        this.mach += 1;
                    }
                }
            }

            if (count_territories == true)
            {
                valid_territories = new ByTable();

                foreach (dynamic _c in Lang13.Enumerate(typeof(Game13)))
                {
                    A = _c;


                    if (Lang13.Bool(A.z) == true)
                    {
                        if (!valid_territories.Contains(A.type) && A.valid_territory)
                        {
                            valid_territories.Or(A.type);
                        }
                    }
                }

                if (valid_territories.len != 0)
                {
                    this.num_territories = valid_territories.len;
                }
                else
                {
                    Game13.WriteMsg("ERROR: NO VALID TERRITORIES");
                }
            }
            return;
        }
Exemple #25
0
        // Function from file: summonitem.dm
        public override bool cast(dynamic targets = null, dynamic thearea = null, dynamic user = null)
        {
            thearea = thearea ?? Task13.User;

            Mob_Living L                  = null;
            ByTable    hand_items         = null;
            bool       butterfingers      = false;
            string     message            = null;
            Obj        item               = null;
            Ent_Static item_to_retrive    = null;
            int        infinite_recursion = 0;
            Ent_Static organ              = null;
            Ent_Static M                  = null;
            Ent_Static C                  = null;
            Ent_Static P                  = null;


            foreach (dynamic _b in Lang13.Enumerate(targets, typeof(Mob_Living)))
            {
                L = _b;

                hand_items    = new ByTable(new object [] { L.get_active_hand(), L.get_inactive_hand() });
                butterfingers = false;
                message       = null;

                if (!(this.marked_item != null))
                {
                    message = "<span class='notice'>";

                    foreach (dynamic _a in Lang13.Enumerate(hand_items, typeof(Obj)))
                    {
                        item = _a;


                        if (Lang13.Bool(item.flags.Contains(128)))
                        {
                            continue;
                        }

                        if (Lang13.Bool(item.flags.Contains(2)))
                        {
                            message += "Though it feels redundant, ";
                        }
                        this.marked_item = item;
                        message         += "You mark " + item + " for recall.</span>";
                        this.name        = "Recall " + item;
                        break;
                    }

                    if (!(this.marked_item != null))
                    {
                        if (hand_items != null)
                        {
                            message = "<span class='caution'>You aren't holding anything that can be marked for recall.</span>";
                        }
                        else
                        {
                            message = "<span class='notice'>You must hold the desired item in your hands to mark it for recall.</span>";
                        }
                    }
                }
                else if (hand_items.Contains(this.marked_item != null && this.marked_item != null))
                {
                    message          = "<span class='notice'>You remove the mark on " + this.marked_item + " to use elsewhere.</span>";
                    this.name        = "Instant Summons";
                    this.marked_item = null;
                }
                else if (this.marked_item != null && Lang13.Bool(this.marked_item.gc_destroyed))
                {
                    message          = "<span class='warning'>You sense your marked item has been destroyed!</span>";
                    this.name        = "Instant Summons";
                    this.marked_item = null;
                }
                else
                {
                    item_to_retrive    = this.marked_item;
                    infinite_recursion = 0;

                    if (!(item_to_retrive.loc != null))
                    {
                        if (GlobalFuncs.isorgan(item_to_retrive))
                        {
                            organ = item_to_retrive;

                            if (Lang13.Bool(((dynamic)organ).owner))
                            {
                                GlobalFuncs.add_logs(L, ((dynamic)organ).owner, "magically removed " + organ.name + " from", null, "INTENT: " + String13.ToUpper(L.a_intent));
                                ((dynamic)organ).Remove(((dynamic)organ).owner);
                            }
                        }
                    }
                    else
                    {
                        while (!(item_to_retrive.loc is Tile) && infinite_recursion < 10)
                        {
                            if (item_to_retrive.loc is Mob)
                            {
                                M = item_to_retrive.loc;

                                if (M is Mob_Living_Silicon)
                                {
                                    M.loc.visible_message("<span class='warning'>" + M + " suddenly disappears!</span>");
                                    M.loc = L.loc;
                                    M.loc.visible_message("<span class='caution'>" + M + " suddenly appears!</span>");
                                    item_to_retrive = null;
                                    break;
                                }
                                ((Mob)M).unEquip(item_to_retrive);

                                if (M is Mob_Living_Carbon)
                                {
                                    C = M;

                                    if (Lang13.Bool(((dynamic)C).stomach_contents.Contains(Lang13.Bool(((dynamic)C).stomach_contents) && item_to_retrive != null)))
                                    {
                                        ((dynamic)C).stomach_contents -= item_to_retrive;
                                    }
                                }
                            }
                            else
                            {
                                if (item_to_retrive.loc is Obj_Machinery_PortableAtmospherics)
                                {
                                    P = item_to_retrive.loc;
                                    ((dynamic)P).disconnect();
                                    ((dynamic)P).update_icon();
                                }
                                item_to_retrive = item_to_retrive.loc;
                            }
                            infinite_recursion += 1;
                        }
                    }

                    if (!(item_to_retrive != null))
                    {
                        return(false);
                    }

                    if (item_to_retrive.loc != null)
                    {
                        item_to_retrive.loc.visible_message("<span class='warning'>The " + item_to_retrive.name + " suddenly disappears!</span>");
                    }

                    if (L.hand)
                    {
                        if (!L.equip_to_slot_if_possible(item_to_retrive, 4, false, true, true))
                        {
                            if (!L.equip_to_slot_if_possible(item_to_retrive, 5, false, true, true))
                            {
                                butterfingers = true;
                            }
                        }
                    }
                    else if (!L.equip_to_slot_if_possible(item_to_retrive, 5, false, true, true))
                    {
                        if (!L.equip_to_slot_if_possible(item_to_retrive, 4, false, true, true))
                        {
                            butterfingers = true;
                        }
                    }

                    if (butterfingers)
                    {
                        item_to_retrive.loc = L.loc;
                        item_to_retrive.loc.visible_message("<span class='caution'>The " + item_to_retrive.name + " suddenly appears!</span>");
                        GlobalFuncs.playsound(GlobalFuncs.get_turf(L), "sound/magic/SummonItems_generic.ogg", 50, 1);
                    }
                    else
                    {
                        item_to_retrive.loc.visible_message("<span class='caution'>The " + item_to_retrive.name + " suddenly appears in " + L + "'s hand!</span>");
                        GlobalFuncs.playsound(GlobalFuncs.get_turf(L), "sound/magic/SummonItems_generic.ogg", 50, 1);
                    }
                }

                if (Lang13.Bool(message))
                {
                    L.WriteMsg(message);
                }
            }
            return(false);
        }
Exemple #26
0
        // Function from file: datacore.dm
        public dynamic get_manifest(dynamic monochrome = null, bool?OOC = null)
        {
            ByTable     heads      = null;
            ByTable     sec        = null;
            ByTable     eng        = null;
            ByTable     med        = null;
            ByTable     sci        = null;
            ByTable     sup        = null;
            ByTable     civ        = null;
            ByTable     bot        = null;
            ByTable     misc       = null;
            dynamic     dat        = null;
            bool        even       = false;
            Data_Record t          = null;
            dynamic     name       = null;
            dynamic     rank       = null;
            bool        department = false;
            dynamic     name2      = null;
            dynamic     name3      = null;
            dynamic     name4      = null;
            dynamic     name5      = null;
            dynamic     name6      = null;
            dynamic     name7      = null;
            dynamic     name8      = null;
            dynamic     name9      = null;
            dynamic     name10     = null;

            heads = new ByTable();
            sec   = new ByTable();
            eng   = new ByTable();
            med   = new ByTable();
            sci   = new ByTable();
            sup   = new ByTable();
            civ   = new ByTable();
            bot   = new ByTable();
            misc  = new ByTable();
            dat   = "\n	<head><style>\n		.manifest {border-collapse:collapse;}\n		.manifest td, th {border:1px solid "+ (Lang13.Bool(monochrome) ? "black" : "#DEF; background-color:white; color:black") + "; padding:.25em}\n		.manifest th {height: 2em; "+ (Lang13.Bool(monochrome) ? "border-top-width: 3px" : "background-color: #48C; color:white") + "}\n		.manifest tr.head th { "+ (Lang13.Bool(monochrome) ? "border-top-width: 1px" : "background-color: #488;") + " }\n		.manifest td:first-child {text-align:right}\n		.manifest tr.alt td {"+ (Lang13.Bool(monochrome) ? "border-top-width: 2px" : "background-color: #DEF") + @"}
	</style></head>
	<table class=""manifest"" width='350px'>
	<tr class='head'><th>Name</th><th>Rank</th></tr>
	"    ;
            even  = false;

            foreach (dynamic _a in Lang13.Enumerate(GlobalVars.data_core.general, typeof(Data_Record)))
            {
                t = _a;

                name       = t.fields["name"];
                rank       = t.fields["rank"];
                department = false;

                if (GlobalVars.command_positions.Contains(rank))
                {
                    heads[name] = rank;
                    department  = true;
                }

                if (GlobalVars.security_positions.Contains(rank))
                {
                    sec[name]  = rank;
                    department = true;
                }

                if (GlobalVars.engineering_positions.Contains(rank))
                {
                    eng[name]  = rank;
                    department = true;
                }

                if (GlobalVars.medical_positions.Contains(rank))
                {
                    med[name]  = rank;
                    department = true;
                }

                if (GlobalVars.science_positions.Contains(rank))
                {
                    sci[name]  = rank;
                    department = true;
                }

                if (GlobalVars.supply_positions.Contains(rank))
                {
                    sup[name]  = rank;
                    department = true;
                }

                if (GlobalVars.civilian_positions.Contains(rank))
                {
                    civ[name]  = rank;
                    department = true;
                }

                if (GlobalVars.nonhuman_positions.Contains(rank))
                {
                    bot[name]  = rank;
                    department = true;
                }

                if (!department && !heads.Contains(name))
                {
                    misc[name] = rank;
                }
            }

            if (heads.len > 0)
            {
                dat += "<tr><th colspan=3>Heads</th></tr>";

                foreach (dynamic _b in Lang13.Enumerate(heads))
                {
                    name2 = _b;

                    dat += "<tr" + (even ? " class='alt'" : "") + "><td>" + name2 + "</td><td>" + heads[name2] + "</td></tr>";
                    even = !even;
                }
            }

            if (sec.len > 0)
            {
                dat += "<tr><th colspan=3>Security</th></tr>";

                foreach (dynamic _c in Lang13.Enumerate(sec))
                {
                    name3 = _c;

                    dat += "<tr" + (even ? " class='alt'" : "") + "><td>" + name3 + "</td><td>" + sec[name3] + "</td></tr>";
                    even = !even;
                }
            }

            if (eng.len > 0)
            {
                dat += "<tr><th colspan=3>Engineering</th></tr>";

                foreach (dynamic _d in Lang13.Enumerate(eng))
                {
                    name4 = _d;

                    dat += "<tr" + (even ? " class='alt'" : "") + "><td>" + name4 + "</td><td>" + eng[name4] + "</td></tr>";
                    even = !even;
                }
            }

            if (med.len > 0)
            {
                dat += "<tr><th colspan=3>Medical</th></tr>";

                foreach (dynamic _e in Lang13.Enumerate(med))
                {
                    name5 = _e;

                    dat += "<tr" + (even ? " class='alt'" : "") + "><td>" + name5 + "</td><td>" + med[name5] + "</td></tr>";
                    even = !even;
                }
            }

            if (sci.len > 0)
            {
                dat += "<tr><th colspan=3>Science</th></tr>";

                foreach (dynamic _f in Lang13.Enumerate(sci))
                {
                    name6 = _f;

                    dat += "<tr" + (even ? " class='alt'" : "") + "><td>" + name6 + "</td><td>" + sci[name6] + "</td></tr>";
                    even = !even;
                }
            }

            if (sup.len > 0)
            {
                dat += "<tr><th colspan=3>Supply</th></tr>";

                foreach (dynamic _g in Lang13.Enumerate(sup))
                {
                    name7 = _g;

                    dat += "<tr" + (even ? " class='alt'" : "") + "><td>" + name7 + "</td><td>" + sup[name7] + "</td></tr>";
                    even = !even;
                }
            }

            if (civ.len > 0)
            {
                dat += "<tr><th colspan=3>Civilian</th></tr>";

                foreach (dynamic _h in Lang13.Enumerate(civ))
                {
                    name8 = _h;

                    dat += "<tr" + (even ? " class='alt'" : "") + "><td>" + name8 + "</td><td>" + civ[name8] + "</td></tr>";
                    even = !even;
                }
            }

            if (bot.len > 0)
            {
                dat += "<tr><th colspan=3>Silicon</th></tr>";

                foreach (dynamic _i in Lang13.Enumerate(bot))
                {
                    name9 = _i;

                    dat += "<tr" + (even ? " class='alt'" : "") + "><td>" + name9 + "</td><td>" + bot[name9] + "</td></tr>";
                    even = !even;
                }
            }

            if (misc.len > 0)
            {
                dat += "<tr><th colspan=3>Miscellaneous</th></tr>";

                foreach (dynamic _j in Lang13.Enumerate(misc))
                {
                    name10 = _j;

                    dat += "<tr" + (even ? " class='alt'" : "") + "><td>" + name10 + "</td><td>" + misc[name10] + "</td></tr>";
                    even = !even;
                }
            }
            dat += "</table>";
            dat  = GlobalFuncs.replacetext(dat, "\n", "");
            dat  = GlobalFuncs.replacetext(dat, "	", "");
            return(dat);
        }
        // Function from file: chem_grenade.dm
        public ByTable can_flood_from(Ent_Static myloc = null, int?maxrange = null)
        {
            dynamic myturf    = null;
            ByTable reachable = null;
            int?    i         = null;
            ByTable turflist  = null;
            dynamic T         = null;
            dynamic T2        = null;
            dynamic T3        = null;
            dynamic NT        = null;

            myturf    = GlobalFuncs.get_turf(myloc);
            reachable = new ByTable(new object [] { myloc });
            i         = null;
            i         = 1;

            while ((i ?? 0) <= (maxrange ?? 0))
            {
                turflist = new ByTable();

                foreach (dynamic _a in Lang13.Enumerate(Map13.FetchInRangeExcludeThis(myloc, i) - Map13.FetchInRangeExcludeThis(myloc, (i ?? 0) - 1)))
                {
                    T = _a;

                    turflist.Or(T);
                }

                foreach (dynamic _b in Lang13.Enumerate(turflist))
                {
                    T2 = _b;


                    if (!GlobalVars.cardinal.Contains(Map13.GetDistance(T2, myloc)) && Math.Abs(Convert.ToDouble(T2.x - myturf.x)) == Math.Abs(Convert.ToDouble(T2.y - myturf.y)))
                    {
                        turflist.Remove(T2);
                        turflist.Add(T2);
                    }
                }

                foreach (dynamic _d in Lang13.Enumerate(turflist))
                {
                    T3 = _d;


                    if (reachable.Contains(T3))
                    {
                        continue;
                    }

                    foreach (dynamic _c in Lang13.Enumerate(Map13.FetchInRangeExcludeThis(T3, 1)))
                    {
                        NT = _c;


                        if (!reachable.Contains(NT))
                        {
                            continue;
                        }

                        if (!GlobalVars.cardinal.Contains(Map13.GetDistance(T3, NT)))
                        {
                            continue;
                        }

                        if (!Lang13.Bool(NT.CanAtmosPass(T3)))
                        {
                            continue;
                        }
                        reachable.Or(T3);
                        break;
                    }
                }
                i++;
            }
            return(reachable);
        }
        // Function from file: chem_grenade.dm
        public override void prime(  )
        {
            bool     has_reagents          = false;
            Obj_Item I                     = null;
            dynamic  M                     = null;
            dynamic  last                  = null;
            dynamic  T                     = null;
            dynamic  A                     = null;
            dynamic  DT                    = null;
            dynamic  DA                    = null;
            EffectSystem_SteamSpread steam = null;
            ByTable    viewable            = null;
            ByTable    accessible          = null;
            ByTable    reactable           = null;
            ByTable    mycontents          = null;
            dynamic    T2                  = null;
            Ent_Static A2                  = null;
            double?    fraction            = null;
            Ent_Static A3                  = null;


            if (this.stage != 3 || !(this.reagents != null))
            {
                return;
            }

            foreach (dynamic _a in Lang13.Enumerate(this.beakers, typeof(Obj_Item)))
            {
                I = _a;


                if (Lang13.Bool(I.reagents.total_volume))
                {
                    has_reagents = true;
                }
            }

            if (!has_reagents)
            {
                GlobalFuncs.playsound(this.loc, "sound/items/Screwdriver2.ogg", 50, 1);
                return;
            }

            if (Lang13.Bool(this.nadeassembly))
            {
                M    = GlobalFuncs.get_mob_by_ckey(this.assemblyattacher);
                last = GlobalFuncs.get_mob_by_ckey(this.nadeassembly.fingerprintslast);
                T    = GlobalFuncs.get_turf(this);
                A    = GlobalFuncs.get_area(T);
                GlobalFuncs.message_admins(new Txt("grenade primed by an assembly, attached by ").item(GlobalFuncs.key_name_admin(M)).str("<A HREF='?_src_=holder;adminmoreinfo=").Ref(M).str("'>(?)</A> (<A HREF='?_src_=holder;adminplayerobservefollow=").Ref(M).str("'>FLW</A>) and last touched by ").item(GlobalFuncs.key_name_admin(last)).str("<A HREF='?_src_=holder;adminmoreinfo=").Ref(last).str("'>(?)</A> (<A HREF='?_src_=holder;adminplayerobservefollow=").Ref(last).str("'>FLW</A>) (").item(this.nadeassembly.a_left.name).str(" and ").item(this.nadeassembly.a_right.name).str(") at <A HREF='?_src_=holder;adminplayerobservecoodjump=1;X=").item(T.x).str(";Y=").item(T.y).str(";Z=").item(T.z).str("'>").item(A.name).str(" (JMP)</a>.").ToString());
                GlobalFuncs.log_game("grenade primed by an assembly, attached by " + GlobalFuncs.key_name(M) + " and last touched by " + GlobalFuncs.key_name(last) + " (" + this.nadeassembly.a_left.name + " and " + this.nadeassembly.a_right.name + ") at " + A.name + " (" + T.x + ", " + T.y + ", " + T.z + ")");
            }
            GlobalFuncs.playsound(this.loc, "sound/effects/bamf.ogg", 50, 1);
            DT = GlobalFuncs.get_turf(this);
            DA = GlobalFuncs.get_area(DT);
            GlobalFuncs.log_game("A grenade detonated at " + DA.name + " (" + DT.x + ", " + DT.y + ", " + DT.z + ")");
            this.update_mob();
            this.mix_reagents();

            if (Lang13.Bool(this.reagents.total_volume))
            {
                steam = new EffectSystem_SteamSpread();
                steam.set_up(10, 0, GlobalFuncs.get_turf(this));
                steam.attach(this);
                steam.start();
                viewable   = Map13.FetchInView(this.loc, this.affected_area);
                accessible = this.can_flood_from(this.loc, this.affected_area);
                reactable  = accessible;
                mycontents = this.GetAllContents();

                foreach (dynamic _c in Lang13.Enumerate(accessible))
                {
                    T2 = _c;


                    foreach (dynamic _b in Lang13.Enumerate(((Ent_Static)T2).GetAllContents(), typeof(Ent_Static)))
                    {
                        A2 = _b;


                        if (mycontents.Contains(A2))
                        {
                            continue;
                        }

                        if (!viewable.Contains(A2))
                        {
                            continue;
                        }
                        reactable.Or(A2);
                    }
                }

                if (!(reactable.len != 0))
                {
                    GlobalFuncs.qdel(this);
                    return;
                }
                fraction = 1 / reactable.len;

                foreach (dynamic _d in Lang13.Enumerate(reactable, typeof(Ent_Static)))
                {
                    A3 = _d;

                    this.reagents.reaction(A3, GlobalVars.TOUCH, fraction);
                }
            }
            GlobalFuncs.qdel(this);
            return;
        }
Exemple #29
0
        // Function from file: items.dm
        public override dynamic attackby(dynamic A = null, dynamic user = null, string _params = null, bool?silent = null, bool?replace_spent = null)
        {
            dynamic  S          = null;
            ByTable  rejections = null;
            bool     success    = false;
            bool     failure    = false;
            Obj_Item I          = null;


            if (A is Obj_Item_Weapon_Storage)
            {
                S = A;

                if (S.use_to_pickup)
                {
                    if (S.collection_mode != 0)
                    {
                        if (this.loc is Tile)
                        {
                            rejections = new ByTable();
                            success    = false;
                            failure    = false;

                            foreach (dynamic _a in Lang13.Enumerate(this.loc, typeof(Obj_Item)))
                            {
                                I = _a;


                                if (S.collection_mode == 2 && !Lang13.Bool(((dynamic)this.type).IsInstanceOfType(I)))
                                {
                                    failure = true;
                                    continue;
                                }

                                if (rejections.Contains(I.type))
                                {
                                    continue;
                                }

                                if (!((Obj_Item_Weapon_Storage)S).can_be_inserted(I))
                                {
                                    rejections.Add(I.type);
                                    failure = true;
                                    continue;
                                }
                                success = true;
                                ((Obj_Item_Weapon_Storage)S).handle_item_insertion(I, true);
                            }

                            if (success && !failure)
                            {
                                user.WriteMsg("<span class='notice'>You put everything " + S.preposition + " " + S + ".</span>");
                            }
                            else if (success)
                            {
                                user.WriteMsg("<span class='notice'>You put some things " + S.preposition + " " + S + ".</span>");
                            }
                            else
                            {
                                user.WriteMsg("<span class='warning'>You fail to pick anything up with " + S + "!</span>");
                            }
                        }
                    }
                    else if (((Obj_Item_Weapon_Storage)S).can_be_inserted(this))
                    {
                        ((Obj_Item_Weapon_Storage)S).handle_item_insertion(this);
                    }
                }
            }
            return(null);
        }
Exemple #30
0
        // Function from file: turf_teleport.dm
        public override bool cast(dynamic targets = null, dynamic thearea = null, dynamic user = null)
        {
            thearea = thearea ?? Task13.User;

            Mob_Living target             = null;
            ByTable    turfs              = null;
            dynamic    T                  = null;
            ByTable    turfs_to_pick_from = null;
            dynamic    T2                 = null;
            dynamic    picked             = null;

            GlobalFuncs.playsound(GlobalFuncs.get_turf(thearea), this.sound1, 50, 1);

            foreach (dynamic _c in Lang13.Enumerate(targets, typeof(Mob_Living)))
            {
                target = _c;

                turfs = new ByTable();

                foreach (dynamic _a in Lang13.Enumerate(Map13.FetchInRange(this.outer_tele_radius, target)))
                {
                    T = _a;


                    if (Map13.FetchInRange(this.inner_tele_radius, target).Contains(T))
                    {
                        continue;
                    }

                    if (T is Tile_Space && !this.include_space)
                    {
                        continue;
                    }

                    if (T.density && !this.include_dense)
                    {
                        continue;
                    }

                    if (Convert.ToDouble(T.x) > Game13.map_size_x - this.outer_tele_radius || Convert.ToDouble(T.x) < this.outer_tele_radius)
                    {
                        continue;
                    }

                    if (Convert.ToDouble(T.y) > Game13.map_size_y - this.outer_tele_radius || Convert.ToDouble(T.y) < this.outer_tele_radius)
                    {
                        continue;
                    }
                    turfs.Add(T);
                }

                if (!(turfs.len != 0))
                {
                    turfs_to_pick_from = new ByTable();

                    foreach (dynamic _b in Lang13.Enumerate(Map13.FetchInRangeExcludeThis(this.outer_tele_radius, target)))
                    {
                        T2 = _b;


                        if (!Map13.FetchInRangeExcludeThis(this.inner_tele_radius, target).Contains(T2))
                        {
                            turfs_to_pick_from.Add(T2);
                        }
                    }
                    turfs.Add(Rand13.PickFromTable(turfs_to_pick_from.Contains(typeof(Tile))));
                }
                picked = Rand13.PickFromTable(turfs);

                if (!Lang13.Bool(picked) || !(picked is Tile))
                {
                    return(false);
                }

                if (!target.Move(picked))
                {
                    if (target.buckled != null)
                    {
                        target.buckled.unbuckle_mob();
                    }

                    if (Lang13.Bool(target.buckled_mob))
                    {
                        target.unbuckle_mob(true);
                    }
                    target.loc = picked;
                    GlobalFuncs.playsound(GlobalFuncs.get_turf(thearea), this.sound2, 50, 1);
                }
            }
            return(false);
        }