diff --git a/code/controllers/admin.dm b/code/controllers/admin.dm index 834b5d2caa..6e87ce01db 100644 --- a/code/controllers/admin.dm +++ b/code/controllers/admin.dm @@ -81,7 +81,6 @@ ADMIN_VERB(debug_controller, R_DEBUG, "Debug Controller", "Debug the various per options["LEGACY: job_master"] = GLOB.job_master options["LEGACY: emergency_shuttle"] = GLOB.emergency_shuttle options["LEGACY: cameranet"] = GLOB.cameranet - options["LEGACY: transfer_controller"] = GLOB.transfer_controller var/pick = tgui_input_list(user, "Choose a controller to debug/view variables of.", "VV controller:", options) if(!pick) diff --git a/code/controllers/master_controller.dm b/code/controllers/master_controller.dm index 53b1ebe391..aa510f88c2 100644 --- a/code/controllers/master_controller.dm +++ b/code/controllers/master_controller.dm @@ -36,7 +36,6 @@ GLOBAL_DATUM(master_controller, /datum/controller/game_controller) //Set in worl // setupgenetics() Moved to SSatoms // SetupXenoarch() - Moved to SSxenoarch - GLOB.transfer_controller = new admin_notice(span_danger("Initializations complete."), R_DEBUG) // #if UNIT_TESTS diff --git a/code/controllers/autotransfer.dm b/code/controllers/subsystems/autotransfer.dm similarity index 64% rename from code/controllers/autotransfer.dm rename to code/controllers/subsystems/autotransfer.dm index ce642c5cde..0af45fb2aa 100644 --- a/code/controllers/autotransfer.dm +++ b/code/controllers/subsystems/autotransfer.dm @@ -1,37 +1,35 @@ -GLOBAL_DATUM(transfer_controller, /datum/controller/transfer_controller) +SUBSYSTEM_DEF(transfer) + name = "Transfer" + wait = 1 SECOND + runlevels = RUNLEVEL_GAME + init_stage = INITSTAGE_LAST + flags = SS_KEEP_TIMING -/datum/controller/transfer_controller - var/timerbuffer = 0 //buffer for time check - var/currenttick = 0 - var/shift_hard_end = 0 //VOREStation Edit - var/shift_last_vote = 0 //VOREStation Edit + VAR_PRIVATE/timerbuffer = 0 //buffer for time check + VAR_PRIVATE/currenttick = 0 + VAR_PRIVATE/shift_hard_end = 0 + VAR_PRIVATE/shift_last_vote = 0 -/datum/controller/transfer_controller/New() +/datum/controller/subsystem/transfer/Initialize() timerbuffer = CONFIG_GET(number/vote_autotransfer_initial) - shift_hard_end = CONFIG_GET(number/vote_autotransfer_initial) + (CONFIG_GET(number/vote_autotransfer_interval) * 2) //CHOMPStation Edit //Change this "1" to how many extend votes you want there to be. //Note: Fuck you whoever just slapped a number here instead of using the FUCKING CONFIG LIKE ALL THE OTHER NUMBERS HERE - shift_last_vote = shift_hard_end - CONFIG_GET(number/vote_autotransfer_interval) //VOREStation Edit - START_PROCESSING(SSprocessing, src) + shift_hard_end = CONFIG_GET(number/vote_autotransfer_initial) + (CONFIG_GET(number/vote_autotransfer_interval) * 2) //CHOMPStation Edit //Change this "1" to how many extend votes you want there to be. + shift_last_vote = shift_hard_end - CONFIG_GET(number/vote_autotransfer_interval) + return SS_INIT_SUCCESS -/datum/controller/transfer_controller/Destroy() - STOP_PROCESSING(SSprocessing, src) - . = ..() - -/datum/controller/transfer_controller/process() +/datum/controller/subsystem/transfer/fire(resumed) currenttick = currenttick + 1 - //VOREStation Edit START if (round_duration_in_ds >= shift_last_vote - 2 MINUTES) - shift_last_vote = 1000000000000 //Setting to a stupidly high number since it'll be not used again. //CHOMPEdit - to_chat(world, span_world(span_notice("Warning: This upcoming round-extend vote will be your last chance to vote for shift extension. Wrap up your scenes in the next 60 minutes if the round is extended."))) //CHOMPStation Edit + shift_last_vote = 1000000000000 //Setting to a stupidly high number since it'll be not used again. + to_chat(world, span_world(span_notice("Warning: This upcoming round-extend vote will be your last chance to vote for shift extension. Wrap up your scenes in the next 60 minutes if the round is extended."))) if (round_duration_in_ds >= shift_hard_end - 1 MINUTE) init_shift_change(null, 1) shift_hard_end = timerbuffer + CONFIG_GET(number/vote_autotransfer_interval) //If shuttle somehow gets recalled, let's force it to call again next time a vote would occur. timerbuffer = timerbuffer + CONFIG_GET(number/vote_autotransfer_interval) //Just to make sure a vote doesn't occur immediately afterwords. else if (round_duration_in_ds >= timerbuffer - 1 MINUTE) SSvote.start_vote(new /datum/vote/crew_transfer) - //VOREStation Edit END timerbuffer = timerbuffer + CONFIG_GET(number/vote_autotransfer_interval) -/datum/controller/transfer_controller/proc/modify_hard_end(client/user) +/datum/controller/subsystem/transfer/proc/modify_hard_end(client/user) var/new_shift_end = tgui_input_number(user, "Modify the shift end timer (Input in Minutes)", "Shift End", shift_hard_end / 600) if(!new_shift_end) @@ -42,3 +40,7 @@ GLOBAL_DATUM(transfer_controller, /datum/controller/transfer_controller) shift_hard_end = calculated_end shift_last_vote = calculated_end timerbuffer = calculated_end + +///Accessor proc for getting the shift hard end. +/datum/controller/subsystem/transfer/proc/get_hard_end() + return shift_hard_end diff --git a/code/game/jobs/job_controller.dm b/code/game/jobs/job_controller.dm index 51ff11ca51..5f7979d65a 100644 --- a/code/game/jobs/job_controller.dm +++ b/code/game/jobs/job_controller.dm @@ -73,7 +73,7 @@ GLOBAL_DATUM(job_master, /datum/controller/occupations) unassigned -= player job.current_positions++ //CHOMPadd START - if(job.camp_protection && round_duration_in_ds < GLOB.transfer_controller.shift_hard_end - 30 MINUTES) + if(job.camp_protection && round_duration_in_ds < SStransfer.get_hard_end() - 30 MINUTES) job.register_shift_key(player.client.ckey) //CHOMPadd END return 1 diff --git a/code/modules/admin/admin_verbs.dm b/code/modules/admin/admin_verbs.dm index f8ede55065..3c3da422ff 100644 --- a/code/modules/admin/admin_verbs.dm +++ b/code/modules/admin/admin_verbs.dm @@ -684,4 +684,4 @@ ADMIN_VERB(toggle_spawning_with_recolour, R_ADMIN|R_EVENT|R_FUN, "Toggle Simple/ to_chat(user, "You have [CONFIG_GET(flag/allow_simple_mob_recolor) ? "enabled" : "disabled"] newly spawned simple mobs to spawn with the recolour verb") ADMIN_VERB(modify_shift_end, (R_ADMIN|R_EVENT|R_SERVER), "Modify Shift End", "Modifies the hard shift end time.", ADMIN_CATEGORY_SERVER_GAME) - GLOB.transfer_controller.modify_hard_end(user) + SStransfer.modify_hard_end(user) diff --git a/vorestation.dme b/vorestation.dme index 07f769fe43..18d6168ad0 100644 --- a/vorestation.dme +++ b/vorestation.dme @@ -553,7 +553,6 @@ #include "code\ATMOSPHERICS\pipes\universal.dm" #include "code\ATMOSPHERICS\pipes\vent.dm" #include "code\controllers\admin.dm" -#include "code\controllers\autotransfer.dm" #include "code\controllers\controller.dm" #include "code\controllers\emergency_shuttle_controller.dm" #include "code\controllers\failsafe.dm" @@ -583,6 +582,7 @@ #include "code\controllers\subsystems\asset_loading.dm" #include "code\controllers\subsystems\assets.dm" #include "code\controllers\subsystems\atoms.dm" +#include "code\controllers\subsystems\autotransfer.dm" #include "code\controllers\subsystems\character_setup.dm" #include "code\controllers\subsystems\chat.dm" #include "code\controllers\subsystems\chemistry.dm"