From e4b395055c8ba341996c7369d45fd3eed091af8a Mon Sep 17 00:00:00 2001 From: Bloop <13398309+vinylspiders@users.noreply.github.com> Date: Sun, 5 Jul 2026 03:02:56 -0400 Subject: [PATCH] Makes prefs application for ghost roles more flexible and granular (#96683) ## About The Pull Request Tin, also applies this to the nightmare role since they shouldn't be getting prefs applied to their mob. ## Why It's Good For The Game You don't always want prefs to be applied the same way (or sometimes, at all) for each ghost role, and by just moving that logic out to overridable procs. this allows for granular control over that ## Changelog :cl: fix: shadows will no longer get the candidate's prefs applied to their mob /:cl: --------- Co-authored-by: MrMelbert <51863163+MrMelbert@users.noreply.github.com> --- .../dynamic/dynamic_ruleset_midround.dm | 28 +++++++++++++++---- 1 file changed, 23 insertions(+), 5 deletions(-) diff --git a/code/controllers/subsystem/dynamic/dynamic_ruleset_midround.dm b/code/controllers/subsystem/dynamic/dynamic_ruleset_midround.dm index 8631eaf4670..72dea251598 100644 --- a/code/controllers/subsystem/dynamic/dynamic_ruleset_midround.dm +++ b/code/controllers/subsystem/dynamic/dynamic_ruleset_midround.dm @@ -230,11 +230,8 @@ if(isnull(body)) return candidate.transfer_to(body, force_key_move = TRUE) // yoinks the candidate's client - if(ishuman(body)) - var/mob/living/carbon/human/human_body = body - body.client?.prefs.safe_transfer_prefs_to(body) - human_body.dna.remove_all_mutations() - human_body.dna.update_dna_identity() + if(ishuman(body) && apply_prefs_to_body(body)) + on_prefs_applied(body) /** * Handles making the body for the candidate @@ -262,6 +259,24 @@ role_name_text = readable_poll_role, ) +/** + * Handles prepping the body with the candidate's prefs + * + * Applies prefs to a given body. Usually that's what you want, but sometimes you don't, in which case you can override this proc. + * Returns TRUE if prefs were applied + */ +/datum/dynamic_ruleset/midround/from_ghosts/proc/apply_prefs_to_body(mob/living/carbon/human/body) + body.client?.prefs.safe_transfer_prefs_to(body) + body.dna.remove_all_mutations() + body.dna.update_dna_identity() + return TRUE + +/** + * Handles anything extra you want to happen after applying prefs + */ +/datum/dynamic_ruleset/midround/from_ghosts/proc/on_prefs_applied(mob/living/carbon/human/body) + return + /datum/dynamic_ruleset/midround/from_ghosts/wizard name = "Wizard" config_tag = "Midround Wizard" @@ -512,6 +527,9 @@ max_antag_cap = 1 signup_atom_appearance = /obj/item/light_eater +/datum/dynamic_ruleset/midround/from_ghosts/nightmare/apply_prefs_to_body(mob/living/carbon/human/body) + return FALSE + /datum/dynamic_ruleset/midround/from_ghosts/nightmare/can_be_selected() return ..() && !isnull(find_maintenance_spawn(atmos_sensitive = TRUE, require_darkness = TRUE))