From 905a338a9833ef00a215c5d7548e29bf0e2beecc Mon Sep 17 00:00:00 2001 From: skull132 Date: Sat, 18 Mar 2017 21:01:27 +0200 Subject: [PATCH] Implement new voting restrictions into config (#1919) As per the discussion. If NO_DEAD_VOTE is enabled, only new_player mobs and observers who went from the lobby to observing are barred from voting. Ref this discussion: https://forums.aurorastation.org/viewtopic.php?f=18&t=7866&start=10#p75880 --- code/controllers/voting.dm | 21 +++++++++++++++++++-- config/example/config.txt | 3 ++- html/changelogs/skul1l32-voting.yml | 6 ++++++ 3 files changed, 27 insertions(+), 3 deletions(-) create mode 100644 html/changelogs/skul1l32-voting.yml diff --git a/code/controllers/voting.dm b/code/controllers/voting.dm index 694f64e0f21..40fab2ed2bf 100644 --- a/code/controllers/voting.dm +++ b/code/controllers/voting.dm @@ -194,8 +194,15 @@ datum/controller/vote proc/submit_vote(var/ckey, var/vote) if(mode) - if(config.vote_no_dead && usr.stat == DEAD && !usr.client.holder) - return 0 + if(config.vote_no_dead && usr && !usr.client.holder) + if (isnewplayer(usr)) + usr << "You must be playing or have been playing to start a vote." + return 0 + else if (isobserver(usr)) + var/mob/dead/observer/O = usr + if (O.started_as_observer) + usr << "You must be playing or have been playing to start a vote." + return 0 if(vote && vote >= 1 && vote <= choices.len) if(current_votes[ckey]) choices[choices[current_votes[ckey]]]-- @@ -211,6 +218,16 @@ datum/controller/vote // Transfer votes are their own little special snowflake var/next_allowed_time = 0 if (vote_type == "crew_transfer") + if (config.vote_no_dead && !usr.client.holder) + if (isnewplayer(usr)) + usr << "You must be playing or have been playing to start a vote." + return 0 + else if (isobserver(usr)) + var/mob/dead/observer/O = usr + if (O.started_as_observer) + usr << "You must be playing or have been playing to start a vote." + return 0 + if (last_transfer_vote) next_allowed_time = (last_transfer_vote + config.vote_delay) else diff --git a/config/example/config.txt b/config/example/config.txt index 7f730bef569..6082e8703e9 100644 --- a/config/example/config.txt +++ b/config/example/config.txt @@ -162,7 +162,8 @@ VOTE_AUTOGAMEMODE_TIMELEFT 100 ## min delay (deciseconds) before a transfer vote can be called (default 120 minutes) TRANSFER_TIMEOUT 72000 -## prevents dead players from voting or starting votes +## Prevets lobby-sitters and ghosts who went straight from the lobby to observing from voting. +## Ghosts who died will still be able to vote. #NO_DEAD_VOTE ## players' votes default to "No vote" (otherwise, default to "No change") diff --git a/html/changelogs/skul1l32-voting.yml b/html/changelogs/skul1l32-voting.yml new file mode 100644 index 00000000000..9a058972aa0 --- /dev/null +++ b/html/changelogs/skul1l32-voting.yml @@ -0,0 +1,6 @@ +author: Skull132 + +delete-after: True + +changes: + - tweak: "Modified the voting limitation system to only prohibit voting for lobby sitters and ghosts who went straight from the lobby to observing."