From f6004e084e239b89b62a97cdae10f7f16fa77d9e Mon Sep 17 00:00:00 2001 From: Waterpig <49160555+Majkl-J@users.noreply.github.com> Date: Sun, 9 Jun 2024 20:56:31 +0200 Subject: [PATCH] You now need to spend 30 minutes in a round to be able to vote on transfer (#1579) ## About The Pull Request You need to spend 30 minutes in game, living, and not afk, to be able to vote on a transfer. Pros: - Ghostroles get to vote again after spending enough time in a round - Leaving midround, or getting RRd still allows you to have a vote Cons: - You have to actually play the game for 30 minutes (Impossible) ## Why It's Good For The Game It gives our beloved ghost roles their vote back, and also still keeps ghosts from having a say in the game after not playing for the whole round. ## Proof Of Testing I bashed two clients together on a test server. It is working ## Changelog :cl: qol: Makes the vote requirements code not terrible by allowing anyone with some effect on the round to use it /:cl: --------- Co-authored-by: projectkepler-RU <99981766+projectkepler-ru@users.noreply.github.com> --- code/modules/jobs/job_exp.dm | 1 + modular_zubbers/modules/voting/_votes.dm | 17 +++++++--------- .../modules/voting/living_timer.dm | 6 ++++++ modular_zubbers/modules/voting/spawners.dm | 20 ------------------- .../modules/voting/vote_overrides.dm | 3 +++ tgstation.dme | 2 +- 6 files changed, 18 insertions(+), 31 deletions(-) create mode 100644 modular_zubbers/modules/voting/living_timer.dm delete mode 100644 modular_zubbers/modules/voting/spawners.dm diff --git a/code/modules/jobs/job_exp.dm b/code/modules/jobs/job_exp.dm index 2344b54696d4e..8bdb652e01da9 100644 --- a/code/modules/jobs/job_exp.dm +++ b/code/modules/jobs/job_exp.dm @@ -75,6 +75,7 @@ GLOBAL_PROTECT(exp_to_update) if(L.is_afk()) continue L.update_exp_list(mins) + L.update_living_minutes(mins) // BUBBER EDIT BEGIN - Voting timers /datum/controller/subsystem/blackbox/proc/update_exp_db() set waitfor = FALSE diff --git a/modular_zubbers/modules/voting/_votes.dm b/modular_zubbers/modules/voting/_votes.dm index 227a94eee769d..2807c952c429a 100644 --- a/modular_zubbers/modules/voting/_votes.dm +++ b/modular_zubbers/modules/voting/_votes.dm @@ -1,25 +1,22 @@ /datum/vote - // Specifies if ghosts without linked bodies or ghostroles are allowed to vote + // Specifies if people who haven't spent INGAME_TIME_NEEDED minutes in the round are allowed to vote var/allow_ghosts = TRUE +#define INGAME_TIME_NEEDED 30 // Checks if a mob can partake in voting. Feel free to add overrides when adding your own votes! // This is called directly from /datum/controller/subsystem/vote so some nullchecks are excluded as they are included before this is called /datum/vote/proc/can_mob_vote(mob/voter) if(SSticker.HasRoundStarted() && !allow_ghosts) - // Handle the lobby people first - if(istype(voter, /mob/dead/new_player)) - return FALSE - // Check if there is a mind. This should only be a case on ghosts, but also doubles down as a nullcheck for the next check - // We also check the is_offstation_ghost because it stays with your mind even after dying. No cheating this! - else if(!voter.mind || QDELETED(voter.mind.current) || voter.mind.is_offstation_ghost) - return FALSE - // Check if the person is living. If they are, check if they're on the centcom level - else if(istype(voter, /mob/living) && (is_centcom_level(voter.z))) + if(GLOB.client_minutes_in_round[voter.client.ckey] >= INGAME_TIME_NEEDED) + return TRUE + else return FALSE return TRUE +#undef INGAME_TIME_NEEDED + /datum/vote/transfer_vote allow_ghosts = FALSE diff --git a/modular_zubbers/modules/voting/living_timer.dm b/modular_zubbers/modules/voting/living_timer.dm new file mode 100644 index 0000000000000..97fc4da531517 --- /dev/null +++ b/modular_zubbers/modules/voting/living_timer.dm @@ -0,0 +1,6 @@ +GLOBAL_LIST_EMPTY(client_minutes_in_round) + +/client/proc/update_living_minutes(mins) + if(!isliving(mob)) + return + GLOB.client_minutes_in_round[ckey] += mins diff --git a/modular_zubbers/modules/voting/spawners.dm b/modular_zubbers/modules/voting/spawners.dm deleted file mode 100644 index 54cfa4af3893c..0000000000000 --- a/modular_zubbers/modules/voting/spawners.dm +++ /dev/null @@ -1,20 +0,0 @@ -/datum/mind - var/is_offstation_ghost = FALSE - -/obj/effect/mob_spawn/ghost_role/Initialize(mapload) - . = ..() - RegisterSignal(src, COMSIG_GHOSTROLE_SPAWNED, PROC_REF(on_mob_created)) - -/obj/effect/mob_spawn/ghost_role/Destroy() - . = ..() - UnregisterSignal(src, COMSIG_GHOSTROLE_SPAWNED) - -/obj/effect/mob_spawn/ghost_role/proc/on_mob_created(datum/source, mob/living/ghostspawn) - SIGNAL_HANDLER - var/mob_on_station = is_station_level(ghostspawn.z) - if(!mob_on_station && istype(ghostspawn)) - if(!ghostspawn.mind) - return - // Pirates can spawn offstation but are also antags and should be allowed a vote - if(isnull(ghostspawn.mind.antag_datums)) - ghostspawn.mind.is_offstation_ghost = TRUE diff --git a/modular_zubbers/modules/voting/vote_overrides.dm b/modular_zubbers/modules/voting/vote_overrides.dm index 5003fd0cf6e64..fb0b4e369f8a8 100644 --- a/modular_zubbers/modules/voting/vote_overrides.dm +++ b/modular_zubbers/modules/voting/vote_overrides.dm @@ -5,3 +5,6 @@ /datum/vote/transfer_vote winner_method = VOTE_WINNER_METHOD_SIMPLE + +/datum/vote/transfer_vote + display_statistics = FALSE diff --git a/tgstation.dme b/tgstation.dme index 20864380c760c..85574fc18d5ab 100644 --- a/tgstation.dme +++ b/tgstation.dme @@ -8973,6 +8973,6 @@ #include "modular_zubbers\modules\vetted\vetted.dm" #include "modular_zubbers\modules\vetted\overrides\erp_preferences.dm" #include "modular_zubbers\modules\voting\_votes.dm" -#include "modular_zubbers\modules\voting\spawners.dm" +#include "modular_zubbers\modules\voting\living_timer.dm" #include "modular_zubbers\modules\voting\vote_overrides.dm" // END_INCLUDE