From 9005d8db715df212f1fcf060ebd14d8bc617235b Mon Sep 17 00:00:00 2001 From: Kyle Spier-Swenson Date: Tue, 6 Sep 2016 12:51:33 -0700 Subject: [PATCH] When default vote is enabled, afk players will not have their vote changed to the default. (#20323) ie: no afks counting as continue playing during restart votes. --- code/controllers/subsystem/voting.dm | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/code/controllers/subsystem/voting.dm b/code/controllers/subsystem/voting.dm index 164de5d5521..d939e23fba0 100644 --- a/code/controllers/subsystem/voting.dm +++ b/code/controllers/subsystem/voting.dm @@ -58,15 +58,20 @@ var/datum/subsystem/vote/SSvote greatest_votes = votes //default-vote for everyone who didn't vote if(!config.vote_no_default && choices.len) - var/non_voters = (clients.len - total_votes) - if(non_voters > 0) + var/list/non_voters = directory.Copy() + non_voters -= voted + for (var/non_voter_ckey in non_voters) + var/client/C = non_voters[non_voter_ckey] + if (!C || C.is_afk()) + non_voters -= non_voter_ckey + if(non_voters.len > 0) if(mode == "restart") - choices["Continue Playing"] += non_voters + choices["Continue Playing"] += non_voters.len if(choices["Continue Playing"] >= greatest_votes) greatest_votes = choices["Continue Playing"] else if(mode == "gamemode") if(master_mode in choices) - choices[master_mode] += non_voters + choices[master_mode] += non_voters.len if(choices[master_mode] >= greatest_votes) greatest_votes = choices[master_mode] //get all options with that many votes and return them in a list