// Function from file: shuffle.dm
        public override bool start(  )
        {
            ByTable mobs = null;
            Mob_Living_Carbon_Human H = null;
            Obj_Effect_ProcHolder_Spell_Targeted_MindTransfer swapper = null;
            dynamic H2 = null;
            Mob_Living_Carbon_Human  H3    = null;
            EffectSystem_SmokeSpread smoke = null;

            mobs = new ByTable();

            foreach (dynamic _a in Lang13.Enumerate(GlobalVars.living_mob_list, typeof(Mob_Living_Carbon_Human)))
            {
                H = _a;


                if (!(H.stat != 0) || !(H.mind != null) || GlobalVars.ticker.mode.wizards.Contains(H.mind) || GlobalVars.ticker.mode.apprentices.Contains(H.mind))
                {
                    continue;
                }
                mobs.Add(H);
            }

            if (!(mobs != null))
            {
                return(false);
            }
            GlobalFuncs.shuffle(mobs);
            swapper = new Obj_Effect_ProcHolder_Spell_Targeted_MindTransfer();

            while (mobs.len > 1)
            {
                H2 = Rand13.PickFromTable(mobs);
                mobs.Remove(H2);
                swapper.cast(new ByTable(new object [] { H2 }), mobs[mobs.len], 1);
                mobs.Remove(mobs[mobs.len]);
            }

            foreach (dynamic _b in Lang13.Enumerate(GlobalVars.living_mob_list, typeof(Mob_Living_Carbon_Human)))
            {
                H3 = _b;

                smoke = new EffectSystem_SmokeSpread();
                smoke.set_up(0, H3.loc);
                smoke.start();
            }
            return(false);
        }
Esempio n. 2
0
        // Function from file: mutations.dm
        public virtual dynamic on_losing(dynamic owner = null)
        {
            ByTable mut_overlay = null;


            if (Lang13.Bool(owner) && owner is Mob_Living_Carbon_Human && Lang13.Bool(owner.dna.mutations.Remove(this)))
            {
                if (Lang13.Bool(this.text_lose_indication) && Convert.ToInt32(owner.stat) != 2)
                {
                    owner.WriteMsg(this.text_lose_indication);
                }

                if (this.visual_indicators.len != 0)
                {
                    mut_overlay = new ByTable();

                    if (Lang13.Bool(owner.overlays_standing[this.layer_used]))
                    {
                        mut_overlay = owner.overlays_standing[this.layer_used];
                    }
                    ((Mob_Living_Carbon)owner).remove_overlay(this.layer_used);
                    mut_overlay.Remove(this.get_visual_indicator(owner));
                    owner.overlays_standing[this.layer_used] = mut_overlay;
                    ((Mob_Living_Carbon)owner).apply_overlay(this.layer_used);
                }
                return(0);
            }
            return(1);
        }
Esempio n. 3
0
        // Function from file: abduction.dm
        public Objective_Abductee_Capture(string text = null) : base(text)
        {
            ByTable jobs   = null;
            Job     J      = null;
            dynamic target = null;

            jobs = GlobalVars.SSjob.occupations.Copy();

            foreach (dynamic _a in Lang13.Enumerate(jobs, typeof(Job)))
            {
                J = _a;


                if ((J.current_positions ?? 0) < 1)
                {
                    jobs.Remove(J);
                }
            }

            if (jobs.len > 0)
            {
                target = Rand13.PickFromTable(jobs);
                this.explanation_text += " a " + target.title + ".";
            }
            else
            {
                this.explanation_text += " someone.";
            }
            return;
        }
Esempio n. 4
0
        // Function from file: zlevel.dm
        public void Load(ByTable potentialRuins = null, MapTemplate template = null)
        {
            potentialRuins = potentialRuins ?? GlobalVars.space_ruins_templates;


            if (potentialRuins.len != 0)
            {
                Game13.WriteMsg("<span class='boldannounce'>Loading ruins...</span>");

                if (!(template != null))
                {
                    template = potentialRuins[Rand13.PickFromTable(potentialRuins)];
                }
                template.load(GlobalFuncs.get_turf(this), GlobalVars.TRUE);
                potentialRuins.Remove(template);
                Game13.WriteMsg("<span class='boldannounce'>Ruins loaded.</span>");
            }
            else
            {
                Game13.WriteMsg("<span class='boldannounce'>No ruins found.</span>");
                return;
            }
            GlobalFuncs.qdel(this);
            return;
        }
        // Function from file: mining_mobs.dm
        public Obj_Effect_GoliathTentacle_Original(dynamic loc = null) : base((object)(loc))
        {
            Obj_Effect_GoliathTentacle_Original O = null;
            ByTable directions = null;
            int?    counter    = null;
            dynamic spawndir   = null;
            Tile    T          = null;


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


                if (O != this)
                {
                    GlobalFuncs.qdel(this);
                }
            }
            directions = GlobalVars.cardinal.Copy();
            counter    = null;
            counter    = 1;

            while ((counter ?? 0) <= 3)
            {
                spawndir = Rand13.PickFromTable(directions);
                directions.Remove(spawndir);
                T = Map13.GetStep(this, Convert.ToInt32(spawndir));
                new Obj_Effect_GoliathTentacle(T);
                counter++;
            }
            // Warning: Super call was HERE! If anything above HERE is needed by the super call, it might break!;
            return;
        }
        // Function from file: interactive.dm
        public void random(  )
        {
            ByTable jobs = null;
            dynamic job  = null;
            dynamic J    = null;

            this.age = Rand13.Int(17, 85);
            jobs     = GlobalVars.SSjob.occupations.Copy();

            foreach (dynamic _a in Lang13.Enumerate(jobs))
            {
                job = _a;

                J = job;

                if (J.title == "Cyborg" || J.title == "AI" || J.title == "Chaplain" || J.title == "Mime")
                {
                    jobs.Remove(J);
                }
            }
            this.myjob = Rand13.PickFromTable(jobs);
            this.job   = this.myjob.title;

            if (!this.graytide)
            {
                this.myjob.equip(this);
            }
            ((Job)this.myjob).apply_fingerprints(this);
            return;
        }
Esempio n. 7
0
        // Function from file: mecha_wreckage.dm
        public Obj_Structure_MechaWreckage_Ripley(dynamic loc = null) : base((object)(loc))
        {
            ByTable parts = null;
            int?    i     = null;
            dynamic part  = null;

            // Warning: Super call was HERE! If anything above HERE is needed by the super call, it might break!;
            parts = new ByTable(new object [] {
                typeof(Obj_Item_MechaParts_Part_RipleyTorso),
                typeof(Obj_Item_MechaParts_Part_RipleyLeftArm),
                typeof(Obj_Item_MechaParts_Part_RipleyRightArm),
                typeof(Obj_Item_MechaParts_Part_RipleyLeftLeg),
                typeof(Obj_Item_MechaParts_Part_RipleyRightLeg)
            });
            i = null;
            i = 0;

            while ((i ?? 0) < 2)
            {
                if (parts.len != 0 && Rand13.PercentChance(40))
                {
                    part = Rand13.PickFromTable(parts);
                    this.welder_salvage.Add(part);
                    parts.Remove(part);
                }
                i++;
            }
            return;
        }
Esempio n. 8
0
        // Function from file: communications.dm
        public void remove_listener(Obj device = null)
        {
            dynamic devices_filter = null;
            ByTable devices_line   = null;


            foreach (dynamic _a in Lang13.Enumerate(this.devices))
            {
                devices_filter = _a;

                devices_line = this.devices[devices_filter];

                if (!(devices_line != null))
                {
                    this.devices.Remove(devices_filter);
                }
                devices_line.Remove(device);

                if (!(devices_line.len != 0))
                {
                    this.devices.Remove(devices_filter);
                }
            }
            return;
        }
Esempio n. 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;
        }
Esempio n. 10
0
        // Function from file: abductor.dm
        public bool makeAbductorTeam(  )
        {
            ByTable candidates                = null;
            int?    number                    = null;
            dynamic temp                      = null;
            dynamic agent_mind                = null;
            dynamic scientist_mind            = null;
            Mob_Living_Carbon_Human agent     = null;
            Mob_Living_Carbon_Human scientist = null;

            candidates = GlobalFuncs.pollCandidates("Do you wish to be considered for an Abductor Team?", "abductor", null, "abductor");

            if (candidates.len >= 2)
            {
                number = (GlobalVars.ticker.mode.abductor_teams ?? 0) + 1;

                if (GlobalVars.ticker.mode.config_tag == "abduction")
                {
                    temp = GlobalVars.ticker.mode;
                }
                else
                {
                    temp = new GameMode_Abduction();
                }
                agent_mind = Rand13.PickFromTable(candidates);
                candidates.Remove(agent_mind);
                scientist_mind           = Rand13.PickFromTable(candidates);
                agent                    = GlobalFuncs.makeBody(agent_mind);
                scientist                = GlobalFuncs.makeBody(scientist_mind);
                agent_mind               = agent.mind;
                scientist_mind           = scientist.mind;
                temp.scientists.len      = number ?? 0;
                temp.agents.len          = number ?? 0;
                temp.abductors.len       = (number ?? 0) * 2;
                temp.team_objectives.len = number ?? 0;
                temp.team_names.len      = number ?? 0;
                temp.scientists[number]  = scientist_mind;
                temp.agents[number]      = agent_mind;
                temp.abductors.Or(new ByTable(new object [] { agent_mind, scientist_mind }));
                ((GameMode_Abduction)temp).make_abductor_team(number, agent_mind, scientist_mind);
                ((GameMode_Abduction)temp).post_setup_team(number);
                GlobalVars.ticker.mode.abductor_teams++;

                if (GlobalVars.ticker.mode.config_tag != "abduction")
                {
                    GlobalVars.ticker.mode.abductors.Or(temp.abductors);
                }
                this.processing = true;
                return(true);
            }
            else
            {
                return(false);
            }
        }
        // Function from file: traitor_chan.dm
        public override bool pre_setup(  )
        {
            ByTable possible_changelings = null;
            int?    num_changelings      = null;
            int?    j          = null;
            dynamic changeling = null;


            if (GlobalVars.config.protect_roles_from_antagonist)
            {
                this.restricted_jobs.Add(this.protected_jobs);
            }

            if (GlobalVars.config.protect_assistant_from_antagonist)
            {
                this.restricted_jobs.Add("Assistant");
            }
            possible_changelings = this.get_players_for_role("changeling");
            num_changelings      = 1;

            if (Lang13.Bool(GlobalVars.config.changeling_scaling_coeff))
            {
                num_changelings = Num13.MaxInt(1, Num13.MinInt(Num13.Floor(this.num_players() / ((GlobalVars.config.changeling_scaling_coeff ?? 0) * 4)) + 2, Num13.Floor(this.num_players() / ((GlobalVars.config.changeling_scaling_coeff ?? 0) * 2))));
            }
            else
            {
                num_changelings = Num13.MaxInt(1, Num13.MinInt(this.num_players(), ((int)(0.5))));
            }

            if (possible_changelings.len > 0)
            {
                j = null;
                j = 0;

                while ((j ?? 0) < (num_changelings ?? 0))
                {
                    if (!(possible_changelings.len != 0))
                    {
                        break;
                    }
                    changeling = Rand13.PickFromTable(possible_changelings);
                    possible_changelings.Remove(changeling);
                    this.changelings.Add(changeling);
                    this.modePlayer.Add(this.changelings);
                    changeling.restricted_roles = this.restricted_jobs;
                    j++;
                }
                return(base.pre_setup());
            }
            else
            {
                return(false);
            }
        }
Esempio n. 12
0
        // Function from file: mutations.dm
        public override dynamic say_mod(dynamic message = null)
        {
            string  prefix     = null;
            ByTable words      = null;
            ByTable rearranged = null;
            int?    i          = null;
            dynamic cword      = null;
            string  suffix     = null;


            if (Lang13.Bool(message))
            {
                prefix = String13.SubStr(message, 1, 2);

                if (prefix == ";")
                {
                    message = String13.SubStr(message, 2, 0);
                }
                else if (new ByTable(new object [] { ":", "#" }).Contains(prefix))
                {
                    prefix += String13.SubStr(message, 2, 3);
                    message = String13.SubStr(message, 3, 0);
                }
                else
                {
                    prefix = "";
                }
                words      = GlobalFuncs.splittext(message, " ");
                rearranged = new ByTable();
                i          = null;
                i          = 1;

                while ((i ?? 0) <= words.len)
                {
                    cword = Rand13.PickFromTable(words);
                    words.Remove(cword);
                    suffix = String13.SubStr(cword, Lang13.Length(cword) - 1, Lang13.Length(cword));

                    while (new ByTable(new object [] { ".", ",", ";", "!", ":", "?" }).Contains(Lang13.Length(cword) > 0 && Lang13.Bool(suffix)))
                    {
                        cword  = String13.SubStr(cword, 1, Lang13.Length(cword) - 1);
                        suffix = String13.SubStr(cword, Lang13.Length(cword) - 1, Lang13.Length(cword));
                    }

                    if (Lang13.Length(cword) != 0)
                    {
                        rearranged.Add(cword);
                    }
                    i++;
                }
                message = "" + prefix + String13.ToUpper(GlobalFuncs.jointext(rearranged, " ")) + "!!";
            }
            return(message);
        }
Esempio n. 13
0
        // Function from file: tgui.dm
        public override dynamic Topic(string href = null, ByTable href_list = null, dynamic hsrc = null)
        {
            string  action  = null;
            ByTable _params = null;


            if (this.user != Task13.User)
            {
                return(null);
            }
            action  = href_list["action"];
            _params = href_list;
            _params.Remove("action");

            switch ((string)(action))
            {
            case "tgui:initialize":
                Interface13.Output(this.user, String13.UrlEncode(this.get_json(this.initial_data), false), "" + this.window_id + ".browser:initialize");
                this.initialized = GlobalVars.TRUE;
                break;

            case "tgui:view":

                if (Lang13.Bool(_params["screen"]))
                {
                    this.src_object.ui_screen = _params["screen"];
                }
                GlobalVars.SStgui.update_uis(this.src_object);
                break;

            case "tgui:link":
                Interface13.Link(this.user, _params["url"]);
                break;

            case "tgui:fancy":
                this.user.client.prefs.tgui_fancy = GlobalVars.TRUE;
                break;

            case "tgui:nofrills":
                this.user.client.prefs.tgui_fancy = GlobalVars.FALSE;
                break;

            default:
                this.update_status(false);

                if (Lang13.Bool(this.src_object.ui_act(action, _params, this, this.state)))
                {
                    GlobalVars.SStgui.update_uis(this.src_object);
                }
                break;
            }
            return(null);
        }
Esempio n. 14
0
        // Function from file: portable_turret.dm
        public bool tryToShootAt(ByTable targets = null)
        {
            dynamic M = null;


            while (targets.len > 0)
            {
                M = Rand13.PickFromTable(targets);
                targets.Remove(M);

                if (this.target(M))
                {
                    return(true);
                }
            }
            return(false);
        }
Esempio n. 15
0
        // Function from file: gas_mixture.dm
        public void garbage_collect(ByTable tocheck = null)
        {
            ByTable cached_gases = null;
            dynamic id           = null;

            cached_gases = this.gases;

            foreach (dynamic _a in Lang13.Enumerate(tocheck ?? cached_gases))
            {
                id = _a;


                if (Convert.ToDouble(cached_gases[id][1]) <= 0 && Convert.ToDouble(cached_gases[id][2]) <= 0)
                {
                    cached_gases.Remove(id);
                }
            }
            return;
        }
        // Function from file: interactive.dm
        public ByTable target_filter(ByTable target = null)
        {
            ByTable    L = null;
            Ent_Static A = null;

            L = target;

            foreach (dynamic _a in Lang13.Enumerate(target, typeof(Ent_Static)))
            {
                A = _a;


                if (A is Zone || A is Tile_Space)
                {
                    L.Remove(A);
                }
            }
            return(L);
        }
Esempio n. 17
0
        // Function from file: blob.dm
        public int?make_blobs(int?count = null)
        {
            ByTable candidates = null;
            dynamic blob       = null;
            int?    i          = null;

            candidates = this.get_blob_candidates();
            blob       = null;
            count      = Num13.MinInt(count ?? 0, candidates.len);
            i          = null;
            i          = 0;

            while ((i ?? 0) < (count ?? 0))
            {
                blob = Rand13.PickFromTable(candidates);
                candidates.Remove(blob);
                this.blobize(blob);
                i++;
            }
            return(count);
        }
        // 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);
        }
Esempio n. 19
0
        // Function from file: spider_infestation.dm
        public override bool start(  )
        {
            ByTable vents = null;
            Obj_Machinery_Atmospherics_Components_Unary_VentPump temp_vent = null;
            Pipeline temp_vent_parent      = null;
            dynamic  vent                  = null;
            Obj_Effect_Spider_Spiderling S = null;

            vents = new ByTable();

            foreach (dynamic _a in Lang13.Enumerate(typeof(Game13), typeof(Obj_Machinery_Atmospherics_Components_Unary_VentPump)))
            {
                temp_vent = _a;


                if (temp_vent.loc.z == 1 && !(temp_vent.welded == true))
                {
                    temp_vent_parent = temp_vent.parents[1];

                    if (temp_vent_parent.other_atmosmch.len > 20)
                    {
                        vents.Add(temp_vent);
                    }
                }
            }

            while (this.spawncount >= 1 && vents.len != 0)
            {
                vent = Rand13.PickFromTable(vents);
                S    = new Obj_Effect_Spider_Spiderling(vent.loc);

                if (Rand13.PercentChance(66))
                {
                    S.grow_as = typeof(Mob_Living_SimpleAnimal_Hostile_Poison_GiantSpider_Nurse);
                }
                vents.Remove(vent);
                this.spawncount--;
            }
            return(false);
        }
Esempio n. 20
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: 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);
        }
Esempio n. 22
0
		// Range: -1 Access: 0 Flags: ( 0, 4, 255 )
		public static int maprotate(  ) {
			int _default = 0;
			int players = 0;
			ByTable mapvotes = null;
			dynamic c = null;
			dynamic vote = null;
			dynamic map = null;
			dynamic VM = null;
			dynamic pickedmap = null;
			dynamic VM2 = null;
			return _default;
			players = GlobalVars.clients.len;
			mapvotes = new ByTable();
			c = null;
			foreach (dynamic _a in GlobalVars.clients ) {
				c = _a;
				if ( !Lang13.Bool( ((dynamic)typeof(Client)).IsInstanceOfType( c ) ) ) {
					continue;
				}
				vote = c.prefs.preferred_map;
				if ( !Lang13.Bool( vote ) ) {
					if ( Lang13.Bool( GlobalVars.config.defaultmap ) ) {
						mapvotes[GlobalVars.config.defaultmap.name] += 1;
					}
					continue;
				}
				mapvotes[vote] += 1;
			};
			map = null;
			foreach (dynamic _b in mapvotes ) {
				map = _b;
				if ( !Lang13.Bool( map ) ) {
					mapvotes.Remove( map );
				}
				if ( !GlobalVars.config.maplist.contains( map ) ) {
					mapvotes.Remove( map );
					continue;
				}
				VM = GlobalVars.config.maplist[map];
				if ( !Lang13.Bool( VM ) ) {
					mapvotes.Remove( map );
					continue;
				}
				if ( Lang13.Double( VM.voteweight ) <= 0 ) {
					mapvotes.Remove( map );
					continue;
				}
				if ( Lang13.Double( VM.minusers ) > 0 && players < Lang13.Double( VM.minusers ) ) {
					mapvotes.Remove( map );
					continue;
				}
				if ( Lang13.Double( VM.maxusers ) > 0 && players > Lang13.Double( VM.maxusers ) ) {
					mapvotes.Remove( map );
					continue;
				}
				mapvotes[map] = mapvotes[map] * VM.voteweight;
			};
			pickedmap = GlobalFuncs.pickweight( mapvotes );
			if ( !Lang13.Bool( pickedmap ) ) {
				return _default;
			}
			VM2 = GlobalVars.config.maplist[pickedmap];
			GlobalFuncs.message_admins( "Randomly rotating map to " + VM2.name + "(" + VM2.friendlyname + ")" );
			_default = GlobalFuncs.changemap( VM2 );
			if ( _default == 0 ) {
				Game13.write( "<span class='boldannounce'>Map rotation has chosen " + VM2.friendlyname + " for next round!</span>" );
			}
			return _default;
		}
Esempio n. 23
0
		// Range: -1 Access: 0 Flags: ( 0, 4, 255 )
		public static ByTable pollCandidates( string Question = null, string jobbanType = null, GameMode gametypeCheck = null, dynamic be_special_flag = null, int? poll_time = null ) {
			ByTable candidates = null;
			int time_passed = 0;
			Mob_Dead_Observer G = null;
			Mob_Dead_Observer G2 = null;
			if ( be_special_flag == null ) {
				be_special_flag = 0;
			}
			if ( poll_time == null ) {
				poll_time = 300;
			}
			candidates = new ByTable();
			time_passed = Game13.time;
			if ( !Lang13.Bool( Question ) ) {
				Question = "Would you like to be a special role?";
			}
			G = null;
			foreach (dynamic _b in GlobalVars.player_list ) {
				if ( !( _b is Mob_Dead_Observer ) ) {
					continue;
				}
				G = _b;
				if ( !Lang13.Bool( ((dynamic)G).key ) || !Lang13.Bool( ((dynamic)G).client ) ) {
					continue;
				}
				if ( Lang13.Bool( be_special_flag ) ) {
					if ( !Lang13.Bool( ((dynamic)G).client.prefs.be_special & be_special_flag ) ) {
						continue;
					}
				}
				if ( gametypeCheck != null ) {
					if ( !gametypeCheck.age_check( ((dynamic)G).client ) ) {
						continue;
					}
				}
				if ( Lang13.Bool( jobbanType ) ) {
					if ( Lang13.Bool( GlobalFuncs.jobban_isbanned( G, jobbanType ) ) || Lang13.Bool( GlobalFuncs.jobban_isbanned( G, "Syndicate" ) ) ) {
						continue;
					}
				}
				Task13.schedule( 0, (Task13.Closure)(() => {
					((dynamic)G).write( "sound/misc/notice2.ogg" );
					dynamic _a = GlobalFuncs.askuser( G, Question, "Please answer in " + ( poll_time ??0) / 10 + " seconds!", "Yes", "No", null, false, poll_time ); // Was a switch-case, sorry for the mess.
					if ( _a==1 ) {
						((dynamic)G).write( "<span class='notice'>Choice registered: Yes.</span>" );
						if ( Game13.time - time_passed > ( poll_time ??0) ) {
							((dynamic)G).write( "<span class='danger'>Sorry, you were too late for the consideration!</span>" );
							((dynamic)G).write( "sound/machines/buzz-sigh.ogg" );
						} else {
							candidates += G;
						}
					} else if ( _a==2 ) {
						((dynamic)G).write( "<span class='danger'>Choice registered: No.</span>" );
					};
					return;
				}));
			};
			Task13.sleep( poll_time ??0 );
			G2 = null;
			foreach (dynamic _c in candidates ) {
				if ( !( _c is Mob_Dead_Observer ) ) {
					continue;
				}
				G2 = _c;
				if ( !Lang13.Bool( ((dynamic)G2).key ) || !Lang13.Bool( ((dynamic)G2).client ) ) {
					candidates.Remove( G2 );
				}
			};
			return candidates;
		}
Esempio n. 24
0
		// Range: -1 Access: 0 Flags: ( 0, 4, 255 )
		public static ByTable removeNullsFromList( ByTable L = null ) {
			while (L.Remove( null )) {
				continue;
			}
			return L;
		}
Esempio n. 25
0
		// Range: -1 Access: 0 Flags: ( 0, 4, 255 )
		public static void setup_map_transitions(  ) {
			ByTable SLS = null;
			dynamic D = null;
			int conf_set_len = 0;
			int k = 0;
			dynamic A = null;
			ByTable point_grid = null;
			ByTable grid = null;
			dynamic P = null;
			int? i = null;
			int? j = null;
			Point pnt = null;
			ByTable possible_points = null;
			ByTable used_points = null;
			dynamic A2 = null;
			ByTable x_pos_beginning = null;
			ByTable y_pos_beginning = null;
			ByTable x_pos_ending = null;
			ByTable y_pos_ending = null;
			ByTable x_pos_transition = null;
			ByTable y_pos_transition = null;
			int? zlevelnumber = null;
			int? side = null;
			Tile beginning = null;
			Tile ending = null;
			ByTable turfblock = null;
			double dirside = 0;
			int? zdestination = null;
			Tile_Space S = null;
			dynamic A3 = null;
			SLS = new ByTable();
			conf_set_len = GlobalVars.map_transition_config.len;
			k = 1;
			A = null;
			foreach (dynamic _a in GlobalVars.map_transition_config ) {
				A = _a;
				D = new SpaceLevel( GlobalVars.map_transition_config[A] );
				D.name = A;
				D.z_value = k;
				if ( Lang13.Double( D.linked ) < 2 ) {
					GlobalVars.z_levels_list["" + D.z_value] = D;
				} else {
					SLS.Add( D );
				}
				k++;
			};
			point_grid = null;
			point_grid = new ByTable( conf_set_len * 2 + 1, conf_set_len * 2 + 1 );
			grid = new ByTable();
			P = null;
			i = null;
			i = 1;
			while (( i ??0) <= conf_set_len * 2 + 1) {
				j = null;
				j = 1;
				while (( j ??0) <= conf_set_len * 2 + 1) {
					P = new Point( i, j, point_grid );
					point_grid[i][j] = P;
					grid.Add( P );
					j++;
				}
				i++;
			}
			pnt = null;
			foreach (dynamic _b in grid ) {
				if ( !( _b is Point ) ) {
					continue;
				}
				pnt = _b;
				pnt.set_neigbours( point_grid );
			};
			P = point_grid[conf_set_len + 1][conf_set_len + 1];
			possible_points = new ByTable();
			used_points = new ByTable();
			grid.Cut();
			while (SLS.len != 0) {
				D = Rand13.pick( SLS );
				SLS.Remove( D );
				D.xi = P.x;
				D.yi = P.y;
				P.spl = D;
				possible_points |= P.neigbours;
				used_points |= P;
				possible_points.Remove( used_points );
				((SpaceLevel)D).set_neigbours( used_points );
				P = Rand13.pick( possible_points );
				grid["" + D.z_value] = D;
			}
			A2 = null;
			foreach (dynamic _c in GlobalVars.z_levels_list ) {
				A2 = _c;
				grid[A2] = GlobalVars.z_levels_list[A2];
			};
			x_pos_beginning = new ByTable(new object [] { 1, 1, Game13.map_size_x - 7, 1 });
			y_pos_beginning = new ByTable(new object [] { Game13.map_size_y - 7, 1, 7, 7 });
			x_pos_ending = new ByTable(new object [] { Game13.map_size_x, Game13.map_size_x, Game13.map_size_x, 7 });
			y_pos_ending = new ByTable(new object [] { Game13.map_size_y, 7, Game13.map_size_y - 7, Game13.map_size_y - 7 });
			x_pos_transition = new ByTable(new object [] { 1, 1, 9, Game13.map_size_x - 7 - 2 });
			y_pos_transition = new ByTable(new object [] { 9, Game13.map_size_y - 7 - 2, 1, 1 });
			zlevelnumber = null;
			zlevelnumber = 1;
			while (( zlevelnumber ??0) <= grid.len) {
				D = grid["" + zlevelnumber];
				if ( !Lang13.Bool( D ) ) {
					Task13.crash( "" + zlevelnumber + " position has no space level datum." );
				}
				if ( !Lang13.Bool( D.neigbours.len ) ) {
					
				} else {
					side = null;
					side = 1;
					while (( side ??0) < 5) {
						beginning = Map13.get_tile_at( Lang13.Int( x_pos_beginning[side] ), Lang13.Int( y_pos_beginning[side] ), zlevelnumber ??0 );
						ending = Map13.get_tile_at( Lang13.Int( x_pos_ending[side] ), Lang13.Int( y_pos_ending[side] ), zlevelnumber ??0 );
						turfblock = Map13.fetch_in_block( beginning, ending );
						dirside = Math.Pow( 2, ( side ??0) - 1 );
						zdestination = zlevelnumber;
						if ( Lang13.Bool( D.neigbours["" + dirside] ) && D.neigbours["" + dirside] != D ) {
							D = D.neigbours["" + dirside];
							zdestination = Lang13.IntNullable( D.z_value );
						} else {
							dirside = Num13.rotate_dir( dirside, 180 );
							while (Lang13.Bool( D.neigbours["" + dirside] ) && D.neigbours["" + dirside] != D) {
								D = D.neigbours["" + dirside];
							}
							zdestination = Lang13.IntNullable( D.z_value );
						}
						D = grid["" + zlevelnumber];
						S = null;
						foreach (dynamic _d in turfblock ) {
							if ( !( _d is Tile_Space ) ) {
								continue;
							}
							S = _d;
							S.destination_x = ( x_pos_transition[side] == 1 ? ((dynamic)S).x : x_pos_transition[side] );
							S.destination_y = ( y_pos_transition[side] == 1 ? ((dynamic)S).y : y_pos_transition[side] );
							S.destination_z = zdestination;
						};
						side++;
					}
				}
				zlevelnumber++;
			}
			A3 = null;
			foreach (dynamic _e in grid ) {
				A3 = _e;
				GlobalVars.z_levels_list[A3] = grid[A3];
			};
			return;
		}
Esempio n. 26
0
        // Function from file: scrolls.dm
        public void teleportscroll(Mob user = null)
        {
            dynamic   A       = null;
            Base_Data thearea = null;
            EffectSystem_SmokeSpread smoke = null;
            ByTable L       = null;
            dynamic T       = null;
            bool    clear   = false;
            Obj     O       = null;
            ByTable tempL   = null;
            dynamic attempt = null;
            bool    success = false;

            A       = Interface13.Input(user, "Area to jump to", "BOOYEA", A, GlobalVars.teleportlocs, InputType.Any);
            thearea = GlobalVars.teleportlocs[A];

            if (!(user != null) || user.stat != 0 || user.restrained() || this.uses <= 0)
            {
                return;
            }

            if (!(user == this.loc || Map13.GetDistance(this, user) <= 1 && this.loc is Tile))
            {
                return;
            }
            smoke = new EffectSystem_SmokeSpread();
            smoke.set_up(2, user.loc);
            smoke.attach(user);
            smoke.start();
            L = new ByTable();

            foreach (dynamic _b in Lang13.Enumerate(GlobalFuncs.get_area_turfs(thearea.type)))
            {
                T = _b;


                if (!T.density)
                {
                    clear = true;

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


                        if (O.density)
                        {
                            clear = false;
                            break;
                        }
                    }

                    if (clear)
                    {
                        L.Add(T);
                    }
                }
            }

            if (!(L.len != 0))
            {
                user.WriteMsg("The spell matrix was unable to locate a suitable teleport destination for an unknown reason. Sorry.");
                return;
            }

            if (user != null && user.buckled != null)
            {
                user.buckled.unbuckle_mob();
            }
            tempL   = L.Copy();
            attempt = null;
            success = false;

            while (tempL.len != 0)
            {
                attempt = Rand13.PickFromTable(tempL);
                user.Move(attempt);

                if (GlobalFuncs.get_turf(user) == attempt)
                {
                    success = true;
                    break;
                }
                else
                {
                    tempL.Remove(attempt);
                }
            }

            if (!success)
            {
                user.loc = Rand13.PickFromTable(L);
            }
            smoke.start();
            this.uses -= 1;
            return;
        }
Esempio n. 27
0
        private void parse_grid(string model = null, int xcrd = 0, double ycrd = 0, int zcrd = 0)
        {
            ByTable members            = null;
            ByTable members_attributes = null;
            double  index            = 0;
            int     old_position     = 0;
            int     dpos             = 0;
            string  full_def         = null;
            Type    atom_def         = null;
            ByTable fields           = null;
            int     variables_start  = 0;
            ByTable turfs_underlays  = null;
            dynamic instance         = null;
            Tile    crds             = null;
            int     first_turf_index = 0;
            dynamic T  = null;
            dynamic UT = null;

            members            = new ByTable();
            members_attributes = new ByTable();
            index        = 1;
            old_position = 1;
            while (true)               // Was a do-while, sorry for the mess.
            {
                dpos     = this.find_next_delimiter_position(model, old_position, ",", "{", "}");
                full_def = String13.SubStr(model, old_position, dpos);
                string path = String13.SubStr(full_def, 1, String13.Find(full_def, "{", 1, 0));
                atom_def = Lang13.FindClass(path);
                members.Add(atom_def);
                old_position    = dpos + 1;
                fields          = new ByTable();
                variables_start = String13.Find(full_def, "{", 1, 0);
                if (variables_start != 0)
                {
                    full_def = String13.SubStr(full_def, variables_start + 1, Lang13.Length(full_def));
                    fields   = this.text2list(full_def, ";");
                }
                members_attributes.len++;
                members_attributes[index++] = fields;
                Task13.Sleep(-1);
                if (!(dpos != 0))
                {
                    break;
                }
            }

            turfs_underlays = new ByTable();
            index           = members.len;

            // Setup zone...
            GlobalVars._preloader.setup(members_attributes[index]);
            instance = Lang13.FindObj(members[index]);

            crds = Map13.GetTile(xcrd, ((int)(ycrd)), zcrd);
            if (crds != null)
            {
                instance.contents.Add(crds);
            }

            if (Lang13.Bool(GlobalVars.use_preloader) && Lang13.Bool(instance))
            {
                GlobalVars._preloader.load(instance);
            }

            members.Remove(members[index]);

            // Load tile(s?!?)
            first_turf_index = 1;
            while (members[first_turf_index] == null || !members[first_turf_index].IsSubclassOf(typeof(Tile)))
            {
                first_turf_index++;
            }

            try {
                T = this.instance_atom(members[first_turf_index], members_attributes[first_turf_index], xcrd, ycrd, zcrd);
            }
            catch (Exception e)
            {
                Logger.Error("Failed to init tile [" + members[first_turf_index] + "] at ( " + xcrd + ", " + ycrd + ", " + zcrd + " )", e);
            }

            if (Lang13.Bool(T))
            {
                index = first_turf_index + 1;
                while (index <= members.len)
                {
                    turfs_underlays.Insert(1, new Image(T.icon, null, T.icon_state, T.layer, T.dir));
                    UT = this.instance_atom(members[index], members_attributes[index], xcrd, ycrd, zcrd);
                    this.add_underlying_turf(UT, T, turfs_underlays);
                    T = UT;
                    index++;
                }
            }

            // Setup objs
            foreach (dynamic _a in Lang13.IterateRange(1, first_turf_index - 1))
            {
                index = _a;
                try {
                    this.instance_atom(members[index], members_attributes[index], xcrd, ycrd, zcrd);
                }
                catch (Exception e) {
                    Logger.Error("Failed to init object [" + members[index] + "] at ( " + xcrd + ", " + ycrd + ", " + zcrd + " )", e);
                }
            }
            return;
        }
Esempio n. 28
0
        // Function from file: reader.dm
        public void parse_grid(string model = null, int xcrd = 0, double ycrd = 0, int zcrd = 0)
        {
            ByTable members            = null;
            ByTable members_attributes = null;
            double  index            = 0;
            int     old_position     = 0;
            int     dpos             = 0;
            string  full_def         = null;
            Type    atom_def         = null;
            ByTable fields           = null;
            int     variables_start  = 0;
            ByTable turfs_underlays  = null;
            dynamic instance         = null;
            Tile    crds             = null;
            int     first_turf_index = 0;
            dynamic T  = null;
            dynamic UT = null;

            members            = new ByTable();
            members_attributes = new ByTable();
            index        = 1;
            old_position = 1;

            do
            {
                dpos     = this.find_next_delimiter_position(model, old_position, ",", "{", "}");
                full_def = String13.SubStr(model, old_position, dpos);
                atom_def = Lang13.FindClass(String13.SubStr(full_def, 1, String13.FindIgnoreCase(full_def, "{", 1, 0)));
                members.Add(atom_def);
                old_position    = dpos + 1;
                fields          = new ByTable();
                variables_start = String13.FindIgnoreCase(full_def, "{", 1, 0);

                if (variables_start != 0)
                {
                    full_def = String13.SubStr(full_def, variables_start + 1, Lang13.Length(full_def));
                    fields   = this.readlist(full_def, ";");
                }
                members_attributes.len++;
                members_attributes[index++] = fields;
                Task13.Sleep(-1);
            } while (dpos != 0);
            turfs_underlays = new ByTable();
            index           = members.len;
            GlobalVars._preloader.setup(members_attributes[index]);
            instance = Lang13.FindObj(members[index]);
            crds     = Map13.GetTile(xcrd, ((int)(ycrd)), zcrd);

            if (crds != null)
            {
                instance.contents.Add(crds);
            }

            if (Lang13.Bool(GlobalVars.use_preloader) && Lang13.Bool(instance))
            {
                GlobalVars._preloader.load(instance);
            }
            members.Remove(members[index]);
            first_turf_index = 1;

            while (!Lang13.Bool(members[first_turf_index].IsSubclassOf(typeof(Tile))))
            {
                first_turf_index++;
            }
            T = this.instance_atom(members[first_turf_index], members_attributes[first_turf_index], xcrd, ycrd, zcrd);

            if (Lang13.Bool(T))
            {
                index = first_turf_index + 1;

                while (index <= members.len)
                {
                    turfs_underlays.Insert(1, new Image(T.icon, null, T.icon_state, T.layer, T.dir));
                    UT = this.instance_atom(members[index], members_attributes[index], xcrd, ycrd, zcrd);
                    this.add_underlying_turf(UT, T, turfs_underlays);
                    T = UT;
                    index++;
                }
            }

            foreach (dynamic _a in Lang13.IterateRange(1, first_turf_index - 1))
            {
                index = _a;

                this.instance_atom(members[index], members_attributes[index], xcrd, ycrd, zcrd);
            }
            return;
        }
        // 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;
        }
Esempio n. 30
0
        // Function from file: pad.dm
        public void TeleportToArea(dynamic target = null, Base_Data thearea = null)
        {
            ByTable L       = null;
            dynamic T       = null;
            bool    clear   = false;
            Obj     O       = null;
            ByTable tempL   = null;
            dynamic attempt = null;
            bool    success = false;

            L = new ByTable();

            foreach (dynamic _b in Lang13.Enumerate(GlobalFuncs.get_area_turfs(thearea.type)))
            {
                T = _b;


                if (!T.density)
                {
                    clear = true;

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


                        if (O.density)
                        {
                            clear = false;
                            break;
                        }
                    }

                    if (clear)
                    {
                        L.Add(T);
                    }
                }
            }

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

            if (Lang13.Bool(target) && target.buckled != null)
            {
                target.buckled.unbuckle_mob();
            }
            tempL   = L;
            attempt = null;
            success = false;

            while (tempL.len != 0)
            {
                attempt = Rand13.PickFromTable(tempL);
                target.Move(attempt);

                if (GlobalFuncs.get_turf(target) == attempt)
                {
                    success = true;
                    break;
                }
                else
                {
                    tempL.Remove(attempt);
                }
            }

            if (!success)
            {
                target.loc = Rand13.PickFromTable(L);
            }
            return;
        }
        // Function from file: objective.dm
        public override int check_completion(  )
        {
            ByTable check_names = null;
            Mind    M           = null;
            dynamic mloc        = null;
            int     success     = 0;
            Mind    changeling  = null;
            dynamic H           = null;
            dynamic cloc        = null;
            dynamic name        = null;


            if (!(this.department_real_names.len != 0) || !(this.department_minds.len != 0))
            {
                return(1);
            }
            check_names = this.department_real_names.Copy();

            foreach (dynamic _a in Lang13.Enumerate(this.department_minds, typeof(Mind)))
            {
                M = _a;


                if (GlobalVars.ticker.mode.changelings.Contains(M))
                {
                    continue;
                }

                if (Lang13.Bool(M.current))
                {
                    mloc = GlobalFuncs.get_turf(M.current);

                    if (((Ent_Static)mloc).onCentcom() && Convert.ToInt32(M.current.stat) != 2)
                    {
                        return(0);
                    }
                }
            }
            success = 0;

            foreach (dynamic _c in Lang13.Enumerate(GlobalVars.ticker.mode.changelings, typeof(Mind)))
            {
                changeling = _c;


                if (success >= this.department_minds.len)
                {
                    return(1);
                }

                if (changeling.current is Mob_Living_Carbon_Human)
                {
                    H    = changeling.current;
                    cloc = GlobalFuncs.get_turf(changeling.current);

                    if (Lang13.Bool(cloc) && ((Ent_Static)cloc).onCentcom() && Convert.ToInt32(changeling.current.stat) != 2)
                    {
                        string _loop_ctrl_1 = null;

                        foreach (dynamic _b in Lang13.Enumerate(check_names))
                        {
                            name = _b;


                            if (H.dna.real_name == name)
                            {
                                check_names.Remove(name);
                                success++;
                                _loop_ctrl_1 = "continue";
                                break;
                            }
                        }

                        if (_loop_ctrl_1 == "break")
                        {
                            break;
                        }
                        else if (_loop_ctrl_1 == "continue")
                        {
                            continue;
                        }
                    }
                }
            }

            if (success >= this.department_minds.len)
            {
                return(1);
            }
            return(0);
        }
Esempio n. 32
0
        // Function from file: mask.dm
        public override dynamic speechModification(dynamic message = null)
        {
            ByTable temp_message = null;
            ByTable pick_list    = null;
            int?    i            = null;
            double? i2           = null;
            dynamic H            = null;


            if (this.voice == "Unknown")
            {
                if (String13.SubStr(message, 1, 2) != "*")
                {
                    temp_message = GlobalFuncs.splittext(message, " ");
                    pick_list    = new ByTable();
                    i            = null;
                    i            = 1;

                    while ((i ?? 0) <= temp_message.len)
                    {
                        pick_list.Add(i);
                        i++;
                    }
                    i2 = null;
                    i2 = 1;

                    while ((i2 ?? 0) <= Math.Abs(temp_message.len / 3))
                    {
                        H = Rand13.PickFromTable(pick_list);

                        if (String13.FindIgnoreCase(temp_message[H], "*", 1, 0) != 0 || String13.FindIgnoreCase(temp_message[H], ";", 1, 0) != 0 || String13.FindIgnoreCase(temp_message[H], ":", 1, 0) != 0)
                        {
                        }
                        else
                        {
                            temp_message[H] = GlobalFuncs.ninjaspeak(temp_message[H]);
                            pick_list.Remove(H);
                        }
                        i2++;
                    }
                    message = GlobalFuncs.jointext(temp_message, " ");
                    message = GlobalFuncs.replacetext(message, "l", "r");
                    message = GlobalFuncs.replacetext(message, "rr", "ru");
                    message = GlobalFuncs.replacetext(message, "v", "b");
                    message = GlobalFuncs.replacetext(message, "f", "hu");
                    message = GlobalFuncs.replacetext(message, "'t", "");
                    message = GlobalFuncs.replacetext(message, "t ", "to ");
                    message = GlobalFuncs.replacetext(message, " I ", " ai ");
                    message = GlobalFuncs.replacetext(message, "th", "z");
                    message = GlobalFuncs.replacetext(message, "is", "izu");
                    message = GlobalFuncs.replacetext(message, "ziz", "zis");
                    message = GlobalFuncs.replacetext(message, "se", "su");
                    message = GlobalFuncs.replacetext(message, "br", "bur");
                    message = GlobalFuncs.replacetext(message, "ry", "ri");
                    message = GlobalFuncs.replacetext(message, "you", "yuu");
                    message = GlobalFuncs.replacetext(message, "ck", "cku");
                    message = GlobalFuncs.replacetext(message, "eu", "uu");
                    message = GlobalFuncs.replacetext(message, "ow", "au");
                    message = GlobalFuncs.replacetext(message, "are", "aa");
                    message = GlobalFuncs.replacetext(message, "ay", "ayu");
                    message = GlobalFuncs.replacetext(message, "ea", "ii");
                    message = GlobalFuncs.replacetext(message, "ch", "chi");
                    message = GlobalFuncs.replacetext(message, "than", "sen");
                    message = GlobalFuncs.replacetext(message, ".", "");
                    message = String13.ToLower(message);
                }
            }
            return(message);
        }
Esempio n. 33
0
        // Function from file: shuttle_loan.dm
        public override void end(  )
        {
            ByTable empty_shuttle_turfs = null;
            Tile_Simulated_Floor T      = null;
            ByTable shuttle_spawns      = null;
            dynamic pack       = null;
            dynamic pack2      = null;
            dynamic pack3      = null;
            dynamic T2         = null;
            dynamic virus_type = null;
            dynamic T3         = null;
            int?    i          = null;
            Obj_Effect_Decal_Cleanable_Blood b = null;
            dynamic    D              = null;
            ByTable    crate_types    = null;
            dynamic    crate          = null;
            dynamic    pack4          = null;
            double     i2             = 0;
            dynamic    decal          = null;
            int        false_positive = 0;
            Ent_Static T4             = null;
            dynamic    spawn_type     = null;


            if (GlobalVars.SSshuttle.shuttle_loan != null && GlobalVars.SSshuttle.shuttle_loan.dispatched)
            {
                GlobalVars.SSshuttle.shuttle_loan = null;
                empty_shuttle_turfs = new ByTable();

                foreach (dynamic _a in Lang13.Enumerate(GlobalVars.SSshuttle.supply.areaInstance, typeof(Tile_Simulated_Floor)))
                {
                    T = _a;


                    if (T.density || T.contents.len != 0)
                    {
                        continue;
                    }
                    empty_shuttle_turfs.Add(T);
                }

                if (!(empty_shuttle_turfs.len != 0))
                {
                    return;
                }
                shuttle_spawns = new ByTable();

                switch (this.dispatch_type)
                {
                case 1:
                    pack = GlobalVars.SSshuttle.supply_packs[typeof(SupplyPack_Emergency_Specialops)];
                    pack.generate(GlobalFuncs.pick_n_take(empty_shuttle_turfs));
                    shuttle_spawns.Add(typeof(Mob_Living_SimpleAnimal_Hostile_Syndicate));
                    shuttle_spawns.Add(typeof(Mob_Living_SimpleAnimal_Hostile_Syndicate));

                    if (Rand13.PercentChance(75))
                    {
                        shuttle_spawns.Add(typeof(Mob_Living_SimpleAnimal_Hostile_Syndicate));
                    }

                    if (Rand13.PercentChance(50))
                    {
                        shuttle_spawns.Add(typeof(Mob_Living_SimpleAnimal_Hostile_Syndicate));
                    }
                    break;

                case 2:
                    pack2 = GlobalVars.SSshuttle.supply_packs[typeof(SupplyPack_Organic_Party)];
                    pack2.generate(GlobalFuncs.pick_n_take(empty_shuttle_turfs));
                    shuttle_spawns.Add(typeof(Mob_Living_SimpleAnimal_Hostile_Russian));
                    shuttle_spawns.Add(typeof(Mob_Living_SimpleAnimal_Hostile_Russian_Ranged));
                    shuttle_spawns.Add(typeof(Mob_Living_SimpleAnimal_Hostile_Bear));

                    if (Rand13.PercentChance(75))
                    {
                        shuttle_spawns.Add(typeof(Mob_Living_SimpleAnimal_Hostile_Russian));
                    }

                    if (Rand13.PercentChance(50))
                    {
                        shuttle_spawns.Add(typeof(Mob_Living_SimpleAnimal_Hostile_Bear));
                    }
                    break;

                case 3:
                    pack3 = GlobalVars.SSshuttle.supply_packs[typeof(SupplyPack_Emergency_Specialops)];
                    pack3.generate(GlobalFuncs.pick_n_take(empty_shuttle_turfs));
                    shuttle_spawns.Add(typeof(Mob_Living_SimpleAnimal_Hostile_Poison_GiantSpider));
                    shuttle_spawns.Add(typeof(Mob_Living_SimpleAnimal_Hostile_Poison_GiantSpider));
                    shuttle_spawns.Add(typeof(Mob_Living_SimpleAnimal_Hostile_Poison_GiantSpider_Nurse));

                    if (Rand13.PercentChance(50))
                    {
                        shuttle_spawns.Add(typeof(Mob_Living_SimpleAnimal_Hostile_Poison_GiantSpider_Hunter));
                    }
                    T2 = Rand13.PickFromTable(empty_shuttle_turfs);
                    empty_shuttle_turfs.Remove(T2);
                    new Obj_Effect_Decal_Remains_Human(T2);
                    new Obj_Item_Clothing_Shoes_SpaceNinja(T2);
                    new Obj_Item_Clothing_Mask_Balaclava(T2);
                    T2 = Rand13.PickFromTable(empty_shuttle_turfs);
                    new Obj_Effect_Spider_Stickyweb(T2);
                    T2 = Rand13.PickFromTable(empty_shuttle_turfs);
                    new Obj_Effect_Spider_Stickyweb(T2);
                    T2 = Rand13.PickFromTable(empty_shuttle_turfs);
                    new Obj_Effect_Spider_Stickyweb(T2);
                    T2 = Rand13.PickFromTable(empty_shuttle_turfs);
                    new Obj_Effect_Spider_Stickyweb(T2);
                    T2 = Rand13.PickFromTable(empty_shuttle_turfs);
                    new Obj_Effect_Spider_Stickyweb(T2);
                    break;

                case 5:
                    virus_type = Rand13.Pick(new object [] { typeof(Disease_Beesease), typeof(Disease_Brainrot), typeof(Disease_Fluspanish) });
                    T3         = null;
                    i          = null;
                    i          = 0;

                    while ((i ?? 0) < 10)
                    {
                        if (Rand13.PercentChance(15))
                        {
                            shuttle_spawns.Add(typeof(Obj_Item_Weapon_ReagentContainers_Glass_Bottle));
                        }
                        else if (Rand13.PercentChance(15))
                        {
                            shuttle_spawns.Add(typeof(Obj_Item_Weapon_ReagentContainers_Syringe));
                        }
                        else if (Rand13.PercentChance(25))
                        {
                            shuttle_spawns.Add(typeof(Obj_Item_Weapon_Shard));
                        }
                        T3          = GlobalFuncs.pick_n_take(empty_shuttle_turfs);
                        b           = new Obj_Effect_Decal_Cleanable_Blood(T3);
                        D           = Lang13.Call(virus_type);
                        D.longevity = 1000;
                        b.viruses.Add(D);
                        D.holder = b;
                        i++;
                    }
                    shuttle_spawns.Add(typeof(Obj_Structure_Closet_Crate));
                    shuttle_spawns.Add(typeof(Obj_Item_Weapon_ReagentContainers_Glass_Bottle_PierrotThroat));
                    shuttle_spawns.Add(typeof(Obj_Item_Weapon_ReagentContainers_Glass_Bottle_Magnitis));
                    break;

                case 4:
                    crate_types = new ByTable(new object [] {
                        typeof(SupplyPack_Emergency_Equipment),
                        typeof(SupplyPack_Security_Supplies),
                        typeof(SupplyPack_Organic_Food),
                        typeof(SupplyPack_Emergency_Weedcontrol),
                        typeof(SupplyPack_Engineering_Tools),
                        typeof(SupplyPack_Engineering_Engiequipment),
                        typeof(SupplyPack_Science_Robotics),
                        typeof(SupplyPack_Science_Plasma),
                        typeof(SupplyPack_Medical_Supplies)
                    });

                    foreach (dynamic _b in Lang13.Enumerate(crate_types))
                    {
                        crate = _b;

                        pack4 = GlobalVars.SSshuttle.supply_packs[crate];
                        pack4.generate(GlobalFuncs.pick_n_take(empty_shuttle_turfs));
                    }

                    foreach (dynamic _c in Lang13.IterateRange(1, 5))
                    {
                        i2 = _c;

                        decal = Rand13.Pick(new object [] { typeof(Obj_Effect_Decal_Cleanable_Flour), typeof(Obj_Effect_Decal_Cleanable_RobotDebris), typeof(Obj_Effect_Decal_Cleanable_Oil) });
                        Lang13.Call(decal, GlobalFuncs.pick_n_take(empty_shuttle_turfs));
                    }
                    break;
                }
                false_positive = 0;

                while (shuttle_spawns.len != 0 && empty_shuttle_turfs.len != 0)
                {
                    T4 = GlobalFuncs.pick_n_take(empty_shuttle_turfs);

                    if (T4.contents.len != 0 && false_positive < 5)
                    {
                        false_positive++;
                        continue;
                    }
                    spawn_type = GlobalFuncs.pick_n_take(shuttle_spawns);
                    Lang13.Call(spawn_type, T4);
                }
            }
            return;
        }
Esempio n. 34
0
        // Function from file: swapmaps.dm
        public override void Write(SaveFile F = null)
        {
            double  x       = 0;
            double  y       = 0;
            double  z       = 0;
            dynamic n       = null;
            ByTable areas   = null;
            dynamic defarea = null;
            dynamic T       = null;
            string  oldcd   = null;
            Tile    T2      = null;

            defarea = Lang13.FindObj(Game13.default_zone);

            if (!Lang13.Bool(defarea))
            {
                defarea = Lang13.Call(Game13.default_zone);
            }
            areas = new ByTable();

            foreach (dynamic _a in Lang13.Enumerate(Map13.FetchInBlock(Map13.GetTile(this.x1, this.y1, this.z1 ?? 0), Map13.GetTile(this.x2, this.y2, this.z2 ?? 0))))
            {
                T = _a;

                areas[T.loc] = null;
            }

            foreach (dynamic _b in Lang13.Enumerate(areas))
            {
                n = _b;

                areas.Remove(n);
                areas.Add(n);
            }
            areas.Remove(defarea);
            GlobalFuncs.InitializeSwapMaps();
            this.locked = true;
            F["id"]     = this.id;
            F["z"]      = (this.z2 ?? 0) - (this.z1 ?? 0) + 1;
            F["y"]      = this.y2 - this.y1 + 1;
            F["x"]      = this.x2 - this.x1 + 1;
            F["areas"]  = areas;

            foreach (dynamic _c in Lang13.IterateRange(1, areas.len))
            {
                n = _c;

                areas[areas[n]] = n;
            }
            oldcd = F.cd;

            foreach (dynamic _f in Lang13.IterateRange(this.z1, this.z2))
            {
                z = _f;

                F.cd = "" + (z - (this.z1 ?? 0) + 1);

                foreach (dynamic _e in Lang13.IterateRange(this.y1, this.y2))
                {
                    y = _e;

                    F.cd = "" + (y - this.y1 + 1);

                    foreach (dynamic _d in Lang13.IterateRange(this.x1, this.x2))
                    {
                        x = _d;

                        F.cd      = "" + (x - this.x1 + 1);
                        T2        = Map13.GetTile(((int)(x)), ((int)(y)), ((int)(z)));
                        F["type"] = T2.type;

                        if (T2.loc != defarea)
                        {
                            F["AREA"] = areas[T2.loc];
                        }
                        T2.Write(F);
                        F.cd = "..";
                    }
                    F.cd = "..";
                }
                Task13.Sleep(0);
                F.cd = oldcd;
            }
            this.locked = false;
            GlobalFuncs.qdel(areas);
            return;
        }