make countdown code a bit nicer

This commit is contained in:
UnknownShadow200 2018-07-16 18:29:25 +10:00
parent 0a8331f545
commit 992635d24b
2 changed files with 9 additions and 11 deletions

View File

@ -80,14 +80,12 @@ namespace MCGalaxy.Games {
return pl.ColoredName + suffix;
}
public override void Start(Player p, string map, int rounds) {
map = "countdown";
if (!LevelInfo.MapExists(map)) {
p.Message("Countdown level not found, generating..");
GenerateMap(p, 32, 32, 32);
}
base.Start(p, map, rounds);
protected override string GetStartMap(Player p, string forcedMap) {
if (!LevelInfo.MapExists("countdown")) {
p.Message("Countdown level not found, generating..");
GenerateMap(p, 32, 32, 32);
}
return "countdown";
}
protected override void StartGame() {

View File

@ -40,7 +40,7 @@ namespace MCGalaxy.Games {
protected abstract void StartGame();
public virtual void Start(Player p, string map, int rounds) {
map = GetStartMap(this, map);
map = GetStartMap(p, map);
if (map == null) {
p.Message("No maps have been setup for {0} yet", GameName); return;
}
@ -78,9 +78,9 @@ namespace MCGalaxy.Games {
}
}
protected virtual string GetStartMap(RoundsGame game, string forcedMap) {
protected virtual string GetStartMap(Player p, string forcedMap) {
if (forcedMap.Length > 0) return forcedMap;
List<string> maps = Picker.GetCandidateMaps(game);
List<string> maps = Picker.GetCandidateMaps(this);
if (maps == null || maps.Count == 0) return null;
return LevelPicker.GetRandomMap(new Random(), maps);