From 7b43c0d991be2a91d53fe3b6b342e94982a2fc4d Mon Sep 17 00:00:00 2001 From: mikomyazaki <47489928+mikomyazaki@users.noreply.github.com> Date: Sun, 22 Nov 2020 09:56:31 +0000 Subject: [PATCH] Removes a pick() that occurred after the antag candidate lists were carefully ordered. (#10619) --- code/game/antagonist/antagonist.dm | 4 +- code/game/gamemodes/game_mode.dm | 1 + html/changelogs/dont_pick_after_sorting.yml | 41 +++++++++++++++++++++ 3 files changed, 44 insertions(+), 2 deletions(-) create mode 100644 html/changelogs/dont_pick_after_sorting.yml diff --git a/code/game/antagonist/antagonist.dm b/code/game/antagonist/antagonist.dm index 736a6a781c3..2251e980f90 100644 --- a/code/game/antagonist/antagonist.dm +++ b/code/game/antagonist/antagonist.dm @@ -172,9 +172,9 @@ if(!candidates.len) return 0 - //Grab candidates randomly until we have enough. + //Grab candidates until we have enough. while(candidates.len && pending_antagonists.len < spawn_target) - var/datum/mind/player = pick(candidates) + var/datum/mind/player = candidates[1] candidates -= player draft_antagonist(player) diff --git a/code/game/gamemodes/game_mode.dm b/code/game/gamemodes/game_mode.dm index 8af04c16a67..cfe38b12444 100644 --- a/code/game/gamemodes/game_mode.dm +++ b/code/game/gamemodes/game_mode.dm @@ -252,6 +252,7 @@ var/global/list/additional_antag_types = list() for(var/candidate in all_candidates) valid_templates_per_candidate[candidate]++ + valid_templates_per_candidate = shuffle(valid_templates_per_candidate) // shuffle before sorting so that candidates with the same number of templates will be in random order sortTim(valid_templates_per_candidate, /proc/cmp_numeric_asc, TRUE) for(var/datum/antagonist/antag in antag_templates) diff --git a/html/changelogs/dont_pick_after_sorting.yml b/html/changelogs/dont_pick_after_sorting.yml new file mode 100644 index 00000000000..45a5fe3e52e --- /dev/null +++ b/html/changelogs/dont_pick_after_sorting.yml @@ -0,0 +1,41 @@ +################################ +# Example Changelog File +# +# Note: This file, and files beginning with ".", and files that don't end in ".yml" will not be read. If you change this file, you will look really dumb. +# +# Your changelog will be merged with a master changelog. (New stuff added only, and only on the date entry for the day it was merged.) +# When it is, any changes listed below will disappear. +# +# Valid Prefixes: +# bugfix +# wip (For works in progress) +# tweak +# soundadd +# sounddel +# rscadd (general adding of nice things) +# rscdel (general deleting of nice things) +# imageadd +# imagedel +# maptweak +# spellcheck (typo fixes) +# experiment +# balance +# admin +# backend +# security +# refactor +################################# + +# Your name. +author: mikomyazaki + +# Optional: Remove this file after generating master changelog. Useful for PR changelogs that won't get used again. +delete-after: True + +# Any changes you've made. See valid prefix list above. +# INDENT WITH TWO SPACES. NOT TABS. SPACES. +# SCREW THIS UP AND IT WON'T WORK. +# Also, all entries are changed into a single [] after a master changelog generation. Just remove the brackets when you add new entries. +# Please surround your changes in double quotes ("), as certain characters otherwise screws up compiling. The quotes will not show up in the changelog. +changes: + - tweak: "Improved multi-mode antagonist selection logic." \ No newline at end of file