From 67e19268df22ab45e4fa2100ac7b427994b22347 Mon Sep 17 00:00:00 2001 From: Toast Date: Sun, 24 Nov 2019 04:53:05 -0500 Subject: [PATCH 1/2] Crew Transferred --- .../configuration/entries/general.dm | 10 +++++++ code/controllers/subsystem/autotransfer.dm | 17 ++++++++++++ code/controllers/subsystem/ticker.dm | 2 -- code/controllers/subsystem/vote.dm | 27 ++++++++++++++++++- config/config.txt | 6 +++++ tgstation.dme | 3 ++- 6 files changed, 61 insertions(+), 4 deletions(-) create mode 100644 code/controllers/subsystem/autotransfer.dm diff --git a/code/controllers/configuration/entries/general.dm b/code/controllers/configuration/entries/general.dm index 1f6e4623..31e3333a 100644 --- a/code/controllers/configuration/entries/general.dm +++ b/code/controllers/configuration/entries/general.dm @@ -76,6 +76,16 @@ config_entry_value = 600 min_val = 0 +/datum/config_entry/number/vote_autotransfer_initial //length of time before the first autotransfer vote is called (deciseconds, default 2 hours) + config_entry_value = 72000 + integer = FALSE + min_val = 0 + +/datum/config_entry/number/vote_autotransfer_interval //length of time to wait before subsequent autotransfer votes (deciseconds, default 30 minutes) + config_entry_value = 18000 + integer = FALSE + min_val = 0 + /datum/config_entry/flag/default_no_vote // vote does not default to nochange/norestart /datum/config_entry/flag/no_dead_vote // dead people can't vote diff --git a/code/controllers/subsystem/autotransfer.dm b/code/controllers/subsystem/autotransfer.dm new file mode 100644 index 00000000..d6ae7140 --- /dev/null +++ b/code/controllers/subsystem/autotransfer.dm @@ -0,0 +1,17 @@ +SUBSYSTEM_DEF(autotransfer) + name = "Autotransfer Vote" + flags = SS_KEEP_TIMING | SS_BACKGROUND + wait = 1 MINUTES + + var/starttime + var/targettime + +/datum/controller/subsystem/autotransfer/Initialize(timeofday) + starttime = world.time + targettime = starttime + CONFIG_GET(number/vote_autotransfer_initial) + return ..() + +/datum/controller/subsystem/autotransfer/fire() + if (world.time > targettime) + SSvote.initiate_vote("transfer",null) //TODO figure out how to not use null as the user + targettime = targettime + CONFIG_GET(number/vote_autotransfer_interval) \ No newline at end of file diff --git a/code/controllers/subsystem/ticker.dm b/code/controllers/subsystem/ticker.dm index f2469e8f..dffb0439 100644 --- a/code/controllers/subsystem/ticker.dm +++ b/code/controllers/subsystem/ticker.dm @@ -205,8 +205,6 @@ SUBSYSTEM_DEF(ticker) mode.process(wait * 0.1) check_queue() check_maprotate() - scripture_states = scripture_unlock_alert(scripture_states) - SSshuttle.autoEnd() if(!roundend_check_paused && mode.check_finished(force_ending) || force_ending) current_state = GAME_STATE_FINISHED diff --git a/code/controllers/subsystem/vote.dm b/code/controllers/subsystem/vote.dm index 79bc9dbe..72858e06 100644 --- a/code/controllers/subsystem/vote.dm +++ b/code/controllers/subsystem/vote.dm @@ -76,6 +76,21 @@ SUBSYSTEM_DEF(vote) choices[GLOB.master_mode] += non_voters.len if(choices[GLOB.master_mode] >= greatest_votes) greatest_votes = choices[GLOB.master_mode] + else if(mode == "transfer") // austation begin -- Crew autotransfer vote + var/factor = 1 + switch(world.time / (1 MINUTES )) + if(0 to 60) + factor = 0.5 + if(61 to 120) + factor = 0.8 + if(121 to 240) + factor = 1 + if(241 to 300) + factor = 1.2 + else + factor = 1.4 + choices["Initiate Crew Transfer"] += round(non_voters.len * factor) // austation end + //get all options with that many votes and return them in a list . = list() if(greatest_votes) @@ -146,6 +161,13 @@ SUBSYSTEM_DEF(vote) restart = 1 else GLOB.master_mode = . + if("transfer") // austation begin -- Crew autotransfer vote + if(. == "Initiate Crew Transfer") + //TODO find a cleaner way to do this + SSshuttle.requestEvac(null,"Crew transfer requested.") + var/obj/machinery/computer/communications/C = locate() in GLOB.machines + if(C) + C.post_status("shuttle") // austation end if("map") var/datum/map_config/VM = config.maplist[.] message_admins("The map has been voted for and will change to: [VM.map_name]") @@ -200,6 +222,7 @@ SUBSYSTEM_DEF(vote) to_chat(usr, "A vote was initiated recently, you must wait [DisplayTimeText(next_allowed_time-world.time)] before a new vote can be started!") return 0 + SEND_SOUND(world, sound('sound/misc/notice2.ogg')) reset() obfuscated = hideresults //CIT CHANGE - adds obfuscated votes switch(vote_type) @@ -207,6 +230,8 @@ SUBSYSTEM_DEF(vote) choices.Add("Restart Round","Continue Playing") if("gamemode") choices.Add(config.votable_modes) + if("transfer") // austation begin -- Crew autotranfer vote + choices.Add("Initiate Crew Transfer","Continue Playing") // austation end if("map") choices.Add(config.maplist) for(var/i in choices)//this is necessary because otherwise we'll end up with a bunch of /datum/map_config's as the default vote value instead of 0 as intended @@ -225,7 +250,7 @@ SUBSYSTEM_DEF(vote) else return 0 mode = vote_type - initiator = initiator_key + initiator = initiator_key ? initiator_key : "the Server" // austation -- Crew autotransfer vote started_time = world.time var/text = "[capitalize(mode)] vote started by [initiator]." if(mode == "custom") diff --git a/config/config.txt b/config/config.txt index 5dda144c..5503d597 100644 --- a/config/config.txt +++ b/config/config.txt @@ -176,6 +176,12 @@ VOTE_DELAY 6000 ## time period (deciseconds) which voting session will last (default 1 minute) VOTE_PERIOD 600 +## autovote initial delay (deciseconds) before first automatic transfer vote call (default 120 minutes) +VOTE_AUTOTRANSFER_INITIAL 72000 + +##autovote delay (deciseconds) before sequential automatic transfer votes are called (default 30 minutes) +VOTE_AUTOTRANSFER_INTERVAL 18000 + ## prevents dead players from voting or starting votes # NO_DEAD_VOTE diff --git a/tgstation.dme b/tgstation.dme index 1679844e..5b2643b7 100644 --- a/tgstation.dme +++ b/tgstation.dme @@ -229,6 +229,7 @@ #include "code\controllers\subsystem\assets.dm" #include "code\controllers\subsystem\atoms.dm" #include "code\controllers\subsystem\augury.dm" +#include "code\controllers\subsystem\autotransfer.dm" #include "code\controllers\subsystem\blackbox.dm" #include "code\controllers\subsystem\communications.dm" #include "code\controllers\subsystem\dbcore.dm" @@ -2877,7 +2878,7 @@ #include "modular_citadel\code\_onclick\hud\stamina.dm" #include "modular_citadel\code\controllers\configuration\entries\general.dm" #include "modular_citadel\code\controllers\subsystem\job.dm" -#include "modular_citadel\code\controllers\subsystem\shuttle.dm" +//#include "modular_citadel\code\controllers\subsystem\shuttle.dm" #include "modular_citadel\code\datums\components\material_container.dm" #include "modular_citadel\code\datums\components\phantomthief.dm" #include "modular_citadel\code\datums\components\souldeath.dm" From f784e6b7866707103b06b12f5ce40597924a4502 Mon Sep 17 00:00:00 2001 From: Toast Date: Sat, 30 Nov 2019 17:19:36 -0500 Subject: [PATCH 2/2] IT IS ALIVE --- code/controllers/subsystem/vote.dm | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/code/controllers/subsystem/vote.dm b/code/controllers/subsystem/vote.dm index 72858e06..f5c91f14 100644 --- a/code/controllers/subsystem/vote.dm +++ b/code/controllers/subsystem/vote.dm @@ -161,6 +161,12 @@ SUBSYSTEM_DEF(vote) restart = 1 else GLOB.master_mode = . + if("map") + var/datum/map_config/VM = config.maplist[.] + message_admins("The map has been voted for and will change to: [VM.map_name]") + log_admin("The map has been voted for and will change to: [VM.map_name]") + if(SSmapping.changemap(config.maplist[.])) + to_chat(world, "The map vote has chosen [VM.map_name] for next round!") if("transfer") // austation begin -- Crew autotransfer vote if(. == "Initiate Crew Transfer") //TODO find a cleaner way to do this @@ -168,12 +174,6 @@ SUBSYSTEM_DEF(vote) var/obj/machinery/computer/communications/C = locate() in GLOB.machines if(C) C.post_status("shuttle") // austation end - if("map") - var/datum/map_config/VM = config.maplist[.] - message_admins("The map has been voted for and will change to: [VM.map_name]") - log_admin("The map has been voted for and will change to: [VM.map_name]") - if(SSmapping.changemap(config.maplist[.])) - to_chat(world, "The map vote has chosen [VM.map_name] for next round!") if(restart) var/active_admins = 0 for(var/client/C in GLOB.admins) @@ -230,12 +230,12 @@ SUBSYSTEM_DEF(vote) choices.Add("Restart Round","Continue Playing") if("gamemode") choices.Add(config.votable_modes) - if("transfer") // austation begin -- Crew autotranfer vote - choices.Add("Initiate Crew Transfer","Continue Playing") // austation end if("map") choices.Add(config.maplist) for(var/i in choices)//this is necessary because otherwise we'll end up with a bunch of /datum/map_config's as the default vote value instead of 0 as intended choices[i] = 0 + if("transfer") // austation begin -- Crew autotranfer vote + choices.Add("Initiate Crew Transfer","Continue Playing") // austation end if("roundtype") //CIT CHANGE - adds the roundstart secret/extended vote choices.Add("secret", "extended") if("custom")