From 41ce7bf46c679a076b25c30b5f2e7d467ec90609 Mon Sep 17 00:00:00 2001 From: Leland Kemble <70413276+lelandkemble@users.noreply.github.com> Date: Mon, 13 Apr 2026 13:37:10 -0400 Subject: [PATCH] fixes second-choice headrevs having their preferences ignored (#95751) ## About The Pull Request Second-choice headrevs after a first choice became indisposed did not check client preferences. Also, moves `ROLE_HEAD_REV` define into roundstart section of defines because it is a roundstart ruleset ## Why It's Good For The Game fixes #95742 --- code/__DEFINES/role_preferences.dm | 2 +- .../subsystem/dynamic/dynamic_ruleset_roundstart.dm | 4 ++-- code/modules/antagonists/revolution/revolution.dm | 3 --- code/modules/antagonists/revolution/revolution_handler.dm | 5 ++++- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/code/__DEFINES/role_preferences.dm b/code/__DEFINES/role_preferences.dm index 12e2718caad..984a2bfae14 100644 --- a/code/__DEFINES/role_preferences.dm +++ b/code/__DEFINES/role_preferences.dm @@ -15,6 +15,7 @@ #define ROLE_HERETIC "Heretic" #define ROLE_MALF "Malf AI" #define ROLE_OPERATIVE "Operative" +#define ROLE_REV_HEAD "Head Revolutionary" #define ROLE_TRAITOR "Traitor" #define ROLE_WIZARD "Wizard" #define ROLE_SPY "Spy" @@ -35,7 +36,6 @@ #define ROLE_OPERATIVE_MIDROUND "Operative (Midround)" #define ROLE_CLOWN_OPERATIVE_MIDROUND "Clown Operative (Midround)" #define ROLE_PARADOX_CLONE "Paradox Clone" -#define ROLE_REV_HEAD "Head Revolutionary" #define ROLE_SLEEPER_AGENT "Syndicate Sleeper Agent" #define ROLE_SPACE_DRAGON "Space Dragon" #define ROLE_SPIDER "Spider" diff --git a/code/controllers/subsystem/dynamic/dynamic_ruleset_roundstart.dm b/code/controllers/subsystem/dynamic/dynamic_ruleset_roundstart.dm index 8554937f752..c967112f14f 100644 --- a/code/controllers/subsystem/dynamic/dynamic_ruleset_roundstart.dm +++ b/code/controllers/subsystem/dynamic/dynamic_ruleset_roundstart.dm @@ -363,7 +363,7 @@ addtimer(CALLBACK(src, PROC_REF(revs_execution_failed)), 1 MINUTES, TIMER_UNIQUE|TIMER_DELETE_ME) return - if(!can_be_headrev(candidate)) + if(!can_be_headrev(candidate, TRUE)) log_dynamic("[config_tag]: [key_name(candidate)] was not eligible to be a headrev after the timer expired - finding a replacement.") find_another_headrev() return @@ -378,7 +378,7 @@ /datum/dynamic_ruleset/roundstart/revolution/proc/find_another_headrev() for(var/mob/living/carbon/human/upstanding_citizen in GLOB.player_list) - if(!can_be_headrev(upstanding_citizen.mind)) + if(!can_be_headrev(upstanding_citizen.mind, TRUE)) continue reveal_head(upstanding_citizen.mind) log_dynamic("[config_tag]: [key_name(upstanding_citizen)] was selected as a replacement headrev.") diff --git a/code/modules/antagonists/revolution/revolution.dm b/code/modules/antagonists/revolution/revolution.dm index 4c4de17add0..b3f37afae86 100644 --- a/code/modules/antagonists/revolution/revolution.dm +++ b/code/modules/antagonists/revolution/revolution.dm @@ -405,9 +405,6 @@ for(var/datum/mind/khrushchev as anything in members - head_revolutionaries) if(!can_be_headrev(khrushchev)) continue - var/client/khruschevs_client = GET_CLIENT(khrushchev.current) - if(!(ROLE_REV_HEAD in khruschevs_client.prefs.be_special) && !(ROLE_PROVOCATEUR in khruschevs_client.prefs.be_special)) - continue if(ismonkey(khrushchev.current)) monkey_promotable += khrushchev else diff --git a/code/modules/antagonists/revolution/revolution_handler.dm b/code/modules/antagonists/revolution/revolution_handler.dm index f4c703ba952..b429500d7c8 100644 --- a/code/modules/antagonists/revolution/revolution_handler.dm +++ b/code/modules/antagonists/revolution/revolution_handler.dm @@ -150,7 +150,7 @@ GLOBAL_DATUM(revolution_handler, /datum/revolution_handler) return objective_complete /// Checks if someone is valid to be a headrev -/proc/can_be_headrev(datum/mind/candidate) +/proc/can_be_headrev(datum/mind/candidate, roundstart = FALSE) var/turf/head_turf = get_turf(candidate.current) if(considered_afk(candidate)) return FALSE @@ -160,6 +160,9 @@ GLOBAL_DATUM(revolution_handler, /datum/revolution_handler) return FALSE if(candidate.current.is_antag()) return FALSE + var/client/candidate_client = GET_CLIENT(candidate.current) + if(!(ROLE_REV_HEAD in candidate_client.prefs.be_special) && (roundstart || !(ROLE_PROVOCATEUR in candidate_client.prefs.be_special))) + return FALSE if(candidate.assigned_role.job_flags & JOB_HEAD_OF_STAFF) return FALSE if(HAS_MIND_TRAIT(candidate.current, TRAIT_UNCONVERTABLE))