mirror of
https://github.com/ClassiCube/MCGalaxy.git
synced 2025-09-24 05:03:34 -04:00
Add IGame.Running
This commit is contained in:
parent
e9c02198ce
commit
92ecccdc51
@ -41,6 +41,9 @@ namespace MCGalaxy.Games {
|
||||
internal string map1 = "", map2 = "", map3 = "";
|
||||
public bool started = false;
|
||||
|
||||
/// <summary> Gets whether CTF is currently running. </summary>
|
||||
public override bool Running { get { return started; } }
|
||||
|
||||
public CtfTeam2 Red, Blue;
|
||||
List<CtfData> cache = new List<CtfData>();
|
||||
|
||||
|
@ -32,6 +32,8 @@ namespace MCGalaxy.Games {
|
||||
/// <summary> Current status of the countdown game. </summary>
|
||||
public CountdownGameStatus Status = CountdownGameStatus.Disabled;
|
||||
|
||||
// <summary> Gets whether countdown is currently running. </summary>
|
||||
public override bool Running { get { return Status != CountdownGameStatus.Disabled; } }
|
||||
|
||||
/// <summary> Whether the game is running in freeze mode or not. </summary>
|
||||
public bool FreezeMode = false;
|
||||
|
@ -27,6 +27,9 @@ namespace MCGalaxy.Games {
|
||||
/// <summary> Level instance of the map this game is running on. </summary>
|
||||
public Level Map;
|
||||
|
||||
/// <summary> Gets whether this game is currently running. </summary>
|
||||
public abstract bool Running { get; }
|
||||
|
||||
/// <summary> Whether players are allowed to teleport to others when not in referee mode. </summary>
|
||||
public virtual bool TeleportAllowed { get { return true; } }
|
||||
|
||||
|
@ -39,6 +39,9 @@ namespace MCGalaxy.Games
|
||||
public Level map;
|
||||
public MapSettings mapSettings;
|
||||
public MapData mapData;
|
||||
|
||||
/// <summary> Gets whether lava survival is currently running. </summary>
|
||||
public override bool Running { get { return active; } }
|
||||
|
||||
// Settings
|
||||
public bool startOnStartup, sendAfkMain = true;
|
||||
|
@ -32,7 +32,18 @@ namespace MCGalaxy.Games {
|
||||
internal string Candidate1 = "", Candidate2 = "", Candidate3 = "";
|
||||
internal int Votes1 = 0, Votes2 = 0, Votes3 = 0;
|
||||
|
||||
public string ChooseNextLevel(ZSGame game) {
|
||||
public void AddRecentMap(string map) {
|
||||
if (RecentMaps.Count >= 20)
|
||||
RecentMaps.RemoveAt(0);
|
||||
RecentMaps.Add(map);
|
||||
}
|
||||
|
||||
public void Clear() {
|
||||
QueuedMap = null;
|
||||
RecentMaps.Clear();
|
||||
}
|
||||
|
||||
public string ChooseNextLevel(IGame game) {
|
||||
if (QueuedMap != null) return QueuedMap;
|
||||
|
||||
try {
|
||||
@ -51,7 +62,7 @@ namespace MCGalaxy.Games {
|
||||
DoLevelVote(game);
|
||||
if (!game.Running) return null;
|
||||
|
||||
return NextLevel(r, maps, game);
|
||||
return NextLevel(r, maps);
|
||||
} catch (Exception ex) {
|
||||
Logger.LogError(ex);
|
||||
return null;
|
||||
@ -102,7 +113,7 @@ namespace MCGalaxy.Games {
|
||||
}
|
||||
}
|
||||
|
||||
string NextLevel(Random r, List<string> levels, ZSGame game) {
|
||||
string NextLevel(Random r, List<string> levels) {
|
||||
Player[] online = PlayerInfo.Online.Items;
|
||||
foreach (Player pl in online) pl.voted = false;
|
||||
|
||||
|
@ -101,9 +101,7 @@ namespace MCGalaxy.Games {
|
||||
if (!Running) { Status = ZombieGameStatus.LastRound; return; }
|
||||
|
||||
EndRound();
|
||||
if (Picker.RecentMaps.Count > 20)
|
||||
Picker.RecentMaps.RemoveAt(0);
|
||||
Picker.RecentMaps.Add(MapName);
|
||||
Picker.AddRecentMap(MapName);
|
||||
}
|
||||
|
||||
Player PickFirstZombie(Random random, List<Player> players) {
|
||||
|
@ -49,7 +49,7 @@ namespace MCGalaxy.Games {
|
||||
public ZombieGameStatus Status = ZombieGameStatus.NotStarted;
|
||||
|
||||
/// <summary> Gets whether zombie survival is currently running. </summary>
|
||||
public bool Running { get { return Status != ZombieGameStatus.NotStarted; } }
|
||||
public override bool Running { get { return Status != ZombieGameStatus.NotStarted; } }
|
||||
|
||||
/// <summary> Whether a round is currently in progress. </summary>
|
||||
public bool RoundInProgress = false;
|
||||
|
@ -198,7 +198,7 @@ namespace MCGalaxy.Games {
|
||||
Infected.Clear();
|
||||
|
||||
Bounties.Clear();
|
||||
Picker.RecentMaps.Clear();
|
||||
Picker.Clear();
|
||||
|
||||
foreach (Player pl in online) {
|
||||
pl.Game.Referee = false;
|
||||
|
Loading…
x
Reference in New Issue
Block a user