From 69e331e64aae1007a8d43c9a546b6a522877d1b4 Mon Sep 17 00:00:00 2001 From: Casper3667 <8396443+Casper3667@users.noreply.github.com> Date: Sat, 6 Sep 2025 12:32:23 +0200 Subject: [PATCH] Adds the ability for factions to blacklist specific citizenships (#21129) Nothing player-facing in this one, for now. This adds the ability for factions to be unavailable for certain citizenships. It has been implemented as a blacklist due to the variety of citizenships in the game. An example would be if the DPRA was added to the list for Idris, then anybody with a DPRA citizenship would be unable to select Idris as their faction. This was done for the taj lore team. --------- Signed-off-by: Casper3667 <8396443+Casper3667@users.noreply.github.com> Co-authored-by: SleepyGemmy <99297919+SleepyGemmy@users.noreply.github.com> --- code/game/jobs/faction/faction.dm | 34 ++++++++++++++++++++++++------- 1 file changed, 27 insertions(+), 7 deletions(-) diff --git a/code/game/jobs/faction/faction.dm b/code/game/jobs/faction/faction.dm index 70eaf663f50..75493c3f379 100644 --- a/code/game/jobs/faction/faction.dm +++ b/code/game/jobs/faction/faction.dm @@ -7,6 +7,7 @@ var/list/allowed_role_types var/list/allowed_species_types var/list/job_species_blacklist //will override the normal job species list for a member of this faction + var/list/blacklisted_citizenship_types var/is_default = FALSE @@ -23,6 +24,16 @@ allowed_species_types = l + var/list/b = list() + + for(var/path in blacklisted_citizenship_types) + if(blacklisted_citizenship_types[path] != TRUE) + b |= typecacheof(path, FALSE) + else + b[path] = TRUE + + blacklisted_citizenship_types = b + /datum/faction/proc/get_occupations() . = list() @@ -50,16 +61,25 @@ . += role /datum/faction/proc/get_selection_error(datum/preferences/prefs, var/mob/user) - if (!length(allowed_species_types)) - return null + if(length(allowed_species_types)) - var/datum/species/S = prefs.get_species_datum() + var/datum/species/S = prefs.get_species_datum() - if (!S) - return "No valid species selected." + if(!S) + return "No valid species selected." - if (!is_type_in_typecache(S, allowed_species_types)) - return "Invalid species selected." + if(!is_type_in_typecache(S, allowed_species_types)) + return "Invalid species selected." + + if(length(blacklisted_citizenship_types)) + + var/datum/citizenship/C = SSrecords.citizenships[prefs.citizenship] + + if(!C) + return "No valid nation selected." + + if(is_type_in_typecache(C, blacklisted_citizenship_types)) + return "Invalid nation selected." if (!is_visible(user)) return "This faction is not available to you."