Skip to content

Commit

Permalink
You now need to spend 30 minutes in a round to be able to vote on tra…
Browse files Browse the repository at this point in the history
…nsfer (Bubberstation#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 <[email protected]>
  • Loading branch information
Majkl-J and projectkepler-ru authored Jun 9, 2024
1 parent 8aa2bac commit f6004e0
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 31 deletions.
1 change: 1 addition & 0 deletions code/modules/jobs/job_exp.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
17 changes: 7 additions & 10 deletions modular_zubbers/modules/voting/_votes.dm
Original file line number Diff line number Diff line change
@@ -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
6 changes: 6 additions & 0 deletions modular_zubbers/modules/voting/living_timer.dm
Original file line number Diff line number Diff line change
@@ -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
20 changes: 0 additions & 20 deletions modular_zubbers/modules/voting/spawners.dm

This file was deleted.

3 changes: 3 additions & 0 deletions modular_zubbers/modules/voting/vote_overrides.dm
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,6 @@

/datum/vote/transfer_vote
winner_method = VOTE_WINNER_METHOD_SIMPLE

/datum/vote/transfer_vote
display_statistics = FALSE
2 changes: 1 addition & 1 deletion tgstation.dme
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit f6004e0

Please sign in to comment.