mirror of
https://github.com/ClassiCube/MCGalaxy.git
synced 2025-09-23 04:32:50 -04:00
Abort round countdown if status changed.
This commit is contained in:
parent
0714e9c59c
commit
78e1acfdd5
@ -227,7 +227,7 @@ namespace MCGalaxy.Commands.Fun {
|
|||||||
if (game.Players.Count < 2) {
|
if (game.Players.Count < 2) {
|
||||||
Player.Message(p, "At least two players must join countdown before a round can begin."); return;
|
Player.Message(p, "At least two players must join countdown before a round can begin."); return;
|
||||||
}
|
}
|
||||||
game.Status = CountdownGameStatus.RoundCountdown; break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (speed) {
|
switch (speed) {
|
||||||
|
@ -53,10 +53,11 @@ namespace MCGalaxy.Games {
|
|||||||
#region Round
|
#region Round
|
||||||
|
|
||||||
public void BeginRound(Player p) {
|
public void BeginRound(Player p) {
|
||||||
|
Status = CountdownGameStatus.RoundCountdown;
|
||||||
ResetMap();
|
ResetMap();
|
||||||
SetGlassTube(Block.glass, Block.glass);
|
SetGlassTube(Block.glass, Block.glass);
|
||||||
Map.ChatLevel("Countdown is about to start!");
|
Map.ChatLevel("Countdown is about to start!");
|
||||||
Map.BuildAccess.Min = LevelPermission.Nobody;
|
if (Status != CountdownGameStatus.RoundCountdown) return;
|
||||||
|
|
||||||
int midX = Map.Width / 2, midY = Map.Height / 2, midZ = Map.Length / 2;
|
int midX = Map.Width / 2, midY = Map.Height / 2, midZ = Map.Length / 2;
|
||||||
int xSpawn = (midX * 32 + 16);
|
int xSpawn = (midX * 32 + 16);
|
||||||
@ -76,15 +77,21 @@ namespace MCGalaxy.Games {
|
|||||||
Thread.Sleep(2000);
|
Thread.Sleep(2000);
|
||||||
SpawnPlayers(xSpawn, ySpawn, zSpawn);
|
SpawnPlayers(xSpawn, ySpawn, zSpawn);
|
||||||
Map.ChatLevel("-----&b5%S-----");
|
Map.ChatLevel("-----&b5%S-----");
|
||||||
|
if (Status != CountdownGameStatus.RoundCountdown) return;
|
||||||
|
|
||||||
Cuboid(midX - 1, midY, midZ - 1, midX, midY, midZ, Block.air, Map);
|
Cuboid(midX - 1, midY, midZ - 1, midX, midY, midZ, Block.air, Map);
|
||||||
Thread.Sleep(1000);
|
Thread.Sleep(1000);
|
||||||
|
if (Status != CountdownGameStatus.RoundCountdown) return;
|
||||||
|
|
||||||
Map.ChatLevel("-----&b4%S-----"); Thread.Sleep(1000);
|
Map.ChatLevel("-----&b4%S-----"); Thread.Sleep(1000);
|
||||||
Map.ChatLevel("-----&b3%S-----"); Thread.Sleep(1000);
|
Map.ChatLevel("-----&b3%S-----"); Thread.Sleep(1000);
|
||||||
Cuboid(midX, Map.Height - 5, midZ, midX + 1, Map.Height - 5, midZ + 1, Block.air, Map);
|
Cuboid(midX, Map.Height - 5, midZ, midX + 1, Map.Height - 5, midZ + 1, Block.air, Map);
|
||||||
|
if (Status != CountdownGameStatus.RoundCountdown) return;
|
||||||
|
|
||||||
Map.ChatLevel("-----&b2%S-----"); Thread.Sleep(1000);
|
Map.ChatLevel("-----&b2%S-----"); Thread.Sleep(1000);
|
||||||
Map.ChatLevel("-----&b1%S-----"); Thread.Sleep(1000);
|
Map.ChatLevel("-----&b1%S-----"); Thread.Sleep(1000);
|
||||||
Map.ChatLevel("GO!!!!!!!");
|
Map.ChatLevel("GO!!!!!!!");
|
||||||
|
if (Status != CountdownGameStatus.RoundCountdown) return;
|
||||||
|
|
||||||
Player[] players = Players.Items;
|
Player[] players = Players.Items;
|
||||||
Remaining.Clear();
|
Remaining.Clear();
|
||||||
@ -102,7 +109,7 @@ namespace MCGalaxy.Games {
|
|||||||
pl.SendMessage("Sending you to the correct map.");
|
pl.SendMessage("Sending you to the correct map.");
|
||||||
PlayerActions.ChangeMap(pl, Map.name);
|
PlayerActions.ChangeMap(pl, Map.name);
|
||||||
}
|
}
|
||||||
|
|
||||||
Entities.Spawn(pl, pl, pos, pl.Rot);
|
Entities.Spawn(pl, pl, pos, pl.Rot);
|
||||||
pl.SendPos(Entities.SelfID, pos, pl.Rot);
|
pl.SendPos(Entities.SelfID, pos, pl.Rot);
|
||||||
}
|
}
|
||||||
@ -114,7 +121,7 @@ namespace MCGalaxy.Games {
|
|||||||
void DoRound() {
|
void DoRound() {
|
||||||
if (FreezeMode) {
|
if (FreezeMode) {
|
||||||
MessageFreezeCountdown();
|
MessageFreezeCountdown();
|
||||||
Map.ChatLevel("&bPlayers Frozen");
|
Map.ChatLevel("&bPlayers Frozen");
|
||||||
|
|
||||||
Player[] players = Players.Items;
|
Player[] players = Players.Items;
|
||||||
foreach (Player pl in players) {
|
foreach (Player pl in players) {
|
||||||
@ -134,20 +141,30 @@ namespace MCGalaxy.Games {
|
|||||||
Thread.Sleep(500);
|
Thread.Sleep(500);
|
||||||
Map.ChatLevel("Welcome to Freeze Mode of countdown");
|
Map.ChatLevel("Welcome to Freeze Mode of countdown");
|
||||||
Map.ChatLevel("You have 15 seconds to stand on a square");
|
Map.ChatLevel("You have 15 seconds to stand on a square");
|
||||||
|
if (Status != CountdownGameStatus.RoundCountdown) return;
|
||||||
|
|
||||||
Thread.Sleep(500);
|
Thread.Sleep(500);
|
||||||
Map.ChatLevel("-----&b15%S-----"); Thread.Sleep(500);
|
Map.ChatLevel("-----&b15%S-----"); Thread.Sleep(500);
|
||||||
Map.ChatLevel("Once the countdown is up, you are stuck on your square");
|
Map.ChatLevel("Once the countdown is up, you are stuck on your square");
|
||||||
|
if (Status != CountdownGameStatus.RoundCountdown) return;
|
||||||
|
|
||||||
Thread.Sleep(500);
|
Thread.Sleep(500);
|
||||||
Map.ChatLevel("-----&b14%S-----"); Thread.Sleep(500);
|
Map.ChatLevel("-----&b14%S-----"); Thread.Sleep(500);
|
||||||
Map.ChatLevel("The squares then start to dissapear");
|
Map.ChatLevel("The squares then start to dissapear");
|
||||||
|
if (Status != CountdownGameStatus.RoundCountdown) return;
|
||||||
|
|
||||||
Thread.Sleep(500);
|
Thread.Sleep(500);
|
||||||
Map.ChatLevel("-----&b13%S-----"); Thread.Sleep(500);
|
Map.ChatLevel("-----&b13%S-----"); Thread.Sleep(500);
|
||||||
Map.ChatLevel("Whoever is last out wins!");
|
Map.ChatLevel("Whoever is last out wins!");
|
||||||
|
if (Status != CountdownGameStatus.RoundCountdown) return;
|
||||||
|
|
||||||
Thread.Sleep(500);
|
Thread.Sleep(500);
|
||||||
Map.ChatLevel("-----&b12%S-----"); Thread.Sleep(1000);
|
Map.ChatLevel("-----&b12%S-----"); Thread.Sleep(1000);
|
||||||
Map.ChatLevel("-----&b11%S-----"); Thread.Sleep(1000);
|
Map.ChatLevel("-----&b11%S-----"); Thread.Sleep(1000);
|
||||||
Map.ChatLevel("-----&b10%S-----");
|
Map.ChatLevel("-----&b10%S-----");
|
||||||
Map.ChatLevel("Only 10 Seconds left to pick your places!");
|
Map.ChatLevel("Only 10 Seconds left to pick your places!");
|
||||||
|
if (Status != CountdownGameStatus.RoundCountdown) return;
|
||||||
|
|
||||||
Thread.Sleep(1000);
|
Thread.Sleep(1000);
|
||||||
Map.ChatLevel("-----&b9%S-----"); Thread.Sleep(1000);
|
Map.ChatLevel("-----&b9%S-----"); Thread.Sleep(1000);
|
||||||
Map.ChatLevel("-----&b8%S-----"); Thread.Sleep(1000);
|
Map.ChatLevel("-----&b8%S-----"); Thread.Sleep(1000);
|
||||||
@ -155,6 +172,8 @@ namespace MCGalaxy.Games {
|
|||||||
Map.ChatLevel("-----&b6%S-----"); Thread.Sleep(1000);
|
Map.ChatLevel("-----&b6%S-----"); Thread.Sleep(1000);
|
||||||
Map.ChatLevel("-----&b5%S-----");
|
Map.ChatLevel("-----&b5%S-----");
|
||||||
Map.ChatLevel("5 Seconds left to pick your places!");
|
Map.ChatLevel("5 Seconds left to pick your places!");
|
||||||
|
if (Status != CountdownGameStatus.RoundCountdown) return;
|
||||||
|
|
||||||
Thread.Sleep(1000);
|
Thread.Sleep(1000);
|
||||||
Map.ChatLevel("-----&b4%S-----"); Thread.Sleep(1000);
|
Map.ChatLevel("-----&b4%S-----"); Thread.Sleep(1000);
|
||||||
Map.ChatLevel("-----&b3%S-----"); Thread.Sleep(1000);
|
Map.ChatLevel("-----&b3%S-----"); Thread.Sleep(1000);
|
||||||
@ -193,7 +212,7 @@ namespace MCGalaxy.Games {
|
|||||||
RemoveSquare(nextSquare);
|
RemoveSquare(nextSquare);
|
||||||
|
|
||||||
if (squaresLeft.Count % 10 == 0) {
|
if (squaresLeft.Count % 10 == 0) {
|
||||||
if (Status != CountdownGameStatus.RoundInProgress) return;
|
if (Status != CountdownGameStatus.RoundInProgress) return;
|
||||||
Map.ChatLevel(squaresLeft.Count + " squares left and " + Remaining.Count + " players remaining!");
|
Map.ChatLevel(squaresLeft.Count + " squares left and " + Remaining.Count + " players remaining!");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -292,7 +311,7 @@ namespace MCGalaxy.Games {
|
|||||||
Player[] players = Players.Items;
|
Player[] players = Players.Items;
|
||||||
foreach (Player pl in players) {
|
foreach (Player pl in players) {
|
||||||
Command.all.Find("spawn").Use(pl, "");
|
Command.all.Find("spawn").Use(pl, "");
|
||||||
}
|
}
|
||||||
Map.ChatLevel("Current round was force ended!");
|
Map.ChatLevel("Current round was force ended!");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user