Fix 'round end' being shown twice when the round ended with humans surviving, fix entities being repeatedly respawned, update /time to also show the time left in the round when running with zombie survival.

This commit is contained in:
UnknownShadow200 2016-03-22 22:55:12 +11:00
parent a24dbf123d
commit b5eaa7d4d2
3 changed files with 41 additions and 32 deletions

View File

@ -16,28 +16,36 @@
permissions and limitations under the Licenses.
*/
using System;
namespace MCGalaxy.Commands
{
public sealed class CmdTime : Command
{
using MCGalaxy.Games;
namespace MCGalaxy.Commands {
public sealed class CmdTime : Command {
public override string name { get { return "time"; } }
public override string shortcut { get { return ""; } }
public override string shortcut { get { return "ti"; } }
public override string type { get { return CommandTypes.Information; } }
public override bool museumUsable { get { return true; } }
public override LevelPermission defaultRank { get { return LevelPermission.Banned; } }
public CmdTime() { }
public override void Use(Player p, string message)
{
string time = DateTime.Now.ToString("HH:mm:ss");
message = "Server time is " + time;
Player.SendMessage(p, message);
//message = "full Date/Time is " + DateTime.Now.ToString();
//Player.SendMessage(p, message);
public override void Use(Player p, string message) {
string time = DateTime.Now.ToString("HH:mm:ss"); //DateTime.Now.ToString();
Player.SendMessage(p, "Server time is " + time);
if (Server.zombie.Status != ZombieGameStatus.NotStarted) {
int delta = (int)(DateTime.UtcNow - Server.zombie.RoundEnd);
if (delta > 0) {
Player.SendMessage(p, "&a" + delta + " %Sseconds until the round ends.");
} else {
delta = (int)(DateTime.UtcNow - Server.zombie.RoundStart);
if (delta > 0)
Player.SendMessage(p, "&a" + delta + " %Sseconds until the round starts.");
}
public override void Help(Player p)
{
}
}
public override void Help(Player p) {
Player.SendMessage(p, "/time - Shows the server time.");
Player.SendMessage(p, "If zombie survival is running, shows time left until round end or start.");
}
}
}

View File

@ -156,7 +156,7 @@ namespace MCGalaxy.Games {
UpdatePlayerColor(pKiller, Colors.red);
bool aliveChanged = false;
foreach (Player pAlive in alive) {
UpdatePlayerColor(pAlive, pAlive.group.color);
UpdatePlayerColor(pAlive, pAlive.color);
if (Math.Abs(pAlive.pos[0] - pKiller.pos[0]) > HitboxPrecision
|| Math.Abs(pAlive.pos[1] - pKiller.pos[1]) > HitboxPrecision
|| Math.Abs(pAlive.pos[2] - pKiller.pos[2]) > HitboxPrecision)
@ -228,7 +228,7 @@ namespace MCGalaxy.Games {
Player.GlobalSpawn(p, p.pos[0], p.pos[1], p.pos[2], p.rot[0], p.rot[1], false);
}
public void EndRound(object sender, ElapsedEventArgs e) {
void EndRound(object sender, ElapsedEventArgs e) {
if (Status == ZombieGameStatus.NotStarted) return;
CurrentLevel.ChatLevel("%4Round End:%f 5"); Thread.Sleep(1000);
CurrentLevel.ChatLevel("%4Round End:%f 4"); Thread.Sleep(1000);
@ -239,6 +239,7 @@ namespace MCGalaxy.Games {
}
public void HandOutRewards() {
if (!RoundInProgress) return;
RoundInProgress = false;
RoundStart = DateTime.MinValue;
RoundEnd = DateTime.MinValue;

View File

@ -155,7 +155,7 @@ namespace MCGalaxy.Games {
Infected.Remove(p);
Alive.Add(p);
p.infected = false;
UpdatePlayerColor(p, p.group.color);
UpdatePlayerColor(p, p.color);
UpdateAllPlayerStatus();
}