diff --git a/code/controllers/configuration/entries/respawns.dm b/code/controllers/configuration/entries/respawns.dm index d92f4ec394..69e48ed820 100644 --- a/code/controllers/configuration/entries/respawns.dm +++ b/code/controllers/configuration/entries/respawns.dm @@ -27,3 +27,21 @@ /// Observing penalizes for respawns, not just joining. /datum/config_entry/flag/respawn_penalty_includes_observe config_entry_value = FALSE + +/// Minutes from roundstart before someone can respawn +/datum/config_entry/flag/respawn_minimum_delay_roundstart + config_entry_value = 30.0 + integer = FALSE + +/// Gamemode config tags that are banned from respawning +/datum/config_entry/keyed_list/respawn_chaos_gamemodes + key_mode = KEY_MODE_TEXT + value_mode = VALUE_MODE_FLAG + +/datum/config_entry/keyed_list/respawn_chaos_gamemodes/ValidateListEntry(key_name, key_value) + . = ..() + return . && (key_name in config.modes) + +/datum/config_entry/keyed_list/respawn_chaos_gamemodes/preprocess_key(key) + . = ..() + return lowertext(key) diff --git a/code/modules/mob/dead/new_player/new_player.dm b/code/modules/mob/dead/new_player/new_player.dm index 7acf6ad32c..72ec3d06f6 100644 --- a/code/modules/mob/dead/new_player/new_player.dm +++ b/code/modules/mob/dead/new_player/new_player.dm @@ -294,7 +294,9 @@ ready = PLAYER_NOT_READY return FALSE - var/this_is_like_playing_right = alert(src,"Are you sure you wish to observe? You will not be able to play this round!","Player Setup","Yes","No") + var/mintime = max(CONFIG_GET(number/respawn_delay), (SSticker.round_start_time + (CONFIG_GET(number/respawn_minimum_delay_roundstart) * 600)) - world.time, 0) + + var/this_is_like_playing_right = alert(src,"Are you sure you wish to observe? You will not be able to respawn for [round(mintime / 600, 0.1)] minutes!!","Player Setup","Yes","No") if(QDELETED(src) || !src.client || this_is_like_playing_right != "Yes") ready = PLAYER_NOT_READY diff --git a/code/modules/mob/dead/observer/respawn.dm b/code/modules/mob/dead/observer/respawn.dm index a31fdd4bf4..d882e8d474 100644 --- a/code/modules/mob/dead/observer/respawn.dm +++ b/code/modules/mob/dead/observer/respawn.dm @@ -122,6 +122,16 @@ to_chat(src, "You cannot respawn as you have enabled DNR.") return + var/roundstart_timeleft = world.time - (SSticker.round_start_time + (CONFIG_GET(number/respawn_minimum_delay_roundstart) * 600)) + if(roundstart_timeleft > 0) + to_chat(src, "It's been too short of a time since the round started! Please wait [CEILING(roundstart_timeleft / 600, 0.1)] more minutes.") + return + + var/list/modes = CONFIG_GET(keyed_list/respawn_chaos_gamemodes) + if(SSticker.mode && banned_modes[lowertext(SSticker.mode.config_tag])) + to_chat(src, "The current mode tag, [SSticker.mode.config_tag], is not eligible for respawn.") + return + var/timeleft = time_left_to_respawn() if(timeleft) to_chat(src, "It's been too short of a time since you died/observed! Please wait [round(timeleft / 600, 0.1)] more minutes.") @@ -149,6 +159,7 @@ Remember to take heed of rules regarding round knowledge - notably, that ALL past lives are forgotten. \ Any character you join as has NO knowledge of round events unless specified otherwise by an admin.") + message_admins("[key_name_admin(src)] was respawned to lobby [penalize? "with" : "without"] restrictions.") log_game("[key_name(src)] was respawned to lobby [penalize? "with" : "without"] restrictions.") transfer_to_lobby() diff --git a/config/respawns.txt b/config/respawns.txt index 46a4bb0e07..337a691b07 100644 --- a/config/respawns.txt +++ b/config/respawns.txt @@ -18,3 +18,12 @@ ALLOW_NON_ASSISTANT_RESPAWN ## Observing is considered a respawn for the purposes of role lockouts. Defaults to disabled. When disabled, only RESPAWNING rather than returning from observe locks you out. # RESPAWN_PENALTY_INCLUDES_OBSERVE + +## Time in minutes from round start before respawn is enabled +RESPAWN_MINIMUM_DELAY_ROUNDSTART 30.0 + +## Gamemode (config tags!) banlist for respawn +RESPAWN_CHAOS_GAMEMODES WIZARD +RESPAWN_CHAOS_GAMEMODES NUCLEAR +RESPAWN_CHAOS_GAMEMODES CLONWOPS +RESPAWN_CHOAS_GAMEMODES REVOLUTION