diff --git a/code/modules/shuttle/mobile_port/variants/emergency/emergency.dm b/code/modules/shuttle/mobile_port/variants/emergency/emergency.dm index b162620cf48..da28a648367 100644 --- a/code/modules/shuttle/mobile_port/variants/emergency/emergency.dm +++ b/code/modules/shuttle/mobile_port/variants/emergency/emergency.dm @@ -234,7 +234,8 @@ color_override = "orange", ) INVOKE_ASYNC(SSticker, TYPE_PROC_REF(/datum/controller/subsystem/ticker, poll_hearts)) - INVOKE_ASYNC(SSvote, TYPE_PROC_REF(/datum/controller/subsystem/vote, initiate_vote), /datum/vote/map_vote, vote_initiator_name = "Map Rotation", forced = TRUE) + // INVOKE_ASYNC(SSvote, TYPE_PROC_REF(/datum/controller/subsystem/vote, initiate_vote), /datum/vote/map_vote, vote_initiator_name = "Map Rotation", forced = TRUE) // BUBBER EDIT CHANGE - Offset Map Vote + SSsecurity_level.offset_map_vote() if(!is_reserved_level(z)) CRASH("Emergency shuttle did not move to transit z-level!") diff --git a/modular_skyrat/modules/autotransfer/code/shuttle.dm b/modular_skyrat/modules/autotransfer/code/shuttle.dm index 632c18c977a..a53d381ee16 100644 --- a/modular_skyrat/modules/autotransfer/code/shuttle.dm +++ b/modular_skyrat/modules/autotransfer/code/shuttle.dm @@ -4,7 +4,6 @@ /datum/controller/subsystem/shuttle/proc/autoEnd() if(EMERGENCY_IDLE_OR_RECALLED) SSshuttle.emergency.request() - priority_announce("The shift has come to an end and the shuttle called. [SSsecurity_level.get_current_level_as_number() == SEC_LEVEL_RED ? "Red Alert state confirmed: Dispatching priority shuttle. " : "" ]It will arrive in [emergency.timeLeft(600)] minutes.", null, ANNOUNCER_SHUTTLECALLED, "Priority", color_override = "orange") log_game("Round end vote passed. Shuttle has been auto-called.") message_admins("Round end vote passed. Shuttle has been auto-called.") emergency_no_recall = TRUE diff --git a/modular_zubbers/code/controllers/subsystem/security_level.dm b/modular_zubbers/code/controllers/subsystem/security_level.dm new file mode 100644 index 00000000000..104532a0694 --- /dev/null +++ b/modular_zubbers/code/controllers/subsystem/security_level.dm @@ -0,0 +1,19 @@ +/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) diff --git a/modular_zubbers/code/modules/shuttle/emergency.dm b/modular_zubbers/code/modules/shuttle/emergency.dm index 94500ff2171..966c128b082 100644 --- a/modular_zubbers/code/modules/shuttle/emergency.dm +++ b/modular_zubbers/code/modules/shuttle/emergency.dm @@ -5,5 +5,4 @@ GLOBAL_VAR_INIT(roundend_mapvote_called, FALSE) if(mode == SHUTTLE_CALL && !SSshuttle.canRecall() && !GLOB.roundend_mapvote_called) var/datum/vote/current_vote = SSvote.current_vote if(!istype(current_vote, /datum/vote/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) //Do a map vote if we're at the point of no return. - GLOB.roundend_mapvote_called = TRUE + SSsecurity_level.offset_map_vote() diff --git a/tgstation.dme b/tgstation.dme index 4c20df8d4f1..be6bb939998 100644 --- a/tgstation.dme +++ b/tgstation.dme @@ -8788,6 +8788,7 @@ #include "modular_zubbers\code\controllers\subsystem\map_vote.dm" #include "modular_zubbers\code\controllers\subsystem\mapping.dm" #include "modular_zubbers\code\controllers\subsystem\research.dm" +#include "modular_zubbers\code\controllers\subsystem\security_level.dm" #include "modular_zubbers\code\controllers\subsystem\vote.dm" #include "modular_zubbers\code\controllers\subsystem\processing\nanites.dm" #include "modular_zubbers\code\controllers\subsystem\processing\sol_subsystem.dm"