Files
Bubberstation/modular_zubbers/code/controllers/subsystem/security_level.dm
LT3 aa4901b571 Map vote is called automatically on blob/nukies/etc. round end (#3452)
## About The Pull Request

Triggers the automatic map vote when the round is about to end due to a
station threat, if it hasn't happened.

## Why It's Good For The Game

Saves it delaying the next round if no admin catches it in time, causing
a delay as the vote and another restart needs to occur.

## Changelog

🆑 LT3
admin: Map vote is automatically triggered near the conclusion of
station ending threats
fix: Only a single announcement is sent when the shuttle is called,
fixing the overlapping sounds
/🆑
2025-04-07 15:11:59 -07:00

20 lines
981 B
Plaintext

/datum/controller/subsystem/security_level/set_level(new_level, announce = TRUE)
. = ..()
new_level = istext(new_level) ? new_level : number_level_to_text(new_level)
var/datum/security_level/selected_level = available_levels[new_level]
if(selected_level.number_level >= SEC_LEVEL_DELTA)
offset_map_vote()
/// Calls the map vote with a time offset, to account for announcements and VOX playback, etc.
/datum/controller/subsystem/security_level/proc/offset_map_vote(offset = 7 SECONDS)
if(GLOB.roundend_mapvote_called)
return
GLOB.roundend_mapvote_called = TRUE
if(!SSmap_vote.next_map_config)
addtimer(CALLBACK(src, PROC_REF(async_map_vote)), offset)
/// Calls a map vote only if there has not yet been an automatically triggered map vote.
/datum/controller/subsystem/security_level/proc/async_map_vote()
INVOKE_ASYNC(SSvote, TYPE_PROC_REF(/datum/controller/subsystem/vote, initiate_vote), /datum/vote/map_vote, vote_initiator_name = "Map Rotation", forced = TRUE)