mirror of
https://github.com/ClassiCube/MCGalaxy.git
synced 2025-09-26 14:54:12 -04:00
Better handling of referee players in zombie survival.
This commit is contained in:
parent
ac6fd1afd8
commit
90e67323ec
@ -31,29 +31,16 @@ namespace MCGalaxy.Commands {
|
||||
public override void Use(Player p, string message) {
|
||||
if (p == null) { MessageInGameOnly(p); return; }
|
||||
if (p.referee) {
|
||||
p.referee = false;
|
||||
LevelPermission perm = Group.findPlayerGroup(name).Permission;
|
||||
Player.SendChatFrom(p, p.FullName + " %Sis no longer a referee", false);
|
||||
|
||||
if (Server.zombie.RoundInProgress) {
|
||||
Server.zombie.InfectPlayer(p);
|
||||
} else {
|
||||
Player.GlobalDespawn(p, false);
|
||||
Player.GlobalSpawn(p, p.pos[0], p.pos[1], p.pos[2], p.rot[0], p.rot[1], false);
|
||||
Server.zombie.Infected.Remove(p);
|
||||
Server.zombie.Alive.Add(p);
|
||||
Server.zombie.UpdateAllPlayerStatus();
|
||||
}
|
||||
if (p.level == Server.zombie.CurLevel)
|
||||
Server.zombie.PlayerJoinedLevel(p, Server.zombie.CurLevel, Server.zombie.CurLevel);
|
||||
Player.GlobalSpawn(p, p.pos[0], p.pos[1], p.pos[2], p.rot[0], p.rot[1], true, "");
|
||||
} else {
|
||||
p.referee = true;
|
||||
Player.SendChatFrom(p, p.FullName + " %Sis now a referee", false);
|
||||
Player.SendChatFrom(p, p.FullName + " %Sis now a referee", false);
|
||||
Server.zombie.PlayerLeftServer(p);
|
||||
Player.GlobalDespawn(p, false);
|
||||
Server.zombie.Alive.Remove(p);
|
||||
Server.zombie.Infected.Remove(p);
|
||||
Server.zombie.UpdateAllPlayerStatus();
|
||||
if (Server.zombie.RoundInProgress)
|
||||
Server.zombie.AssignFirstZombie();
|
||||
}
|
||||
p.referee = !p.referee;
|
||||
}
|
||||
|
||||
public override void Help(Player p) {
|
||||
|
@ -83,7 +83,7 @@ namespace MCGalaxy.Games {
|
||||
|
||||
Player[] online = PlayerInfo.Online.Items;
|
||||
foreach (Player p in online) {
|
||||
if (p.level == null || p.level != CurLevel) continue;
|
||||
if (p.level == null || p.level != CurLevel || p.referee) continue;
|
||||
if (p != first) Alive.Add(p);
|
||||
}
|
||||
|
||||
|
@ -231,12 +231,11 @@ namespace MCGalaxy.Games {
|
||||
|
||||
internal void UpdateAllPlayerStatus(string timespan) {
|
||||
string message = GetStatusMessage(timespan);
|
||||
Player[] players = Alive.Items;
|
||||
foreach (Player p in players)
|
||||
p.SendCpeMessage(CpeMessageType.Status1, message, true);
|
||||
players = Infected.Items;
|
||||
foreach (Player p in players)
|
||||
Player[] players = PlayerInfo.Online.Items;
|
||||
foreach (Player p in players) {
|
||||
if (p.level != CurLevel) continue;
|
||||
p.SendCpeMessage(CpeMessageType.Status1, message, true);
|
||||
}
|
||||
}
|
||||
|
||||
string GetStatusMessage(string timespan) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user