Example #1
0
        static bool GotoLevel(Player p, Level lvl)
        {
            if (p.level == lvl)
            {
                p.Message("You are already in {0}%S.", lvl.ColoredName); return(false);
            }

            bool canJoin = lvl.CanJoin(p);

            OnJoiningLevelEvent.Call(p, lvl, ref canJoin);
            if (!canJoin)
            {
                return(false);
            }

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

            p.level = lvl;

            p.SendRawMap(prev, lvl);
            PostSentMap(p, prev, lvl, true);
            p.Loading = false;
            return(true);
        }
Example #2
0
 internal static void ReloadMap(Player p)
 {
     p.Loading = true;
     Entities.DespawnEntities(p);
     p.SendRawMap(p.level, p.level);
     Entities.SpawnEntities(p, p.Pos, p.Rot);
     p.Loading = false;
 }