Пример #1
0
        static bool GotoLevel(Player p, Level lvl, bool ignorePerms)
        {
            if (p.level == lvl)
            {
                Player.Message(p, "You are already in {0}%S.", lvl.ColoredName); return(false);
            }
            if (!lvl.CanJoin(p, ignorePerms))
            {
                return(false);
            }
            if (!Server.zombie.PlayerCanJoinLevel(p, lvl, p.level))
            {
                return(false);
            }

            p.Loading = true;
            Entities.DespawnEntities(p);
            Level oldLevel = p.level;

            p.level = lvl; p.SendUserMOTD(); p.SendMap(oldLevel);

            ushort x = (ushort)(lvl.spawnx * 32 + 16);
            ushort y = (ushort)(lvl.spawny * 32 + 32);
            ushort z = (ushort)(lvl.spawnz * 32 + 16);

            Entities.SpawnEntities(p, x, y, z, lvl.rotx, lvl.roty);
            p.Loading = false;
            CheckGamesJoin(p, oldLevel);
            p.prevMsg = "";

            if (!p.hidden && p.level.ShouldShowJoinMessage(oldLevel))
            {
                Player.SendChatFrom(p, p.ColoredName + " %Swent to " + lvl.ColoredName, false);
                Player.RaisePlayerAction(p, PlayerAction.JoinWorld, lvl.name);
            }
            return(true);
        }