public static void ReloadFor(Player src, Player p, bool announce) { p.Loading = true; Entities.DespawnEntities(p); p.SendMap(p.level); Entities.SpawnEntities(p); p.Loading = false; if (!announce) { return; } if (src == null || !Entities.CanSee(p, src)) { p.Message("&bMap reloaded"); } else { p.Message("&bMap reloaded by " + src.ColoredName); } if (Entities.CanSee(src, p)) { src.Message("&4Finished reloading for " + p.ColoredName); } }
public static void ReloadMap(Player p, Player who, bool showMessage) { who.Loading = true; Entities.DespawnEntities(who); who.SendMap(who.level); Entities.SpawnEntities(who); who.Loading = false; if (!showMessage) { return; } if (p == null || !Entities.CanSee(who, p)) { who.SendMessage("&bMap reloaded"); } else { who.SendMessage("&bMap reloaded by " + p.ColoredName); } if (Entities.CanSee(p, who)) { Player.Message(p, "&4Finished reloading for " + who.ColoredName); } }
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 oldLevel = p.level; p.level = lvl; p.SendMap(oldLevel); PostSentMap(p, oldLevel, lvl, true); return(true); }
static bool GotoLevel(Player p, Level lvl) { if (p.level == lvl) { Player.Message(p, "You are already in {0}%S.", lvl.ColoredName); return(false); } if (!lvl.CanJoin(p)) { return(false); } p.Loading = true; Entities.DespawnEntities(p); Level oldLevel = p.level; p.level = lvl; p.SendMap(oldLevel); Position pos = lvl.SpawnPos; byte yaw = lvl.rotx, pitch = lvl.roty; OnPlayerSpawningEvent.Call(p, ref pos, ref yaw, ref pitch, false); Entities.SpawnEntities(p, pos, new Orientation(yaw, pitch)); CheckGamesJoin(p, oldLevel); if (p.level.ShouldShowJoinMessage(oldLevel)) { string msg = p.level.IsMuseum ? " %Swent to the " : " %Swent to "; Chat.MessageGlobal(p, p.ColoredName + msg + lvl.ColoredName, false, true); OnPlayerActionEvent.Call(p, PlayerAction.JoinWorld, lvl.name); } return(true); }
public static void ReloadMap(Player p, Player who, bool showMessage) { who.Loading = true; Entities.DespawnEntities(who); who.SendUserMOTD(); who.SendMap(who.level); Entities.SpawnEntities(who); who.Loading = false; if (!showMessage) { return; } if (p != null && !p.hidden) { who.SendMessage("&bMap reloaded by " + p.name); } if (p != null && p.hidden) { who.SendMessage("&bMap reloaded"); } Player.Message(p, "&4Finished reloading for " + who.name); }
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); }