Revert #5642 / Reimplement the drafting of antags from round voters (#7872)

And then God said,

"Let there be light."
This commit is contained in:
Erki
2020-03-22 20:17:20 +02:00
committed by GitHub
parent 9132b771b2
commit 7293d3203a
3 changed files with 18 additions and 4 deletions

View File

@@ -129,6 +129,7 @@ var/datum/controller/subsystem/vote/SSvote
for(var/key in current_votes)
if(current_votes[key] == .)
round_voters += key // Keep track of who voted for the winning round.
if((mode == "gamemode" && . == "Extended") || SSticker.hide_mode == 0) // Announce Extended gamemode, but not other gamemodes
text += "<b>Vote Result: [.]</b>"
else
@@ -315,7 +316,7 @@ var/datum/controller/subsystem/vote/SSvote
if(href_list["open"])
OpenVotingUI(usr)
var/isstaff = usr.client.holder && (usr.client.holder.rights & (R_ADMIN|R_MOD))
switch(href_list["action"])
if("cancel")
if(isstaff)
@@ -376,14 +377,14 @@ var/datum/controller/subsystem/vote/SSvote
for(var/choice in choices)
VUEUI_SET_IFNOTSET(data["choices"][choice], deepCopyList(choices[choice]), ., data)
VUEUI_SET_CHECK(data["choices"][choice]["votes"], choices[choice]["votes"], ., data) // Only votes trigger data update
VUEUI_SET_CHECK(data["mode"], mode, ., data)
VUEUI_SET_CHECK(data["voted"], current_votes[user.ckey], ., data)
VUEUI_SET_CHECK(data["endtime"], started_time + config.vote_period, ., data)
VUEUI_SET_CHECK(data["allow_vote_restart"], config.allow_vote_restart, ., data)
VUEUI_SET_CHECK(data["allow_vote_mode"], config.allow_vote_mode, ., data)
VUEUI_SET_CHECK(data["allow_extra_antags"], (!antag_add_failed && config.allow_extra_antags), ., data)
if(!question)
VUEUI_SET_CHECK(data["question"], capitalize(mode), ., data)
else
@@ -391,7 +392,7 @@ var/datum/controller/subsystem/vote/SSvote
VUEUI_SET_CHECK(data["isstaff"], (user.client.holder && (user.client.holder.rights & (R_ADMIN|R_MOD))), ., data)
var/slevel = get_security_level()
VUEUI_SET_CHECK(data["is_code_red"], (slevel == "red" || slevel == "delta"), ., data)
/datum/controller/subsystem/vote/proc/OpenVotingUI(var/mob/user)

View File

@@ -595,6 +595,14 @@ var/global/list/additional_antag_types = list()
candidates += player.mind
players -= player
// If we don't have enough antags, draft people who voted for the round.
if(candidates.len < required_enemies)
for(var/mob/abstract/new_player/player in players)
if(player.ckey in SSvote.round_voters)
log_debug("[player.key] voted for this round, so we are drafting them.")
candidates += player.mind
players -= player
return candidates // Returns: The number of people who had the antagonist role set to yes, regardless of recomended_enemies, if that number is greater than required_enemies
// required_enemies if the number of people with that role set to yes is less than recomended_enemies,
// Less if there are not enough valid players in the game entirely to make required_enemies.