コード例 #1
0
ファイル: GameMode_Gang.cs プロジェクト: Somnium13/SS13
        // Function from file: gang.dm
        public override bool post_setup(bool?report = null)
        {
            Gang G         = null;
            Mind boss_mind = null;

            Task13.Schedule(Rand13.Int(10, 100), (Task13.Closure)(() => {
                foreach (dynamic _b in Lang13.Enumerate(this.gangs, typeof(Gang)))
                {
                    G = _b;


                    foreach (dynamic _a in Lang13.Enumerate(G.bosses, typeof(Mind)))
                    {
                        boss_mind = _a;

                        G.add_gang_hud(boss_mind);
                        this.forge_gang_objectives(boss_mind);
                        this.greet_gang(boss_mind);
                        this.equip_gang(boss_mind.current, G);
                        this.modePlayer.Add(boss_mind);
                    }
                }
                return;
            }));
            base.post_setup(report);
            return(false);
        }
コード例 #2
0
        // Function from file: observer.dm
        public override dynamic Stat(  )
        {
            Gang G = null;

            base.Stat();

            if (Interface13.IsStatPanelActive("Status"))
            {
                Interface13.Stat(null, "Station Time: " + GlobalFuncs.worldtime2text());

                if (GlobalVars.ticker != null)
                {
                    if (Lang13.Bool(GlobalVars.ticker.mode))
                    {
                        foreach (dynamic _a in Lang13.Enumerate(GlobalVars.ticker.mode.gangs, typeof(Gang)))
                        {
                            G = _a;


                            if (Lang13.Bool(Lang13.IsNumber(G.dom_timer)))
                            {
                                Interface13.Stat(null, "" + G.name + " Gang Takeover: " + Num13.MaxInt(Convert.ToInt32(G.dom_timer), 0));
                            }
                        }
                    }
                }
            }
            return(null);
        }
コード例 #3
0
ファイル: Obj_Item_Toy_Crayon.cs プロジェクト: Somnium13/SS13
        // Function from file: toys.dm
        public bool territory_claimed(dynamic territory = null, dynamic user = null)
        {
            dynamic occupying_gang = null;
            Gang    G = null;


            foreach (dynamic _a in Lang13.Enumerate(GlobalVars.ticker.mode.gangs, typeof(Gang)))
            {
                G = _a;


                if ((G.territory | G.territory_new).Contains(territory.type))
                {
                    occupying_gang = G.name;
                    break;
                }
            }

            if (Lang13.Bool(occupying_gang))
            {
                user.WriteMsg("<span class='danger'>" + territory + " has already been tagged by the " + occupying_gang + " gang! You must get rid of or spray over the old tag first!</span>");
                return(true);
            }
            return(false);
        }
コード例 #4
0
        // Function from file: gang.dm
        public override int?process(dynamic seconds = null)
        {
            ByTable winners = null;
            Gang    G       = null;
            Gang    G2      = null;

            winners = new ByTable();

            foreach (dynamic _a in Lang13.Enumerate(GlobalVars.ticker.mode.gangs, typeof(Gang)))
            {
                G = _a;


                if (Game13.time > this.next_point_time)
                {
                    G.income();
                }

                if (Lang13.Bool(Lang13.IsNumber(G.dom_timer)))
                {
                    G.dom_timer -= seconds / 10;

                    if (Convert.ToDouble(G.dom_timer) < 0)
                    {
                        winners.Add(G);
                    }
                }
            }

            if (Game13.time > this.next_point_time)
            {
                this.next_point_time = Game13.time + this.next_point_interval;
            }

            if (winners.len != 0)
            {
                if (winners.len > 1)
                {
                    foreach (dynamic _b in Lang13.Enumerate(winners, typeof(Gang)))
                    {
                        G2 = _b;

                        G2.domination(0.5);
                    }
                    GlobalFuncs.priority_announce("Multiple station takeover attempts have made simultaneously. Conflicting takeover attempts appears to have restarted.", "Network Alert");
                }
                else
                {
                    GlobalVars.ticker.mode.explosion_in_progress = true;
                    GlobalVars.ticker.station_explosion_cinematic(1);
                    GlobalVars.ticker.mode.explosion_in_progress = false;
                    GlobalVars.ticker.force_ending = Rand13.PickFromTable(winners);
                }
            }
            return(null);
        }
コード例 #5
0
        // Function from file: dominator.dm
        public void set_broken(  )
        {
            bool takeover_in_progress = false;
            Gang G = null;


            if (Lang13.Bool(this.gang))
            {
                this.gang.dom_timer  = "OFFLINE";
                takeover_in_progress = false;

                foreach (dynamic _a in Lang13.Enumerate(GlobalVars.ticker.mode.gangs, typeof(Gang)))
                {
                    G = _a;


                    if (Lang13.Bool(Lang13.IsNumber(G.dom_timer)))
                    {
                        takeover_in_progress = true;
                        break;
                    }
                }

                if (!takeover_in_progress)
                {
                    GlobalVars.SSshuttle.emergencyNoEscape = false;

                    if (GlobalVars.SSshuttle.emergency.mode == 4)
                    {
                        GlobalVars.SSshuttle.emergency.mode  = 3;
                        GlobalVars.SSshuttle.emergency.timer = Game13.time;
                        GlobalFuncs.priority_announce("Hostile enviroment resolved. You have 3 minutes to board the Emergency Shuttle.", null, "sound/AI/shuttledock.ogg", "Priority");
                    }
                    else
                    {
                        GlobalFuncs.priority_announce("All hostile activity within station systems have ceased.", "Network Alert");
                    }

                    if (GlobalFuncs.get_security_level() == "delta")
                    {
                        GlobalFuncs.set_security_level("red");
                    }
                }
                ((Gang)this.gang).message_gangtools("Hostile takeover cancelled: Dominator is no longer operational." + (this.gang.dom_attempts != 0 ? " You have " + this.gang.dom_attempts + " attempt remaining." : " The station network will have likely blocked any more attempts by us."), true, true);
            }
            this.SetLuminosity(0);
            this.icon_state = "dominator-broken";
            this.overlays.Cut();
            this.operating = -1;
            GlobalVars.SSmachine.processing.Remove(this);
            return;
        }
コード例 #6
0
ファイル: GameMode_Gang.cs プロジェクト: Somnium13/SS13
        // Function from file: gang.dm
        public override bool pre_setup(  )
        {
            int     gangs_to_create = 0;
            double  i    = 0;
            Gang    G    = null;
            dynamic boss = 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");
            }
            gangs_to_create = 2;

            if (Rand13.PercentChance(this.num_players() * 2))
            {
                gangs_to_create++;
            }

            foreach (dynamic _a in Lang13.IterateRange(1, gangs_to_create))
            {
                i = _a;


                if (!(this.antag_candidates.len != 0))
                {
                    break;
                }
                G = new Gang();
                this.gangs.Add(G);
                boss = Rand13.PickFromTable(this.antag_candidates);
                this.antag_candidates.Remove(boss);
                G.bosses.Add(boss);
                boss.gang_datum       = G;
                boss.special_role     = "" + G.name + " Gang Boss";
                boss.restricted_roles = this.restricted_jobs;
                GlobalFuncs.log_game("" + boss.key + " has been selected as the Boss for the " + G.name + " Gang");
            }

            if (this.gangs.len < 2)
            {
                return(false);
            }
            return(true);
        }
コード例 #7
0
        // Function from file: dominator.dm
        public override int?process(dynamic seconds = null)
        {
            dynamic domloc = null;
            Gang    G      = null;

            base.process((object)(seconds));

            if (Lang13.Bool(this.gang) && Lang13.Bool(Lang13.IsNumber(this.gang.dom_timer)))
            {
                if (Convert.ToDouble(this.gang.dom_timer) > 0)
                {
                    GlobalFuncs.playsound(this.loc, "sound/items/timer.ogg", 10, 0);

                    if (!this.warned && Convert.ToDouble(this.gang.dom_timer) < 180)
                    {
                        this.warned = true;
                        domloc      = GlobalFuncs.get_area(this.loc);
                        ((Gang)this.gang).message_gangtools("Less than 3 minutes remain in hostile takeover. Defend your dominator at " + domloc.map_name + "!");

                        foreach (dynamic _a in Lang13.Enumerate(GlobalVars.ticker.mode.gangs, typeof(Gang)))
                        {
                            G = _a;


                            if (G != this.gang)
                            {
                                G.message_gangtools("WARNING: " + this.gang.name + " Gang takeover imminent. Their dominator at " + domloc.map_name + " must be destroyed!", true, true);
                            }
                        }
                    }
                }
                else
                {
                    GlobalVars.SSmachine.processing.Remove(this);
                }
            }
            return(null);
        }
コード例 #8
0
        // Function from file: emergency.dm
        public override void check(  )
        {
            double time_left       = 0;
            Gang   G               = null;
            Zone_Shuttle_Escape E  = null;
            dynamic             A  = null;
            dynamic             M  = null;
            Zone_Shuttle_Escape E2 = null;
            dynamic             A2 = null;
            dynamic             M2 = null;
            Zone_Shuttle_Escape E3 = null;


            if (!(this.timer != 0))
            {
                return;
            }
            time_left = this.timeLeft(1);

            switch ((int)(this.mode))
            {
            case 1:

                if (time_left <= 0)
                {
                    this.mode  = 0;
                    this.timer = 0;
                }
                break;

            case 2:

                if (time_left <= 0)
                {
                    if (this.dock(GlobalVars.SSshuttle.getDock("emergency_home")) != 0)
                    {
                        this.setTimer(20);
                        return;
                    }
                    this.mode  = 3;
                    this.timer = Game13.time;
                    GlobalFuncs.send2irc("Server", "The Emergency Shuttle has docked with the station.");
                    GlobalFuncs.priority_announce("The Emergency Shuttle has docked with the station. You have " + this.timeLeft(600) + " minutes to board the Emergency Shuttle.", null, "sound/AI/shuttledock.ogg", "Priority");

                    foreach (dynamic _a in Lang13.Enumerate(GlobalVars.ticker.mode.gangs, typeof(Gang)))
                    {
                        G = _a;


                        if (Lang13.Bool(Lang13.IsNumber(G.dom_timer)))
                        {
                            G.dom_attempts = 0;
                        }
                        else
                        {
                            G.dom_attempts = Num13.MinInt(1, G.dom_attempts);
                        }
                    }
                }
                break;

            case 3:

                if (time_left <= 50 && !this.sound_played)
                {
                    this.sound_played = true;

                    foreach (dynamic _b in Lang13.Enumerate(typeof(Game13), typeof(Zone_Shuttle_Escape)))
                    {
                        E = _b;

                        ((dynamic)E).WriteMsg("sound/effects/hyperspace_begin.ogg");
                    }
                }

                if (time_left <= 0 && GlobalVars.SSshuttle.emergencyNoEscape)
                {
                    GlobalFuncs.priority_announce("Hostile environment detected. Departure has been postponed indefinitely pending conflict resolution.", null, "sound/misc/notice1.ogg", "Priority");
                    this.sound_played = false;
                    this.mode         = 4;
                }

                if (time_left <= 0 && !GlobalVars.SSshuttle.emergencyNoEscape)
                {
                    foreach (dynamic _c in Lang13.Enumerate(GlobalVars.SSshuttle.mobile))
                    {
                        A = _c;

                        M = A;

                        if (M.launch_status == 0)
                        {
                            M.launch_status = 1;
                            ((Obj_DockingPort_Mobile)M).enterTransit();
                        }
                    }

                    foreach (dynamic _d in Lang13.Enumerate(typeof(Game13), typeof(Zone_Shuttle_Escape)))
                    {
                        E2 = _d;

                        ((dynamic)E2).WriteMsg("sound/effects/hyperspace_progress.ogg");
                    }
                    this.enterTransit();
                    this.mode          = 5;
                    this.launch_status = 1;
                    this.timer         = Game13.time;
                    GlobalFuncs.priority_announce("The Emergency Shuttle has left the station. Estimate " + this.timeLeft(600) + " minutes until the shuttle docks at Central Command.", null, null, "Priority");
                }
                break;

            case 5:

                if (time_left <= 0)
                {
                    foreach (dynamic _e in Lang13.Enumerate(GlobalVars.SSshuttle.mobile))
                    {
                        A2 = _e;

                        M2 = A2;

                        if (M2.launch_status == 1)
                        {
                            if (M2 is Obj_DockingPort_Mobile_Pod)
                            {
                                ((Obj_DockingPort_Mobile)M2).dock(GlobalVars.SSshuttle.getDock("" + M2.id + "_away"));
                            }
                            else
                            {
                                continue;
                            }
                        }
                    }

                    foreach (dynamic _f in Lang13.Enumerate(typeof(Game13), typeof(Zone_Shuttle_Escape)))
                    {
                        E3 = _f;

                        ((dynamic)E3).WriteMsg("sound/effects/hyperspace_end.ogg");
                    }
                    this.dock(GlobalVars.SSshuttle.getDock("emergency_away"));
                    this.mode  = 6;
                    this.timer = 0;
                    this.open_dock();
                }
                break;
            }
            return;
        }
コード例 #9
0
        // Function from file: dominator.dm
        public override dynamic attack_hand(dynamic a = null, bool?b = null, bool?c = null)
        {
            dynamic tempgang = null;
            double  time     = 0;
            dynamic A        = null;
            dynamic locname  = null;
            Gang    G        = null;


            if (this.operating != 0)
            {
                this.examine(a);
                return(null);
            }

            if (((GameMode)GlobalVars.ticker.mode).get_all_gangsters().Contains(a.mind))
            {
                tempgang = a.mind.gang_datum;
            }
            else
            {
                this.examine(a);
                return(null);
            }

            if (Lang13.Bool(Lang13.IsNumber(tempgang.dom_timer)))
            {
                a.WriteMsg("<span class='warning'>Error: Hostile Takeover is already in progress.</span>");
                return(null);
            }

            if (!(tempgang.dom_attempts != 0))
            {
                a.WriteMsg("<span class='warning'>Error: Unable to breach station network. Firewall has logged our signature and is blocking all further attempts.</span>");
                return(null);
            }
            time = Num13.Round(GlobalFuncs.get_domination_time(tempgang) / 60, 0.1);

            if (Interface13.Alert(a, "With " + Num13.Round(tempgang.territory.len / GlobalVars.start_state.num_territories * 100, 1) + "% station control, a takeover will require " + time + " minutes.\nYour gang will be unable to gain influence while it is active.\nThe entire station will likely be alerted to it once it starts.\nYou have " + tempgang.dom_attempts + " attempt(s) remaining. Are you ready?", "Confirm", "Ready", "Later") == "Ready")
            {
                if (Lang13.Bool(Lang13.IsNumber(tempgang.dom_timer)) || !(tempgang.dom_attempts != 0) || !(Map13.GetDistance(this, a) <= 1) || !(this.loc is Tile))
                {
                    return(0);
                }
                A         = GlobalFuncs.get_area(this.loc);
                locname   = Lang13.Initial(A, "name");
                this.gang = tempgang;
                this.gang.dom_attempts--;
                GlobalFuncs.priority_announce("Network breach detected in " + locname + ". The " + this.gang.name + " Gang is attempting to seize control of the station!", "Network Alert");
                ((Gang)this.gang).domination();
                this.name = "" + this.gang.name + " Gang " + this.name;
                this.healthcheck(0);
                this.operating = 1;
                GlobalVars.SSmachine.processing.Add(this);
                ((Gang)this.gang).message_gangtools("Hostile takeover in progress: Estimated " + time + " minutes until victory." + (this.gang.dom_attempts != 0 ? "" : " This is your final attempt."));

                foreach (dynamic _a in Lang13.Enumerate(GlobalVars.ticker.mode.gangs, typeof(Gang)))
                {
                    G = _a;


                    if (G != this.gang)
                    {
                        G.message_gangtools("Enemy takeover attempt detected in " + locname + ": Estimated " + time + " minutes until our defeat.", true, true);
                    }
                }
            }
            return(null);
        }