Esempio n. 1
0
        public override void Use(Player p, string message, CommandData data)
        {
            IGame game = IGame.GameOn(p.level);

            if (game != null)
            {
                p.Message("You can only reload levels outside of a game."); return;
            }
            if (!Hacks.CanUseNoclip(p))
            {
                p.Message("You cannot use &T/Reload &Son this map."); return;
            }
            if (CheckSuper(p, message, "player or level name"))
            {
                return;
            }
            if (message.Length == 0)
            {
                message = p.name;
            }
            string[] parts = message.SplitSpaces();

            if (!parts[0].CaselessEq("all"))
            {
                PlayerActions.ReloadMap(p);
                p.Message("&bMap reloaded");
            }
            else
            {
                Level lvl = p.level;
                if (parts.Length == 2)
                {
                    lvl = Matcher.FindLevels(p, parts[1]);
                    if (lvl == null)
                    {
                        return;
                    }
                }
                else if (p.IsSuper)
                {
                    SuperRequiresArgs(name + " all", p, "level name"); return;
                }

                if (!CheckExtraPerm(p, data, 1))
                {
                    return;
                }
                LevelActions.ReloadAll(lvl, p, true);
            }
            Server.DoGC();
        }
Esempio n. 2
0
        public override void Use(Player p, string message, CommandData data)
        {
            if (CheckSuper(p, message, "level name"))
            {
                return;
            }
            IGame game = IGame.GameOn(p.level);

            if (message.Length == 0)
            {
                if (game != null)
                {
                    p.Message("You cannot use &T/Reload &Swhile a game is running");
                }
                else if (!Hacks.CanUseNoclip(p))
                {
                    p.Message("You cannot use &T/Reload &Son this level");
                }
                else
                {
                    PlayerActions.ReloadMap(p);
                    p.Message("&bMap reloaded");
                }
                return;
            }

            if (!CheckExtraPerm(p, data, 1))
            {
                return;
            }
            Level lvl = p.level;

            if (!message.CaselessEq("all"))
            {
                lvl = Matcher.FindLevels(p, message);
                if (lvl == null)
                {
                    return;
                }
            }
            LevelActions.ReloadAll(lvl, p, true);
        }
Esempio n. 3
0
        public override void Use(Player p, string message, CommandData data)
        {
            if (CheckSuper(p, message, "player or level name"))
            {
                return;
            }
            if (message.Length == 0)
            {
                message = p.name;
            }
            string[] parts = message.SplitSpaces();

            if (!parts[0].CaselessEq("all"))
            {
                PlayerActions.ReloadMap(p);
                p.Message("&bMap reloaded");
            }
            else
            {
                Level lvl = p.level;
                if (parts.Length == 2)
                {
                    lvl = Matcher.FindLevels(p, parts[1]);
                    if (lvl == null)
                    {
                        return;
                    }
                }
                else if (p.IsSuper)
                {
                    SuperRequiresArgs(name + " all", p, "level name"); return;
                }

                if (!CheckExtraPerm(p, data, 1))
                {
                    return;
                }
                LevelActions.ReloadAll(lvl, p, true);
            }
            Server.DoGC();
        }
Esempio n. 4
0
        protected virtual void ContinueOnSameMap()
        {
            Map.Message("Continuing " + GameName + " on the same map");
            Level old = Level.Load(Map.MapName);

            if (old == null)
            {
                Map.Message("&WCannot reset changes to map"); return;
            }
            if (old.Width != Map.Width || old.Height != Map.Height || old.Length != Map.Length)
            {
                Map.Message("&WCannot reset changes to map"); return;
            }

            // Try to reset changes made to this map, if possible
            // TODO: do this in a nicer way
            Map.blocks       = old.blocks;
            Map.CustomBlocks = old.CustomBlocks;
            LevelActions.ReloadAll(Map, Player.Console, false);
            Map.Message("Reset map to latest backup");
        }
Esempio n. 5
0
 static void DoReload(Player p, Level lvl)
 {
     LevelActions.ReloadAll(lvl, p, true);
     Server.DoGC();
 }