mirror of
https://github.com/ClassiCube/MCGalaxy.git
synced 2025-09-26 14:54:12 -04:00
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:
parent
a24dbf123d
commit
b5eaa7d4d2
@ -1,43 +1,51 @@
|
|||||||
/*
|
/*
|
||||||
Copyright 2010 MCSharp team (Modified for use with MCZall/MCLawl/MCGalaxy)
|
Copyright 2010 MCSharp team (Modified for use with MCZall/MCLawl/MCGalaxy)
|
||||||
|
|
||||||
Dual-licensed under the Educational Community License, Version 2.0 and
|
Dual-licensed under the Educational Community License, Version 2.0 and
|
||||||
the GNU General Public License, Version 3 (the "Licenses"); you may
|
the GNU General Public License, Version 3 (the "Licenses"); you may
|
||||||
not use this file except in compliance with the Licenses. You may
|
not use this file except in compliance with the Licenses. You may
|
||||||
obtain a copy of the Licenses at
|
obtain a copy of the Licenses at
|
||||||
|
|
||||||
http://www.opensource.org/licenses/ecl2.php
|
http://www.opensource.org/licenses/ecl2.php
|
||||||
http://www.gnu.org/licenses/gpl-3.0.html
|
http://www.gnu.org/licenses/gpl-3.0.html
|
||||||
|
|
||||||
Unless required by applicable law or agreed to in writing,
|
Unless required by applicable law or agreed to in writing,
|
||||||
software distributed under the Licenses are distributed on an "AS IS"
|
software distributed under the Licenses are distributed on an "AS IS"
|
||||||
BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
|
BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
|
||||||
or implied. See the Licenses for the specific language governing
|
or implied. See the Licenses for the specific language governing
|
||||||
permissions and limitations under the Licenses.
|
permissions and limitations under the Licenses.
|
||||||
*/
|
*/
|
||||||
using System;
|
using System;
|
||||||
namespace MCGalaxy.Commands
|
using MCGalaxy.Games;
|
||||||
{
|
|
||||||
public sealed class CmdTime : Command
|
namespace MCGalaxy.Commands {
|
||||||
{
|
|
||||||
|
public sealed class CmdTime : Command {
|
||||||
public override string name { get { return "time"; } }
|
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 string type { get { return CommandTypes.Information; } }
|
||||||
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 CmdTime() { }
|
public CmdTime() { }
|
||||||
|
|
||||||
public override void Use(Player p, string message)
|
public override void Use(Player p, string message) {
|
||||||
{
|
string time = DateTime.Now.ToString("HH:mm:ss"); //DateTime.Now.ToString();
|
||||||
string time = DateTime.Now.ToString("HH:mm:ss");
|
Player.SendMessage(p, "Server time is " + time);
|
||||||
message = "Server time is " + time;
|
if (Server.zombie.Status != ZombieGameStatus.NotStarted) {
|
||||||
Player.SendMessage(p, message);
|
int delta = (int)(DateTime.UtcNow - Server.zombie.RoundEnd);
|
||||||
//message = "full Date/Time is " + DateTime.Now.ToString();
|
if (delta > 0) {
|
||||||
//Player.SendMessage(p, message);
|
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, "/time - Shows the server time.");
|
||||||
|
Player.SendMessage(p, "If zombie survival is running, shows time left until round end or start.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -156,7 +156,7 @@ namespace MCGalaxy.Games {
|
|||||||
UpdatePlayerColor(pKiller, Colors.red);
|
UpdatePlayerColor(pKiller, Colors.red);
|
||||||
bool aliveChanged = false;
|
bool aliveChanged = false;
|
||||||
foreach (Player pAlive in alive) {
|
foreach (Player pAlive in alive) {
|
||||||
UpdatePlayerColor(pAlive, pAlive.group.color);
|
UpdatePlayerColor(pAlive, pAlive.color);
|
||||||
if (Math.Abs(pAlive.pos[0] - pKiller.pos[0]) > HitboxPrecision
|
if (Math.Abs(pAlive.pos[0] - pKiller.pos[0]) > HitboxPrecision
|
||||||
|| Math.Abs(pAlive.pos[1] - pKiller.pos[1]) > HitboxPrecision
|
|| Math.Abs(pAlive.pos[1] - pKiller.pos[1]) > HitboxPrecision
|
||||||
|| Math.Abs(pAlive.pos[2] - pKiller.pos[2]) > 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);
|
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;
|
if (Status == ZombieGameStatus.NotStarted) return;
|
||||||
CurrentLevel.ChatLevel("%4Round End:%f 5"); Thread.Sleep(1000);
|
CurrentLevel.ChatLevel("%4Round End:%f 5"); Thread.Sleep(1000);
|
||||||
CurrentLevel.ChatLevel("%4Round End:%f 4"); Thread.Sleep(1000);
|
CurrentLevel.ChatLevel("%4Round End:%f 4"); Thread.Sleep(1000);
|
||||||
@ -239,6 +239,7 @@ namespace MCGalaxy.Games {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void HandOutRewards() {
|
public void HandOutRewards() {
|
||||||
|
if (!RoundInProgress) return;
|
||||||
RoundInProgress = false;
|
RoundInProgress = false;
|
||||||
RoundStart = DateTime.MinValue;
|
RoundStart = DateTime.MinValue;
|
||||||
RoundEnd = DateTime.MinValue;
|
RoundEnd = DateTime.MinValue;
|
||||||
|
@ -155,7 +155,7 @@ namespace MCGalaxy.Games {
|
|||||||
Infected.Remove(p);
|
Infected.Remove(p);
|
||||||
Alive.Add(p);
|
Alive.Add(p);
|
||||||
p.infected = false;
|
p.infected = false;
|
||||||
UpdatePlayerColor(p, p.group.color);
|
UpdatePlayerColor(p, p.color);
|
||||||
UpdateAllPlayerStatus();
|
UpdateAllPlayerStatus();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user