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>
This commit is contained in:
Casper3667
2025-09-06 10:32:23 +00:00
committed by GitHub
co-authored by SleepyGemmy
parent b88f19690d
commit 69e331e64a
+27 -7
View File
@@ -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."