diff --git a/code/game/antagonist/antagonist.dm b/code/game/antagonist/antagonist.dm index d91242ea8b..9c3a9476ac 100644 --- a/code/game/antagonist/antagonist.dm +++ b/code/game/antagonist/antagonist.dm @@ -99,19 +99,23 @@ // Prune restricted status. Broke it up for readability. // Note that this is done before jobs are handed out. - for(var/datum/mind/player in ticker.mode.get_players_for_role(role_type, id)) + candidates = ticker.mode.get_players_for_role(role_type, id, ghosts_only) + for(var/datum/mind/player in candidates) if(ghosts_only && !istype(player.current, /mob/observer/dead)) - log_debug("[key_name(player)] is not eligible to become a [role_text]: Only ghosts may join as this role!") + candidates -= player + log_debug("[key_name(player)] is not eligible to become a [role_text]: Only ghosts may join as this role! They have been removed from the draft.") else if(player.special_role) - log_debug("[key_name(player)] is not eligible to become a [role_text]: They already have a special role ([player.special_role])!") + candidates -= player + log_debug("[key_name(player)] is not eligible to become a [role_text]: They already have a special role ([player.special_role])! They have been removed from the draft.") else if (player in pending_antagonists) - log_debug("[key_name(player)] is not eligible to become a [role_text]: They have already been selected for this role!") + candidates -= player + log_debug("[key_name(player)] is not eligible to become a [role_text]: They have already been selected for this role! They have been removed from the draft.") else if(!can_become_antag(player)) - log_debug("[key_name(player)] is not eligible to become a [role_text]: They are blacklisted for this role!") + candidates -= player + log_debug("[key_name(player)] is not eligible to become a [role_text]: They are blacklisted for this role! They have been removed from the draft.") else if(player_is_antag(player)) - log_debug("[key_name(player)] is not eligible to become a [role_text]: They are already an antagonist!") - else - candidates += player + candidates -= player + log_debug("[key_name(player)] is not eligible to become a [role_text]: They are already an antagonist! They have been removed from the draft.") return candidates diff --git a/code/game/gamemodes/game_mode.dm b/code/game/gamemodes/game_mode.dm index 2aa1d2b024..60d968bba0 100644 --- a/code/game/gamemodes/game_mode.dm +++ b/code/game/gamemodes/game_mode.dm @@ -372,7 +372,7 @@ var/global/list/additional_antag_types = list() /datum/game_mode/proc/check_win() //universal trigger to be called at mob death, nuke explosion, etc. To be called from everywhere. return 0 -/datum/game_mode/proc/get_players_for_role(var/role, var/antag_id) +/datum/game_mode/proc/get_players_for_role(var/role, var/antag_id, var/ghosts_only) var/list/players = list() var/list/candidates = list() @@ -387,6 +387,8 @@ var/global/list/additional_antag_types = list() continue if(istype(player, /mob/new_player)) continue + if(istype(player, /mob/observer/dead) && !ghosts_only) + continue if(!role || (player.client.prefs.be_special & role)) log_debug("[player.key] had [antag_id] enabled, so we are drafting them.") candidates |= player.mind