More code cleanup for zombie survival.

This commit is contained in:
UnknownShadow200 2016-03-13 12:31:59 +11:00
parent 6b04139c5b
commit ab6c4288bc
13 changed files with 231 additions and 241 deletions

View File

@ -21,10 +21,12 @@ namespace MCGalaxy.Commands
{ {
public override string name { get { return "alive"; } } public override string name { get { return "alive"; } }
public override string shortcut { get { return "alive"; } } public override string shortcut { get { return "alive"; } }
public override string type { get { return CommandTypes.Games; } } public override string type { get { return CommandTypes.Games; } }
public override bool museumUsable { get { return true; } } public override bool museumUsable { get { return true; } }
public override LevelPermission defaultRank { get { return LevelPermission.Banned; } } public override LevelPermission defaultRank { get { return LevelPermission.Banned; } }
public override bool Enabled { get { return Server.ZombieModeOn; } }
public CmdAlive() { } public CmdAlive() { }
public override void Use(Player p, string message) public override void Use(Player p, string message)
{ {
if (ZombieGame.alive.Count == 0) if (ZombieGame.alive.Count == 0)

View File

@ -31,7 +31,7 @@ namespace MCGalaxy.Commands {
Player who = message == "" ? p : PlayerInfo.FindOrShowMatches(p, message); Player who = message == "" ? p : PlayerInfo.FindOrShowMatches(p, message);
if (who == null) return; if (who == null) return;
if (!who.infected || !Server.zombie.GameInProgess()) { if (!who.infected || !Server.zombie.RoundInProgress) {
Player.SendMessage(p, "Cannot disinfect player"); Player.SendMessage(p, "Cannot disinfect player");
} else if (!who.referee) { } else if (!who.referee) {
Server.zombie.DisinfectPlayer(who); Server.zombie.DisinfectPlayer(who);

View File

@ -24,16 +24,15 @@ namespace MCGalaxy.Commands
public override string type { get { return CommandTypes.Moderation; } } public override string type { get { return CommandTypes.Moderation; } }
public override bool museumUsable { get { return true; } } public override bool museumUsable { get { return true; } }
public override LevelPermission defaultRank { get { return LevelPermission.Banned; } } public override LevelPermission defaultRank { get { return LevelPermission.Banned; } }
public override bool Enabled { get { return Server.ZombieModeOn; } }
public CmdEndRound() { } public CmdEndRound() { }
public override void Use(Player p, string message)
{ public override void Use(Player p, string message) {
if (Server.zombie.GameInProgess()) if (Server.zombie.RoundInProgress)
{
Server.zombie.HandOutRewards(); Server.zombie.HandOutRewards();
}
} }
public override void Help(Player p)
{ public override void Help(Player p) {
Player.SendMessage(p, "/endround - ends the round"); Player.SendMessage(p, "/endround - ends the round");
} }
} }

View File

@ -31,7 +31,7 @@ namespace MCGalaxy.Commands {
Player who = message == "" ? p : PlayerInfo.FindOrShowMatches(p, message); Player who = message == "" ? p : PlayerInfo.FindOrShowMatches(p, message);
if (who == null) return; if (who == null) return;
if (who.infected || !Server.zombie.GameInProgess()) { if (who.infected || !Server.zombie.RoundInProgress) {
Player.SendMessage(p, "Cannot infect player"); Player.SendMessage(p, "Cannot infect player");
} else if (!who.referee) { } else if (!who.referee) {
Server.zombie.InfectPlayer(who); Server.zombie.InfectPlayer(who);

View File

@ -21,10 +21,12 @@ namespace MCGalaxy.Commands
{ {
public override string name { get { return "ref"; } } public override string name { get { return "ref"; } }
public override string shortcut { get { return ""; } } public override string shortcut { get { return ""; } }
public override string type { get { return CommandTypes.Moderation; } } public override string type { get { return CommandTypes.Moderation; } }
public override bool museumUsable { get { return true; } } public override bool museumUsable { get { return true; } }
public override LevelPermission defaultRank { get { return LevelPermission.Operator; } } public override LevelPermission defaultRank { get { return LevelPermission.Operator; } }
public override bool Enabled { get { return Server.ZombieModeOn; } }
public CmdReferee() { } public CmdReferee() { }
public override void Use(Player p, string message) public override void Use(Player p, string message)
{ {
if (p == null) { MessageInGameOnly(p); return; } if (p == null) { MessageInGameOnly(p); return; }
@ -33,8 +35,8 @@ namespace MCGalaxy.Commands
p.referee = false; p.referee = false;
LevelPermission perm = Group.findPlayerGroup(name).Permission; LevelPermission perm = Group.findPlayerGroup(name).Permission;
Player.GlobalDespawn(p, false); Player.GlobalDespawn(p, false);
Player.SendChatFrom(p, p.color + p.name + Server.DefaultColor + " is no longer a referee", false); Player.SendChatFrom(p, p.FullName + " %Sis no longer a referee", false);
if (Server.zombie.GameInProgess()) if (Server.zombie.RoundInProgress)
{ {
Server.zombie.InfectPlayer(p); Server.zombie.InfectPlayer(p);
} }
@ -50,9 +52,9 @@ namespace MCGalaxy.Commands
else else
{ {
p.referee = true; p.referee = true;
Player.SendChatFrom(p, p.color + p.name + Server.DefaultColor + " is now a referee", false); Player.SendChatFrom(p, p.FullName + " %Sis now a referee", false);
Player.GlobalDespawn(p, false); Player.GlobalDespawn(p, false);
if (Server.zombie.GameInProgess()) if (Server.zombie.RoundInProgress)
{ {
p.color = p.group.color; p.color = p.group.color;
try try

View File

@ -33,52 +33,50 @@ namespace MCGalaxy.Commands
string[] s = message.ToLower().Split(' '); string[] s = message.ToLower().Split(' ');
if (s[0] == "status") if (s[0] == "status")
{ {
switch (Server.zombie.ZombieStatus()) switch (Server.zombie.Status) {
{ case ZombieGameStatus.NotStarted:
case 0: Player.SendMessage(p, "Zombie Survival is not ccurrently running."); return;
Player.GlobalMessage("There is no Zombie Survival game currently in progress."); case ZombieGameStatus.InfiniteRounds:
return; Player.SendMessage(p, "Zombie Survival is currently in progress with infinite rounds."); return;
case 1: case ZombieGameStatus.SingleRound:
Player.SendMessage(p, "There is a Zombie Survival game currently in progress with infinite rounds."); Player.SendMessage(p, "Zombie Survival game currently in progress."); return;
return; case ZombieGameStatus.VariableRounds:
case 2: Player.SendMessage(p, "Zombie Survival game currently in progress with " + Server.zombie.MaxRounds + " rounds."); return;
Player.SendMessage(p, "There is a one-time Zombie Survival game currently in progress."); case ZombieGameStatus.LastRound:
return; Player.SendMessage(p, "Zombie Survival game currently in progress, with this round being the final round."); return;
case 3:
Player.SendMessage(p, "There is a Zombie Survival game currently in progress with a " + Server.zombie.MaxRounds + " amount of rounds.");
return;
case 4:
Player.SendMessage(p, "There is a Zombie Survival game currently in progress, scheduled to stop after this round.");
return;
default:
Player.SendMessage(p, "An unknown error occurred.");
return;
} }
return;
} }
else if (s[0] == "start") else if (s[0] == "start")
{ {
if (Server.zombie.ZombieStatus() != 0) { Player.SendMessage(p, "There is already a Zombie Survival game currently in progress."); return; } if (Server.zombie.Status != ZombieGameStatus.NotStarted) {
Player.SendMessage(p, "There is already a Zombie Survival game currently in progress."); return;
}
if (s.Length == 2) { if (s.Length == 2) {
int rounds = 1; int rounds = 1;
bool result = int.TryParse(s[1], out rounds); if (!int.TryParse(s[1], out rounds)) {
if (result == false) { Player.SendMessage(p, "You need to specify a valid option!"); return; } Player.SendMessage(p, "You need to specify a valid option!"); return;
if (s[1] == "0") }
Server.zombie.StartGame(1, 0); ZombieGameStatus status = rounds == 0 ?
else ZombieGameStatus.InfiniteRounds : ZombieGameStatus.VariableRounds;
Server.zombie.StartGame(3, rounds); Server.zombie.Start(status, rounds);
} else { } else {
Server.zombie.StartGame(2, 0); Server.zombie.Start(ZombieGameStatus.SingleRound, 0);
} }
} }
else if (s[0] == "stop") else if (s[0] == "stop")
{ {
if (Server.zombie.ZombieStatus() == 0) { Player.SendMessage(p, "There is no Zombie Survival game currently in progress."); return; } if (Server.zombie.Status == ZombieGameStatus.NotStarted) {
Player.SendMessage(p, "There is no Zombie Survival game currently in progress."); return;
}
Player.GlobalMessage("The current game of Zombie Survival will end this round!"); Player.GlobalMessage("The current game of Zombie Survival will end this round!");
Server.zombie.gameStatus = 4; Server.zombie.Status = ZombieGameStatus.LastRound;
} }
else if (s[0] == "force") else if (s[0] == "force")
{ {
if (Server.zombie.ZombieStatus() == 0) { Player.SendMessage(p, "There is no Zombie Survival game currently in progress."); return; } if (Server.zombie.Status == ZombieGameStatus.NotStarted) {
Player.SendMessage(p, "There is no Zombie Survival game currently in progress."); return;
}
Server.s.Log("Zombie Survival ended forcefully by " + p.name); Server.s.Log("Zombie Survival ended forcefully by " + p.name);
Server.zombie.aliveCount = 0; Server.zombie.aliveCount = 0;
Server.zombie.ResetState(); Server.zombie.ResetState();

View File

@ -159,7 +159,7 @@ namespace MCGalaxy.Commands {
} }
} }
if (Server.zombie.GameInProgess()) { if (Server.zombie.RoundInProgress) {
if (p.level.name == Server.zombie.currentLevelName) if (p.level.name == Server.zombie.currentLevelName)
Server.zombie.InfectedPlayerLogin(p); Server.zombie.InfectedPlayerLogin(p);
} }

View File

@ -32,7 +32,7 @@ namespace MCGalaxy.Commands {
ushort x = (ushort)(16 + (cpSpawn ? p.checkpointX : p.level.spawnx) * 32); ushort x = (ushort)(16 + (cpSpawn ? p.checkpointX : p.level.spawnx) * 32);
ushort y = (ushort)(32 + (cpSpawn ? p.checkpointY : p.level.spawny) * 32); ushort y = (ushort)(32 + (cpSpawn ? p.checkpointY : p.level.spawny) * 32);
ushort z = (ushort)(16 + (cpSpawn ? p.checkpointZ : p.level.spawnz) * 32); ushort z = (ushort)(16 + (cpSpawn ? p.checkpointZ : p.level.spawnz) * 32);
if (!p.referee && !p.infected && Server.zombie.GameInProgess()) if (!p.referee && !p.infected && Server.zombie.RoundInProgress)
Server.zombie.InfectPlayer(p); Server.zombie.InfectPlayer(p);
if (p.PlayingTntWars) { if (p.PlayingTntWars) {

View File

@ -29,31 +29,39 @@ namespace MCGalaxy {
public sealed partial class ZombieGame { public sealed partial class ZombieGame {
void MainLoop() { void MainLoop() {
if (gameStatus == 0) return; if (Status == ZombieGameStatus.NotStarted) return;
if (!initialChangeLevel) { if (!initialChangeLevel) {
ChangeLevel(); ChangeLevel();
initialChangeLevel = true; initialChangeLevel = true;
} }
while (true) { while (true) {
zombieRound = false; RoundInProgress = false;
RoundsDone++; RoundsDone++;
if (gameStatus == 0) { return; } if (Status == ZombieGameStatus.NotStarted) {
else if (gameStatus == 1) { DoRound(); if (ChangeLevels) ChangeLevel();} return;
else if (gameStatus == 2) { DoRound(); if (ChangeLevels) ChangeLevel(); gameStatus = 0; return; } } else if (Status == ZombieGameStatus.InfiniteRounds) {
else if (gameStatus == 3) DoRound();
{ if (ChangeLevels) ChangeLevel();
if (RoundsDone == MaxRounds) { ResetState(); return; } } else if (Status == ZombieGameStatus.SingleRound) {
else { DoRound(); if (ChangeLevels) ChangeLevel(); } DoRound();
ResetState(); return;
} else if (Status == ZombieGameStatus.VariableRounds) {
if (RoundsDone == MaxRounds) {
ResetState(); return;
} else {
DoRound();
if (ChangeLevels) ChangeLevel();
}
} else if (Status == ZombieGameStatus.LastRound) {
ResetState(); return;
} }
else if (gameStatus == 4) { ResetState(); return; }
} }
} }
void DoRound() void DoRound() {
{ if (Status == ZombieGameStatus.NotStarted) return;
if (gameStatus == 0) return;
List<Player> players = DoRoundCountdown(); List<Player> players = DoRoundCountdown();
theEnd: theEnd:
@ -71,7 +79,7 @@ namespace MCGalaxy {
Player.GlobalDespawn(player, false); Player.GlobalDespawn(player, false);
Player.GlobalSpawn(player, player.pos[0], player.pos[1], player.pos[2], player.rot[0], player.rot[1], false); Player.GlobalSpawn(player, player.pos[0], player.pos[1], player.pos[2], player.rot[0], player.rot[1], false);
zombieRound = true; RoundInProgress = true;
int roundMins = random.Next(5, 8); int roundMins = random.Next(5, 8);
Player.GlobalMessage("The round will last for " + roundMins + " minutes!"); Player.GlobalMessage("The round will last for " + roundMins + " minutes!");
timer = new System.Timers.Timer(roundMins * 60 * 1000); timer = new System.Timers.Timer(roundMins * 60 * 1000);
@ -90,8 +98,8 @@ namespace MCGalaxy {
aliveCount = alive.Count; aliveCount = alive.Count;
DoCoreGame(players, random); DoCoreGame(players, random);
if (gameStatus == 0) { if (Status == ZombieGameStatus.NotStarted) {
gameStatus = 4; return; Status = ZombieGameStatus.LastRound; return;
} else { } else {
HandOutRewards(); HandOutRewards();
} }
@ -117,7 +125,7 @@ namespace MCGalaxy {
Thread.Sleep(1000); if (!Server.ZombieModeOn) return null; Thread.Sleep(1000); if (!Server.ZombieModeOn) return null;
Player.GlobalMessage("%4Round Start:%f 1..."); Player.GlobalMessage("%4Round Start:%f 1...");
Thread.Sleep(1000); if (!Server.ZombieModeOn) return null; Thread.Sleep(1000); if (!Server.ZombieModeOn) return null;
zombieRound = true; RoundInProgress = true;
int nonRefPlayers = 0; int nonRefPlayers = 0;
List<Player> players = new List<Player>(); List<Player> players = new List<Player>();
@ -156,8 +164,9 @@ namespace MCGalaxy {
Player.GlobalDespawn(pAlive, false); Player.GlobalDespawn(pAlive, false);
Player.GlobalSpawn(pAlive, pAlive.pos[0], pAlive.pos[1], pAlive.pos[2], pAlive.rot[0], pAlive.rot[1], false); Player.GlobalSpawn(pAlive, pAlive.pos[0], pAlive.pos[1], pAlive.pos[2], pAlive.rot[0], pAlive.rot[1], false);
} }
if (Math.Abs(pAlive.pos[0] / 32 - pKiller.pos[0] / 32) <= 1 && Math.Abs(pAlive.pos[1] / 32 - pKiller.pos[1] / 32) <= 1 if (Math.Abs(pAlive.pos[0] - pKiller.pos[0]) <= HitboxPrecision
&& Math.Abs(pAlive.pos[2] / 32 - pKiller.pos[2] / 32) <= 1) { && Math.Abs(pAlive.pos[1] - pKiller.pos[1]) <= HitboxPrecision
&& Math.Abs(pAlive.pos[2] - pKiller.pos[2]) <= HitboxPrecision) {
if (!pAlive.infected && pKiller.infected && !pAlive.referee && !pKiller.referee && pKiller != pAlive && pKiller.level.name == currentLevelName && pAlive.level.name == currentLevelName) if (!pAlive.infected && pKiller.infected && !pAlive.referee && !pKiller.referee && pKiller != pAlive && pKiller.level.name == currentLevelName && pAlive.level.name == currentLevelName)
{ {
pAlive.infected = true; pAlive.infected = true;
@ -208,7 +217,7 @@ namespace MCGalaxy {
} }
public void EndRound(object sender, ElapsedEventArgs e) { public void EndRound(object sender, ElapsedEventArgs e) {
if (gameStatus == 0) return; if (Status == ZombieGameStatus.NotStarted) return;
Player.GlobalMessage("%4Round End:%f 5"); Thread.Sleep(1000); Player.GlobalMessage("%4Round End:%f 5"); Thread.Sleep(1000);
Player.GlobalMessage("%4Round End:%f 4"); Thread.Sleep(1000); Player.GlobalMessage("%4Round End:%f 4"); Thread.Sleep(1000);
Player.GlobalMessage("%4Round End:%f 3"); Thread.Sleep(1000); Player.GlobalMessage("%4Round End:%f 3"); Thread.Sleep(1000);
@ -218,8 +227,8 @@ namespace MCGalaxy {
} }
public void HandOutRewards() { public void HandOutRewards() {
zombieRound = false; RoundInProgress = false;
if (gameStatus == 0) return; if (Status == ZombieGameStatus.NotStarted) return;
Player.GlobalMessage(Colors.lime + "The game has ended!"); Player.GlobalMessage(Colors.lime + "The game has ended!");
if(aliveCount == 0) if(aliveCount == 0)
Player.GlobalMessage(Colors.maroon + "Zombies have won this round."); Player.GlobalMessage(Colors.maroon + "Zombies have won this round.");
@ -375,7 +384,8 @@ namespace MCGalaxy {
Level1Vote = 0; Level2Vote = 0; Level3Vote = 0; Level1Vote = 0; Level2Vote = 0; Level3Vote = 0;
lastLevelVote1 = selectedLevel1; lastLevelVote2 = selectedLevel2; lastLevelVote1 = selectedLevel1; lastLevelVote2 = selectedLevel2;
if (gameStatus == 4 || gameStatus == 0) { return; } if (Status == ZombieGameStatus.NotStarted || Status == ZombieGameStatus.LastRound)
return;
if (initialChangeLevel) if (initialChangeLevel)
{ {
@ -387,7 +397,8 @@ namespace MCGalaxy {
} }
else { Level1Vote = 1; Level2Vote = 0; Level3Vote = 0; } else { Level1Vote = 1; Level2Vote = 0; Level3Vote = 0; }
if (gameStatus == 4 || gameStatus == 0) { return; } if (Status == ZombieGameStatus.NotStarted || Status == ZombieGameStatus.LastRound)
return;
if (Level1Vote >= Level2Vote) if (Level1Vote >= Level2Vote)
{ {

View File

@ -90,7 +90,7 @@ namespace MCGalaxy {
} }
public override void PlayerJoinedServer(Player p) { public override void PlayerJoinedServer(Player p) {
if (ZombieStatus() != 0) if (Status != ZombieGameStatus.NotStarted)
Player.SendMessage(p, "There is a Zombie Survival game currently in-progress! " + Player.SendMessage(p, "There is a Zombie Survival game currently in-progress! " +
"Join it by typing /g " + Server.zombie.currentLevelName); "Join it by typing /g " + Server.zombie.currentLevelName);
} }

View File

@ -35,13 +35,24 @@ namespace MCGalaxy {
} }
} }
public enum ZombieGameStatus { NotStarted, InfiniteRounds, SingleRound, VariableRounds, LastRound }
public sealed partial class ZombieGame { public sealed partial class ZombieGame {
/// <summary> The number of rounds that have been played in this game so far. </summary> /// <summary> The number of rounds that have been played in this game so far. </summary>
public int RoundsDone = 0; public int RoundsDone = 0;
/// <summary> The maximum number of rounds that can be played before the game ends. </summary> /// <summary> The maximum number of rounds that can be played before the game ends. </summary>
public int MaxRounds = 0; public int MaxRounds = 0;
/// <summary> How precise collision detection is between alive and dead players. (Where 1 block = 32 units) </summary>
public int HitboxPrecision = 24;
/// <summary> Current round status of the game. </summary>
public ZombieGameStatus Status = ZombieGameStatus.NotStarted;
public bool RoundInProgress = false;
public int aliveCount = 0; public int aliveCount = 0;
public string currentZombieLevel = ""; public string currentZombieLevel = "";
public static System.Timers.Timer timer; public static System.Timers.Timer timer;
@ -54,10 +65,8 @@ namespace MCGalaxy {
internal bool noRespawn = true, noLevelSaving = true, noPillaring = true; internal bool noRespawn = true, noLevelSaving = true, noPillaring = true;
internal string ZombieName = ""; internal string ZombieName = "";
internal int gameStatus = 0; //0 = not started, 1 = always on, 2 = one time, 3 = certain amount of rounds, 4 = stop game next round
internal bool queLevel = false, queZombie = false; internal bool queLevel = false, queZombie = false;
internal string nextZombie = "", nextLevel = ""; internal string nextZombie = "", nextLevel = "";
internal bool zombieRound = false;
internal bool ChangeLevels = true, UseLevelList = false; internal bool ChangeLevels = true, UseLevelList = false;
internal List<string> LevelList = new List<string>(); internal List<string> LevelList = new List<string>();
@ -69,63 +78,42 @@ namespace MCGalaxy {
int infectCombo = 0; int infectCombo = 0;
public Dictionary<string, BountyData> Bounties = new Dictionary<string, BountyData>(); public Dictionary<string, BountyData> Bounties = new Dictionary<string, BountyData>();
public void StartGame(int status, int amount) public void Start(ZombieGameStatus status, int amount) {
{
//status: 0 = not started, 1 = always on, 2 = one time, 3 = certain amount of rounds, 4 = stop round next round
if (status == 0) return;
//SET ALL THE VARIABLES!
if (UseLevelList && LevelList == null) if (UseLevelList && LevelList == null)
ChangeLevels = false; ChangeLevels = false;
Server.ZombieModeOn = true; Server.ZombieModeOn = true;
gameStatus = status; Status = status;
zombieRound = false; RoundInProgress = false;
initialChangeLevel = false; initialChangeLevel = false;
MaxRounds = amount + 1; MaxRounds = amount + 1;
RoundsDone = 0; RoundsDone = 0;
//SET ALL THE VARIABLES?!?
//Start the main Zombie thread Thread t = new Thread(MainLoop);
Thread t = new Thread(MainLoop); t.Name = "MCG_ZombieGame";
t.Name = "MCG_ZombieGame"; t.Start();
t.Start();
} }
public void InfectedPlayerDC() public void InfectedPlayerDC() {
{ if (Status == ZombieGameStatus.NotStarted) return;
if (gameStatus == 0) return;
//This is for when the first zombie disconnects //This is for when the first zombie disconnects
Random random = new Random(); Random random = new Random();
if ((gameStatus != 0 && zombieRound) && infectd.Count <= 0) if ((Status != ZombieGameStatus.NotStarted && RoundInProgress) && infectd.Count <= 0) {
{ if (alive.Count == 0) return;
int firstinfect = random.Next(alive.Count); int index = random.Next(alive.Count);
firstinfect = firstinfect - 1;
while (alive[firstinfect].referee || alive[firstinfect].level.name == Server.zombie.currentLevelName) while (alive[index].referee || alive[index].level.name == Server.zombie.currentLevelName) {
{ if (index >= alive.Count - 1) index = 0;
if (firstinfect == alive.Count) else index++;
{
firstinfect = 0;
}
else
{
firstinfect++;
}
} }
Player.GlobalMessage(alive[firstinfect].color + alive[firstinfect].name + Server.DefaultColor + " continued the infection!");
alive[firstinfect].color = Colors.red; Player zombie = alive[index];
Player.GlobalDespawn(alive[firstinfect], false); Player.GlobalMessage(zombie.FullName + " %Scontinued the infection!");
Player.GlobalSpawn(alive[firstinfect], alive[firstinfect].pos[0], alive[firstinfect].pos[1], alive[firstinfect].pos[2], alive[firstinfect].rot[0], alive[firstinfect].rot[1], false); InfectPlayer(zombie);
infectd.Add(alive[firstinfect]);
alive.Remove(alive[firstinfect]);
} }
return;
} }
public bool InfectedPlayerLogin(Player p) public bool InfectedPlayerLogin(Player p) {
{ if (Status == ZombieGameStatus.NotStarted || p == null) return false;
if (gameStatus == 0) return false;
if (p == null) return false;
if (p.level.name != Server.zombie.currentLevelName) return false; if (p.level.name != Server.zombie.currentLevelName) return false;
p.SendMessage("You have joined in the middle of a round. You are now infected!"); p.SendMessage("You have joined in the middle of a round. You are now infected!");
p.blockCount = 50; p.blockCount = 50;
@ -137,19 +125,9 @@ namespace MCGalaxy {
return true; return true;
} }
public int ZombieStatus()
{
return gameStatus;
}
public bool GameInProgess()
{
return zombieRound;
}
public void InfectPlayer(Player p) public void InfectPlayer(Player p)
{ {
if (!zombieRound || p == null) return; if (!RoundInProgress || p == null) return;
infectd.Add(p); infectd.Add(p);
alive.Remove(p); alive.Remove(p);
p.infected = true; p.infected = true;
@ -161,7 +139,7 @@ namespace MCGalaxy {
public void DisinfectPlayer(Player p) public void DisinfectPlayer(Player p)
{ {
if (!zombieRound || p == null) return; if (!RoundInProgress || p == null) return;
infectd.Remove(p); infectd.Remove(p);
alive.Add(p); alive.Add(p);
p.infected = false; p.infected = false;
@ -206,11 +184,11 @@ namespace MCGalaxy {
} }
public void ResetState() { public void ResetState() {
gameStatus = 0; Status = ZombieGameStatus.NotStarted;
MaxRounds = 0; MaxRounds = 0;
initialChangeLevel = false; initialChangeLevel = false;
Server.ZombieModeOn = false; Server.ZombieModeOn = false;
zombieRound = false; RoundInProgress = false;
} }
} }
} }

View File

@ -180,12 +180,14 @@
<Compile Include="Commands\Fun\CmdCountdown.cs" /> <Compile Include="Commands\Fun\CmdCountdown.cs" />
<Compile Include="Commands\Fun\CmdCtf.cs" /> <Compile Include="Commands\Fun\CmdCtf.cs" />
<Compile Include="Commands\Fun\CmdDisinfect.cs" /> <Compile Include="Commands\Fun\CmdDisinfect.cs" />
<Compile Include="Commands\Fun\CmdEndRound.cs" />
<Compile Include="Commands\Fun\CmdFliphead.cs" /> <Compile Include="Commands\Fun\CmdFliphead.cs" />
<Compile Include="Commands\Fun\CmdFlipHeads.cs" /> <Compile Include="Commands\Fun\CmdFlipHeads.cs" />
<Compile Include="Commands\Fun\CmdInfect.cs" /> <Compile Include="Commands\Fun\CmdInfect.cs" />
<Compile Include="Commands\Fun\CmdInfected.cs" /> <Compile Include="Commands\Fun\CmdInfected.cs" />
<Compile Include="Commands\Fun\CmdLavaSurvival.cs" /> <Compile Include="Commands\Fun\CmdLavaSurvival.cs" />
<Compile Include="Commands\Fun\CmdQueue.cs" /> <Compile Include="Commands\Fun\CmdQueue.cs" />
<Compile Include="Commands\Fun\CmdReferee.cs" />
<Compile Include="Commands\Fun\CmdSlap.cs" /> <Compile Include="Commands\Fun\CmdSlap.cs" />
<Compile Include="Commands\Fun\CmdTntWars.cs" /> <Compile Include="Commands\Fun\CmdTntWars.cs" />
<Compile Include="Commands\Fun\CmdZombieGame.cs" /> <Compile Include="Commands\Fun\CmdZombieGame.cs" />
@ -242,7 +244,6 @@
<Compile Include="Commands\Moderation\CmdCrashServer.cs" /> <Compile Include="Commands\Moderation\CmdCrashServer.cs" />
<Compile Include="Commands\Moderation\CmdDelTempRank.cs" /> <Compile Include="Commands\Moderation\CmdDelTempRank.cs" />
<Compile Include="Commands\Moderation\CmdDemote.cs" /> <Compile Include="Commands\Moderation\CmdDemote.cs" />
<Compile Include="Commands\Moderation\CmdEndRound.cs" />
<Compile Include="Commands\Moderation\CmdExplode.cs" /> <Compile Include="Commands\Moderation\CmdExplode.cs" />
<Compile Include="Commands\Moderation\CmdFollow.cs" /> <Compile Include="Commands\Moderation\CmdFollow.cs" />
<Compile Include="Commands\Moderation\CmdFreeze.cs" /> <Compile Include="Commands\Moderation\CmdFreeze.cs" />
@ -273,7 +274,6 @@
<Compile Include="Commands\Moderation\CmdPromote.cs" /> <Compile Include="Commands\Moderation\CmdPromote.cs" />
<Compile Include="Commands\Moderation\CmdPUnload.cs" /> <Compile Include="Commands\Moderation\CmdPUnload.cs" />
<Compile Include="Commands\Moderation\CmdRankInfo.cs" /> <Compile Include="Commands\Moderation\CmdRankInfo.cs" />
<Compile Include="Commands\Moderation\CmdReferee.cs" />
<Compile Include="Commands\Moderation\CmdRenameLvl.cs" /> <Compile Include="Commands\Moderation\CmdRenameLvl.cs" />
<Compile Include="Commands\Moderation\CmdResetBot.cs" /> <Compile Include="Commands\Moderation\CmdResetBot.cs" />
<Compile Include="Commands\Moderation\CmdRestart.cs" /> <Compile Include="Commands\Moderation\CmdRestart.cs" />

View File

@ -186,7 +186,7 @@ namespace MCGalaxy {
if (Server.lava.startOnStartup) if (Server.lava.startOnStartup)
Server.lava.Start(); Server.lava.Start();
if (Server.startZombieModeOnStartup) if (Server.startZombieModeOnStartup)
Server.zombie.StartGame(1, 0); Server.zombie.Start(ZombieGameStatus.InfiniteRounds, 0);
//This doesnt use the main map //This doesnt use the main map
if (Server.UseCTF) if (Server.UseCTF)
ctf = new Auto_CTF(); ctf = new Auto_CTF();