diff --git a/code/datums/brain_damage/creepy_trauma.dm b/code/datums/brain_damage/creepy_trauma.dm index d1b056352cbff..8f2757a5f30fd 100644 --- a/code/datums/brain_damage/creepy_trauma.dm +++ b/code/datums/brain_damage/creepy_trauma.dm @@ -120,6 +120,7 @@ /datum/brain_trauma/special/obsessed/proc/find_obsession() var/list/viable_minds = list() //The first list, which excludes hijinks var/list/possible_targets = list() //The second list, which filters out silicons and simplemobs + var/list/exemption_list = list() //A list of all targets, subtracting targets who are exempt from being an Obsession target through preferences. special_pool will still be picked first var/static/list/trait_obsessions = list( JOB_MIME = TRAIT_MIME_FAN, JOB_CLOWN = TRAIT_CLOWN_ENJOYER, @@ -148,12 +149,22 @@ if (trait_obsessions[job] != null && HAS_TRAIT(owner, trait_obsessions[job])) special_pool += possible_target.current possible_targets += possible_target.current + exemption_list += possible_target.current + //check if they are exempt from being an obsession target + var/mob/living/carbon/human/exempt_target = possible_target + if(exempt_target.obsession_target == 0) + exemption_list -= exempt_target //Do we have any special target? if(length(special_pool)) chosen_victim = pick(special_pool) return chosen_victim + //Prioritize picking those who are eligible to roll being the target of an Obsession in preferences + if(length(exemption_list)) + chosen_victim = pick(exemption_list) + return chosen_victim + //If not, pick any other ordinary target if(possible_targets.len > 0) chosen_victim = pick(possible_targets) diff --git a/code/modules/client/preferences/obsession_target.dm b/code/modules/client/preferences/obsession_target.dm new file mode 100644 index 0000000000000..70fe9bbf386c2 --- /dev/null +++ b/code/modules/client/preferences/obsession_target.dm @@ -0,0 +1,7 @@ +/datum/preference/toggle/obsession_target + category = PREFERENCE_CATEGORY_NON_CONTEXTUAL + savefile_key = "obsession_target" + savefile_identifier = PREFERENCE_CHARACTER + +/datum/preference/toggle/obsession_target/apply_to_human(mob/living/carbon/human/target, value) + target.obsession_target = value diff --git a/code/modules/mob/living/carbon/human/human_defines.dm b/code/modules/mob/living/carbon/human/human_defines.dm index 05f1847c19011..0d9e532c4d603 100644 --- a/code/modules/mob/living/carbon/human/human_defines.dm +++ b/code/modules/mob/living/carbon/human/human_defines.dm @@ -108,6 +108,9 @@ /// Normally set by `/datum/preference/toggle/persistent_scars/apply_to_human`. var/persistent_scars + ///Preferences check to determine if a character is capable or not of being the target of an Obsession. + var/obsession_target + /// Base height of the mob, modified by stuff like dwarfism or species VAR_PRIVATE/base_mob_height = HUMAN_HEIGHT_MEDIUM /// Actual height of the mob. Don't touch this one, it is set via update_mob_height() diff --git a/tgstation.dme b/tgstation.dme index 66da4cfce9dbc..fdd620a0f76d7 100644 --- a/tgstation.dme +++ b/tgstation.dme @@ -3890,6 +3890,7 @@ #include "code\modules\client\preferences\multiz_parallax.dm" #include "code\modules\client\preferences\multiz_performance.dm" #include "code\modules\client\preferences\names.dm" +#include "code\modules\client\preferences\obsession_target.dm" #include "code\modules\client\preferences\ooc.dm" #include "code\modules\client\preferences\operative_species.dm" #include "code\modules\client\preferences\paint_color.dm" diff --git a/tgui/packages/tgui/interfaces/PreferencesMenu/preferences/features/character_preferences/obsession.tsx b/tgui/packages/tgui/interfaces/PreferencesMenu/preferences/features/character_preferences/obsession.tsx new file mode 100644 index 0000000000000..a740043e702b1 --- /dev/null +++ b/tgui/packages/tgui/interfaces/PreferencesMenu/preferences/features/character_preferences/obsession.tsx @@ -0,0 +1,8 @@ +import { CheckboxInput, type FeatureToggle } from '../base'; + +export const obsession_target: FeatureToggle = { + name: 'Obsession Target', + description: + 'If unchecked, you will be less likely to become a target for an Obsession.', + component: CheckboxInput, +};