From 99893bd8a80749e6ebaae2fe8be2c24129b93ce7 Mon Sep 17 00:00:00 2001
From: Lyroy <57791262+Lyroy@users.noreply.github.com>
Date: Wed, 13 Oct 2021 21:32:37 +0200
Subject: [PATCH] [SEMI-MODULAR] Brings back custom Ash Walkers and Primal
Podpeople, also fixes job banned species checks (#8665)
* initial commit
* whoops hahah you don't need that comment
* species check on the prefs menu
* species check actually works now, podpeople quirks
* goof was right
---
code/controllers/subsystem/job.dm | 11 ++++
.../client/preferences/middleware/jobs.dm | 14 +++++
code/modules/client/preferences/species.dm | 7 ++-
.../modules/mob/dead/new_player/new_player.dm | 4 ++
.../preferences/middleware/languages.dm | 9 +--
.../customization/modules/jobs/_job.dm | 2 +-
.../mob/living/carbon/human/species.dm | 25 ++++++++
.../living/carbon/human/species/podweak.dm | 1 +
.../interfaces/PreferencesMenu/JobsPage.tsx | 9 +++
.../tgui/interfaces/PreferencesMenu/data.ts | 2 +-
.../preferences/species/ashlizard.ts | 57 +++++++++++++++++++
.../preferences/species/pod.ts | 31 ++++++++++
12 files changed, 165 insertions(+), 7 deletions(-)
create mode 100644 tgui/packages/tgui/interfaces/PreferencesMenu/preferences/species/ashlizard.ts
create mode 100644 tgui/packages/tgui/interfaces/PreferencesMenu/preferences/species/pod.ts
diff --git a/code/controllers/subsystem/job.dm b/code/controllers/subsystem/job.dm
index 7ce8ca3601f..ba10a19d34c 100644
--- a/code/controllers/subsystem/job.dm
+++ b/code/controllers/subsystem/job.dm
@@ -203,6 +203,8 @@ SUBSYSTEM_DEF(job)
return FALSE
if(job.veteran_only && !is_veteran_player(player.client))
return FALSE
+ if(job.has_banned_species(player.client.prefs))
+ return FALSE
//SKYRAT EDIT END
var/position_limit = job.total_positions
if(!latejoin)
@@ -242,6 +244,9 @@ SUBSYSTEM_DEF(job)
continue
if(job.veteran_only && !is_veteran_player(player.client))
JobDebug("FOC player is not veteran, Player: [player]")
+ if(job.has_banned_species(player.client.prefs))
+ JobDebug("FOC job not compatible with species, Player: [player]")
+ continue
//SKYRAT EDIT END
if(job.required_playtime_remaining(player.client))
JobDebug("FOC player not enough xp, Player: [player]")
@@ -295,6 +300,9 @@ SUBSYSTEM_DEF(job)
continue
if(job.veteran_only && !is_veteran_player(player.client))
JobDebug("GRJ player is not veteran, Player: [player]")
+ if(job.has_banned_species(player.client.prefs))
+ JobDebug("GRJ player has incompatible species, Player: [player]")
+ continue
//SKYRAT EDIT END
if(job.required_playtime_remaining(player.client))
@@ -481,6 +489,9 @@ SUBSYSTEM_DEF(job)
if(job.veteran_only && !is_veteran_player(player.client))
JobDebug("DO player is not veteran, Player: [player], Job:[job.title]")
continue
+ if(job.has_banned_species(player.client.prefs))
+ JobDebug("DO player has incompatible species, Player: [player], Job:[job.title]")
+ continue
//SKYRAT EDIT END
if(job.required_playtime_remaining(player.client))
diff --git a/code/modules/client/preferences/middleware/jobs.dm b/code/modules/client/preferences/middleware/jobs.dm
index c85eef6977e..589433bd2f9 100644
--- a/code/modules/client/preferences/middleware/jobs.dm
+++ b/code/modules/client/preferences/middleware/jobs.dm
@@ -45,6 +45,7 @@
data["job_preferences"] = preferences.job_preferences
// SKYRAT EDIT
data["job_alt_titles"] = preferences.alt_job_titles
+ data["species_restricted_jobs"] = get_unavailable_jobs_for_species()
// SKYRAT EDIT END
return data
@@ -99,3 +100,16 @@
data += job.title
return data
+
+//SKYRAT EDIT ADDITION BEGIN - CHECKING FOR INCOMPATIBLE SPECIES
+//This returns a list of jobs that are unavailable for the player's current species
+/datum/preference_middleware/jobs/proc/get_unavailable_jobs_for_species()
+ var/list/data = list()
+
+ for (var/datum/job/job as anything in SSjob.all_occupations)
+ if (job.has_banned_species(preferences))
+ data += job.title
+
+ return data
+
+//SKYRAT EDIT ADDITION END
diff --git a/code/modules/client/preferences/species.dm b/code/modules/client/preferences/species.dm
index b56f02fb657..28bdeccf0d5 100644
--- a/code/modules/client/preferences/species.dm
+++ b/code/modules/client/preferences/species.dm
@@ -24,6 +24,11 @@
for (var/species_id in get_selectable_species())
values += GLOB.species_list[species_id]
+ //SKYRAT EDIT ADDITION
+ for (var/species_id in get_customizable_races())
+ values += GLOB.species_list[species_id]
+ //SKYRAT EDIT END
+
return values
/datum/preference/choiced/species/apply_to_human(mob/living/carbon/human/target, value, datum/preferences/prefs)
@@ -49,7 +54,7 @@
var/list/food_flags = FOOD_FLAGS
- for (var/species_id in get_selectable_species())
+ for (var/species_id in (get_selectable_species() + get_customizable_races())) //SKYRAT EDIT CHANGE - ORIGINAL: for (var/species_id in get_selectable_species())
var/species_type = GLOB.species_list[species_id]
var/datum/species/species = new species_type
diff --git a/code/modules/mob/dead/new_player/new_player.dm b/code/modules/mob/dead/new_player/new_player.dm
index 273ee8a06e0..35b52237292 100644
--- a/code/modules/mob/dead/new_player/new_player.dm
+++ b/code/modules/mob/dead/new_player/new_player.dm
@@ -156,6 +156,8 @@
return "[jobtitle] is restricted from your languages."
if(JOB_NOT_VETERAN)
return "You need to be veteran to join as [jobtitle]."
+ if(JOB_UNAVAILABLE_SPECIES)
+ return "[jobtitle] is restricted from your species."
//SKYRAT EDIT END
return "Error: Unknown job availability."
@@ -189,6 +191,8 @@
return JOB_UNAVAILABLE_QUIRK
if(job.veteran_only && !is_veteran_player(client))
return JOB_NOT_VETERAN
+ if(job.has_banned_species(client.prefs))
+ return JOB_UNAVAILABLE_SPECIES
//SKYRAT EDIT END
return JOB_AVAILABLE
diff --git a/modular_skyrat/master_files/code/modules/client/preferences/middleware/languages.dm b/modular_skyrat/master_files/code/modules/client/preferences/middleware/languages.dm
index 219ccdf8a2a..8ca32a54001 100644
--- a/modular_skyrat/master_files/code/modules/client/preferences/middleware/languages.dm
+++ b/modular_skyrat/master_files/code/modules/client/preferences/middleware/languages.dm
@@ -71,20 +71,20 @@
var/list/data = list()
var/max_languages = preferences.all_quirks.Find(QUIRK_LINGUIST) ? 4 : 3
+ var/species_type = preferences.read_preference(/datum/preference/choiced/species)
+ var/datum/species/species = new species_type()
if(!preferences.languages || !preferences.languages.len || (preferences.languages && preferences.languages.len > max_languages)) // Too many languages, or no languages.
preferences.languages = list()
- var/species_type = preferences.read_preference(/datum/preference/choiced/species)
- var/datum/species/species = new species_type()
for(var/language in species.learnable_languages)
preferences.languages[language] = LANGUAGE_SPOKEN
- qdel(species)
-
var/list/selected_languages = list()
var/list/unselected_languages = list()
for (var/language_name in GLOB.all_languages)
var/datum/language/language = GLOB.language_datum_instances[language_name]
if(language.secret)
continue
+ if(species.always_customizable && !(language.type in species.learnable_languages)) //For the ghostrole species. We don't want ashwalkers speaking beachtongue now.
+ continue
if(preferences.languages[language.type])
selected_languages += list(list(
"description" = language.desc,
@@ -97,6 +97,7 @@
"name" = language.name,
"icon" = sanitize_css_class_name(language.name)
))
+ qdel(species)
data["total_language_points"] = max_languages
data["selected_languages"] = selected_languages
diff --git a/modular_skyrat/modules/customization/modules/jobs/_job.dm b/modular_skyrat/modules/customization/modules/jobs/_job.dm
index 57a97df10d3..6496c048ce4 100644
--- a/modular_skyrat/modules/customization/modules/jobs/_job.dm
+++ b/modular_skyrat/modules/customization/modules/jobs/_job.dm
@@ -33,7 +33,7 @@
var/my_id = species.id
if(species_whitelist && !species_whitelist[my_id])
return TRUE
- else if(!GLOB.roundstart_races[my_id])
+ else if(!(my_id in get_selectable_species()))
return TRUE
if(species_blacklist && species_blacklist[my_id])
return TRUE
diff --git a/modular_skyrat/modules/customization/modules/mob/living/carbon/human/species.dm b/modular_skyrat/modules/customization/modules/mob/living/carbon/human/species.dm
index 11a862012c8..50830e7c25a 100644
--- a/modular_skyrat/modules/customization/modules/mob/living/carbon/human/species.dm
+++ b/modular_skyrat/modules/customization/modules/mob/living/carbon/human/species.dm
@@ -572,3 +572,28 @@ GLOBAL_LIST_EMPTY(customizable_races)
/datum/species/proc/spec_revival(mob/living/carbon/human/H)
return
+
+/// Gets a list of all customizable races on roundstart.
+/proc/get_customizable_races()
+ RETURN_TYPE(/list)
+
+ if (!GLOB.customizable_races.len)
+ GLOB.customizable_races = generate_customizable_races()
+
+ return GLOB.customizable_races
+
+/**
+ * Generates races available to choose in character setup at roundstart, yet not playable on the station.
+ *
+ * This proc generates which species are available to pick from in character setup.
+ */
+/proc/generate_customizable_races()
+ var/list/customizable_races = list()
+
+ for(var/species_type in subtypesof(/datum/species))
+ var/datum/species/species = new species_type
+ if(species.always_customizable)
+ customizable_races += species.id
+ qdel(species)
+
+ return customizable_races
diff --git a/modular_skyrat/modules/customization/modules/mob/living/carbon/human/species/podweak.dm b/modular_skyrat/modules/customization/modules/mob/living/carbon/human/species/podweak.dm
index 74610bc3a47..286dd8dae81 100644
--- a/modular_skyrat/modules/customization/modules/mob/living/carbon/human/species/podweak.dm
+++ b/modular_skyrat/modules/customization/modules/mob/living/carbon/human/species/podweak.dm
@@ -22,3 +22,4 @@
default_mutant_bodyparts = list()
learnable_languages = list(/datum/language/common, /datum/language/sylvan)
+ always_customizable = FALSE
diff --git a/tgui/packages/tgui/interfaces/PreferencesMenu/JobsPage.tsx b/tgui/packages/tgui/interfaces/PreferencesMenu/JobsPage.tsx
index 9a638a019ad..f994e15d141 100644
--- a/tgui/packages/tgui/interfaces/PreferencesMenu/JobsPage.tsx
+++ b/tgui/packages/tgui/interfaces/PreferencesMenu/JobsPage.tsx
@@ -268,6 +268,15 @@ const JobRow = (props: {
);
+ } else if (data.species_restricted_jobs
+ && data.species_restricted_jobs.indexOf(job.name) !== -1) {
+ rightSide = (
+
+
+ Bad species
+
+
+ );
// SKYRAT EDIT END
} else {
rightSide = (;
overflow_role: string;
diff --git a/tgui/packages/tgui/interfaces/PreferencesMenu/preferences/species/ashlizard.ts b/tgui/packages/tgui/interfaces/PreferencesMenu/preferences/species/ashlizard.ts
new file mode 100644
index 00000000000..cf0b3e3ec57
--- /dev/null
+++ b/tgui/packages/tgui/interfaces/PreferencesMenu/preferences/species/ashlizard.ts
@@ -0,0 +1,57 @@
+import { Species } from "./base";
+
+const Ashwalker: Species = {
+ description: "The primitive natives of Indecipheres, this race, \
+ remotely related to other spacefaring reptiles, has formed a \
+ symbiotic relationship with one of the tendrils of the Necropolis. \
+ They live in a delicate balance with their surroundings, \
+ now threatened by invaders from the stars...",
+ features: {
+ good: [{
+ icon: "shield-alt",
+ name: "Tough Scales",
+ description: "Ash Walkers have been toughened by the heat of \
+ their homeland and constant hunting, making them more \
+ resilient to damage.",
+ }, {
+ icon: "biohazard",
+ name: "Virus Immunity",
+ description: "Either a blessing of the Tendril or unnaturally \
+ strong immune systems, Ash Walkers cannot contract illnesses.",
+ }, {
+ icon: "low-vision",
+ name: "Darksight",
+ description: "The eyes of Ash Walkers are able to see in \
+ the dark.",
+ }, {
+ icon: "wind",
+ name: "Blackened Lungs",
+ description: "The lungs of Ash Walkers are able to breathe \
+ the soot-filled atmosphere of Indecipheres.",
+ }],
+ neutral: [{
+ icon: "thermometer-empty",
+ name: "Cold-blooded",
+ description: "Higher tolerance for high temperatures, but lower \
+ tolerance for cold temperatures.",
+ }, {
+ icon: "egg",
+ name: "Tendril Rebirth",
+ description: "Ash Walkers may be brought back to life by \
+ the tendril they worship... as long as suitable \
+ sacrifices are made.",
+ }],
+ bad: [{
+ icon: "ban",
+ name: "Uncivilized",
+ description: "This species can't be used on the station.",
+ }, {
+ icon: "tint",
+ name: "Exotic Blood",
+ description: "Lizards have a unique \"L\" type blood, which can make \
+ receiving medical treatment more difficult.",
+ }],
+ },
+};
+
+export default Ashwalker;
diff --git a/tgui/packages/tgui/interfaces/PreferencesMenu/preferences/species/pod.ts b/tgui/packages/tgui/interfaces/PreferencesMenu/preferences/species/pod.ts
new file mode 100644
index 00000000000..5d29ccd65f3
--- /dev/null
+++ b/tgui/packages/tgui/interfaces/PreferencesMenu/preferences/species/pod.ts
@@ -0,0 +1,31 @@
+import { Species } from "./base";
+
+const Pod: Species = {
+ description: "An ancient, bio-engineered species of sentient plants, \
+ created by a Precursor Civilization.",
+ features: {
+ good: [{
+ icon: "sun",
+ name: "Photosynthetic Restoration",
+ description: "Podpeople slowly regenerate their wounds, \
+ clear out toxins, gather oxygen, and gain nutrition when in \
+ lit areas.",
+ }],
+ neutral: [],
+ bad: [{
+ icon: "ban",
+ name: "Uncivilized",
+ description: "This species can't be used on the station.",
+ }, {
+ icon: "seedling",
+ name: "Wilting",
+ description: "When hungry, podpeople start taking damage.",
+ }, {
+ icon: "heart-broken",
+ name: "Weak",
+ description: "Podpeople take increased brute and burn damage.",
+ }],
+ },
+};
+
+export default Pod;