From fa67555dbb26447bb978278819042d3085e58bc2 Mon Sep 17 00:00:00 2001 From: Incoming Date: Wed, 29 Apr 2015 13:11:57 -0400 Subject: [PATCH] Adds sanity checking for configuration settings (or lack there of) that create situations where a round would end immediately because no antags had ever existed. This closes a hole where server owners could experience highly interuptive roundtypes like non-continous extended because they didn't keep their config files up to date. --- code/game/gamemodes/game_mode.dm | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/code/game/gamemodes/game_mode.dm b/code/game/gamemodes/game_mode.dm index 738c4852782..ad807c92d60 100644 --- a/code/game/gamemodes/game_mode.dm +++ b/code/game/gamemodes/game_mode.dm @@ -34,6 +34,7 @@ var/list/datum/game_mode/replacementmode = null var/round_converted = 0 //0: round not converted, 1: round going to convert, 2: round converted var/reroll_friendly //During mode conversion only these are in the running + var/continuous_sanity_checked //Catches some cases where config options could be used to suggest that modes without antagonists should end when all antagonists die var/enemy_minimum_age = 7 //How many days must players have been playing before they can play this antagonist var/const/waittime_l = 600 @@ -174,6 +175,20 @@ if(SSshuttle.emergency.mode >= SHUTTLE_ENDGAME || station_was_nuked) return 1 if(!round_converted && (!config.continuous[config_tag] || (config.continuous[config_tag] && config.midround_antag[config_tag]))) //Non-continuous or continous with replacement antags + if(!continuous_sanity_checked) //make sure we have antags to be checking in the first place + for(var/mob/living/Player in mob_list) + if(Player.mind) + if(Player.mind.special_role) + continuous_sanity_checked = 1 + if(!continuous_sanity_checked) + message_admins("The roundtype ([config_tag]) is reporting that it should end because no antagonists exist. This is PROBABLY a configuration error.") + message_admins("Please alert a server owner to check the game_options.txt to be sure that it is up to date with all toggles relating to CONTINUOUS and MIDROUND_ANTAG.") + message_admins("If after checking the settings it doesn't appear to be a configuration problem, create an issue report that [config_tag] isn't reporting its antagonists correctly.") + config.continuous[config_tag] = 1 + config.midround_antag[config_tag] = 0 + return 0 + + if(living_antag_player && living_antag_player.mind && living_antag_player.stat != DEAD && !isnewplayer(living_antag_player) &&!isbrain(living_antag_player)) return 0 //A resource saver: once we find someone who has to die for all antags to be dead, we can just keep checking them, cycling over everyone only when we lose our mark.