Beispiel #1
0
        // Function from file: ticker.dm
        public bool setup(  )
        {
            ByTable  runnable_modes = null;
            dynamic  smode          = null;
            bool     can_continue   = false;
            dynamic  modes          = null;
            GameMode M                  = null;
            dynamic  holidayname        = null;
            Holiday  holiday            = null;
            Obj_Effect_Landmark_Start S = null;


            if (GlobalVars.master_mode == "random" || GlobalVars.master_mode == "secret")
            {
                runnable_modes = GlobalVars.config.get_runnable_modes();

                if (GlobalVars.master_mode == "secret")
                {
                    this.hide_mode = true;

                    if (GlobalVars.secret_force_mode != "secret")
                    {
                        smode = GlobalVars.config.pick_mode(GlobalVars.secret_force_mode);

                        if (!((GameMode)smode).can_start())
                        {
                            GlobalFuncs.message_admins(new Txt().blue().str("Unable to force secret ").item(GlobalVars.secret_force_mode).str(". ").item(smode.required_players).str(" players and ").item(smode.required_enemies).str(" eligible antagonists needed.").ToString());
                        }
                        else
                        {
                            this.mode = smode;
                        }
                    }
                }

                if (!Lang13.Bool(this.mode))
                {
                    if (!(runnable_modes.len != 0))
                    {
                        Game13.WriteMsg("<B>Unable to choose playable game mode.</B> Reverting to pre-game lobby.");
                        return(false);
                    }
                    this.mode = GlobalFuncs.pickweight(runnable_modes);
                }
            }
            else
            {
                this.mode = GlobalVars.config.pick_mode(GlobalVars.master_mode);

                if (!((GameMode)this.mode).can_start())
                {
                    Game13.WriteMsg("<B>Unable to start " + this.mode.name + ".</B> Not enough players, " + this.mode.required_players + " players and " + this.mode.required_enemies + " eligible antagonists needed. Reverting to pre-game lobby.");
                    GlobalFuncs.qdel(this.mode);
                    this.mode = null;
                    GlobalVars.SSjob.ResetOccupations();
                    return(false);
                }
            }
            can_continue = false;
            can_continue = ((GameMode)this.mode).pre_setup();
            GlobalVars.SSjob.DivideOccupations();

            if (!GlobalVars.Debug2)
            {
                if (!can_continue)
                {
                    GlobalFuncs.qdel(this.mode);
                    this.mode = null;
                    Game13.WriteMsg("<B>Error setting up " + GlobalVars.master_mode + ".</B> Reverting to pre-game lobby.");
                    GlobalVars.SSjob.ResetOccupations();
                    return(false);
                }
            }
            else
            {
                Game13.WriteMsg("<span class='notice'>DEBUG: Bypassing prestart checks...");
            }

            if (this.hide_mode)
            {
                modes = new ByTable();

                foreach (dynamic _a in Lang13.Enumerate(runnable_modes, typeof(GameMode)))
                {
                    M = _a;

                    modes += M.name;
                }
                modes = GlobalFuncs.sortList(modes);
                Game13.WriteMsg("<B>The current game mode is - Secret!</B>");
                Game13.WriteMsg("<B>Possibilities:</B> " + GlobalFuncs.english_list(modes));
            }
            else
            {
                ((GameMode)this.mode).announce();
            }
            this.current_state = 3;

            if (!GlobalVars.config.ooc_during_round)
            {
                GlobalFuncs.toggle_ooc(false);
            }
            GlobalVars.round_start_time     = Game13.time;
            GlobalVars.start_landmarks_list = GlobalFuncs.shuffle(GlobalVars.start_landmarks_list);
            this.create_characters();
            this.collect_minds();
            this.equip_characters();
            GlobalVars.data_core.manifest();
            GlobalVars.Master.RoundStart();
            Game13.WriteMsg("<FONT color='blue'><B>Welcome to " + GlobalFuncs.station_name() + ", enjoy your stay!</B></FONT>");
            Game13.WriteMsg(new Sound("sound/AI/welcome.ogg"));

            if (Lang13.Bool(GlobalVars.SSevent.holidays))
            {
                Game13.WriteMsg("<font color='blue'>and...</font>");

                foreach (dynamic _b in Lang13.Enumerate(GlobalVars.SSevent.holidays))
                {
                    holidayname = _b;

                    holiday = GlobalVars.SSevent.holidays[holidayname];
                    Game13.WriteMsg("<h4>" + holiday.greet() + "</h4>");
                }
            }
            Task13.Schedule(0, (Task13.Closure)(() => {
                ((GameMode)this.mode).post_setup();

                foreach (dynamic _c in Lang13.Enumerate(GlobalVars.landmarks_list, typeof(Obj_Effect_Landmark_Start)))
                {
                    S = _c;


                    if (S.name != "AI")
                    {
                        GlobalFuncs.qdel(S);
                    }
                }

                if (!(GlobalVars.admins.len != 0))
                {
                    GlobalFuncs.send2irc("Server", "Round just started with no admins online!");
                }
                return;
            }));
            return(true);
        }
Beispiel #2
0
        // Function from file: jobs.dm
        public bool EquipRank(dynamic H = null, dynamic rank = null, bool?joined_late = null)
        {
            joined_late = joined_late ?? false;

            Job     job = null;
            dynamic S   = null;
            Obj_Effect_Landmark_Start sloc = null;
            dynamic T       = null;
            bool    clear   = false;
            Obj     O       = null;
            dynamic new_mob = null;

            job   = this.GetJob(rank);
            H.job = rank;

            if (!(joined_late == true))
            {
                S = null;

                foreach (dynamic _a in Lang13.Enumerate(GlobalVars.start_landmarks_list, typeof(Obj_Effect_Landmark_Start)))
                {
                    sloc = _a;


                    if (sloc.name != rank)
                    {
                        S = sloc;
                        continue;
                    }

                    if (Lang13.Bool(Lang13.FindIn(typeof(Mob_Living), sloc.loc)))
                    {
                        continue;
                    }
                    S = sloc;
                    break;
                }

                if (!Lang13.Bool(S))
                {
                    Game13.log.WriteMsg("Couldn't find a round start spawn point for " + rank);
                    S = Rand13.PickFromTable(GlobalVars.latejoin);
                }

                if (!Lang13.Bool(S))
                {
                    Game13.log.WriteMsg("Couldn't find a round start latejoin spawn point.");

                    foreach (dynamic _c in Lang13.Enumerate(GlobalFuncs.get_area_turfs(typeof(Zone_Shuttle_Arrival))))
                    {
                        T = _c;


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

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


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

                            if (clear)
                            {
                                S = T;
                                continue;
                            }
                        }
                    }
                }

                if (S is Obj_Effect_Landmark && S.loc is Tile)
                {
                    H.loc = S.loc;
                }
            }

            if (Lang13.Bool(H.mind))
            {
                H.mind.assigned_role = rank;
            }

            if (job != null)
            {
                new_mob = job.equip(H);

                if (new_mob is Mob)
                {
                    H = new_mob;
                }
                job.apply_fingerprints(H);
            }
            H.WriteMsg("<b>You are the " + rank + ".</b>");
            H.WriteMsg("<b>As the " + rank + " you answer directly to " + job.supervisors + ". Special circumstances may change this.</b>");
            H.WriteMsg("<b>To speak on your departments radio, use the :h button. To see others, look closely at your headset.</b>");

            if (job.req_admin_notify)
            {
                H.WriteMsg("<b>You are playing a job that is important for Game Progression. If you have to disconnect, please notify the admins via adminhelp.</b>");
            }

            if (Lang13.Bool(GlobalVars.config.minimal_access_threshold))
            {
                H.WriteMsg("<FONT color='blue'><B>As this station was initially staffed with a " + (GlobalVars.config.jobs_have_minimal_access ? "full crew, only your job's necessities" : "skeleton crew, additional access may") + " have been added to your ID card.</B></font>");
            }
            return(true);
        }