From ac06801f51f2eedf62c71a450d3cc3f0fedb9f2c Mon Sep 17 00:00:00 2001 From: ElorgRHG <71735193+ElorgRHG@users.noreply.github.com> Date: Sat, 7 Mar 2026 09:35:45 +0100 Subject: [PATCH] Loadout citizenship restrictions (#21963) Changes: > - rscadd: "Added citizenship loadout restrictions to the loadout." > - rscadd: "Dominian Consular loadout items are now citizenship restricted to the Empire of Dominia." > - bugfix: "Religion loadout restrictions now actually restrict items to religions." Could prove useful and actually restricts what should be allowed to be taken in the loadout if characters don't fit certain criteria. Proof of concept presented the Empire of Dominia and their consular clothing. --- .../loadout/items/religion.dm | 3 ++ .../preference_setup/loadout/loadout.dm | 49 +++++++++++++------ ...rgRHG-loadout-citizenship-restrictions.yml | 15 ++++++ 3 files changed, 51 insertions(+), 16 deletions(-) create mode 100644 html/changelogs/ElorgRHG-loadout-citizenship-restrictions.yml diff --git a/code/modules/client/preference_setup/loadout/items/religion.dm b/code/modules/client/preference_setup/loadout/items/religion.dm index 5dbd6ffcf96..6f08ffa90b1 100644 --- a/code/modules/client/preference_setup/loadout/items/religion.dm +++ b/code/modules/client/preference_setup/loadout/items/religion.dm @@ -181,6 +181,7 @@ ABSTRACT_TYPE(/datum/gear/religion/dominia) path = /obj/item/clothing/under/dominia/priest/consular slot = slot_w_uniform allowed_roles = list("Consular Officer") + citizenship = CITIZENSHIP_DOMINIA /datum/gear/religion/dominia/beret_consular display_name = "tribunalist consular beret" @@ -188,6 +189,7 @@ ABSTRACT_TYPE(/datum/gear/religion/dominia) path = /obj/item/clothing/head/beret/dominia/consular slot = slot_head allowed_roles = list("Consular Officer") + citizenship = CITIZENSHIP_DOMINIA /datum/gear/religion/dominia/cape_consular display_name = "tribunalist cousular cape" @@ -195,6 +197,7 @@ ABSTRACT_TYPE(/datum/gear/religion/dominia) path = /obj/item/clothing/accessory/poncho/dominia_cape/tribunalist/consular slot = slot_wear_suit allowed_roles = list("Consular Officer") + citizenship = CITIZENSHIP_DOMINIA /datum/gear/religion/dominia/codex display_name = "tribunal codex" diff --git a/code/modules/client/preference_setup/loadout/loadout.dm b/code/modules/client/preference_setup/loadout/loadout.dm index e2cabe6fc08..f0dd4f4e48c 100644 --- a/code/modules/client/preference_setup/loadout/loadout.dm +++ b/code/modules/client/preference_setup/loadout/loadout.dm @@ -245,7 +245,8 @@ GLOBAL_LIST_INIT(gear_datums, list()) && (job && G.check_role(job.title)) \ && G.check_culture(text2path(pref.culture)) \ && G.check_origin(text2path(pref.origin)) \ - && G.check_religion(pref.religion)) + && G.check_religion(pref.religion)) \ + && G.check_citizenship(pref.citizenship) var/ticked = (G.display_name in pref.gear) var/style = "" @@ -478,6 +479,13 @@ GLOBAL_LIST_INIT(gear_datums, list()) */ var/religion + /** + * A string of the citizenship that can use this item + * + * If left `null`, any citizenship can spawn with this item + */ + var/citizenship + /** * A `/list` of [/singleton/origin_item/culture] paths that can use this item */ @@ -545,11 +553,13 @@ GLOBAL_LIST_INIT(gear_datums, list()) return "You cannot spawn with the [initial(spawning_item.name)] with your current species!" if(gd.faction_requirement && (human.employer_faction != "Stellar Corporate Conglomerate" && gd.faction_requirement != human.employer_faction)) return "You cannot spawn with the [initial(spawning_item.name)] with your current faction!" - var/our_culture = text2path(prefs.culture) - if(culture_restriction && !(our_culture in culture_restriction)) + if(!check_religion(prefs.religion)) + return "You cannot spawn with the [initial(spawning_item.name)] with your current religion!" + if(!check_citizenship(prefs.citizenship)) + return "You cannot spawn with the [initial(spawning_item.name)] with your current citizenship!" + if(!check_culture(text2path(prefs.culture))) return "You cannot spawn with the [initial(spawning_item.name)] with your current culture!" - var/our_origin = text2path(prefs.origin) - if(origin_restriction && !(our_origin in origin_restriction)) + if(!check_origin(text2path(prefs.origin))) return "You cannot spawn with the [initial(spawning_item.name)] with your current origin!" return null @@ -612,17 +622,24 @@ GLOBAL_LIST_INIT(gear_datums, list()) return TRUE // arg should be a religion name string -/datum/gear/proc/check_religion(var/religion_) - if((religion && religion_)) - if(islist(religion)) - var/result = FALSE - for(var/religion_path in religion) - if(religion_path == religion_) - result = TRUE - return result - else if (religion != religion_) - return FALSE - return TRUE +/datum/gear/proc/check_religion(var/user_religion) + if(!religion || !user_religion) + return TRUE + if(religion == user_religion) + return TRUE + if(islist(religion) && (user_religion in religion)) + return TRUE + return FALSE + +// arg should be a citizenship name string +/datum/gear/proc/check_citizenship(var/user_citizenship) + if(!citizenship || !user_citizenship) + return TRUE + if(citizenship == user_citizenship) + return TRUE + if(islist(citizenship) && (user_citizenship in citizenship)) + return TRUE + return FALSE // arg should be a role name string /datum/gear/proc/check_role(var/role) diff --git a/html/changelogs/ElorgRHG-loadout-citizenship-restrictions.yml b/html/changelogs/ElorgRHG-loadout-citizenship-restrictions.yml new file mode 100644 index 00000000000..91b300bb6b5 --- /dev/null +++ b/html/changelogs/ElorgRHG-loadout-citizenship-restrictions.yml @@ -0,0 +1,15 @@ +# Your name. +author: ElorgRHG + +# 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, this gets changed to [] after reading. Just remove the brackets when you add new shit. +# Please surround your changes in double quotes ("). It works without them, but if you use certain characters it screws up compiling. The quotes will not show up in the changelog. +changes: + - rscadd: "Added citizenship loadout restrictions to the loadout." + - rscadd: "Dominian Consular loadout items are now citizenship restricted to the Empire of Dominia." + - bugfix: "Religion loadout restrictions now actually restrict items to religions."