From 06d969a96792142c6dad58203f52468accf3571b Mon Sep 17 00:00:00 2001
From: Sharkmare <34294231+Sharkmare@users.noreply.github.com>
Date: Sat, 6 Mar 2021 17:23:41 +0100
Subject: [PATCH] Species whitelist for traits
Tunes up the trait system to have a whitelist AND a blacklist so you can choose whichever makes you have to write the lowest amount of code
---
.../client/preference_setup/vore/07_traits.dm | 8 ++++----
.../human/species/shadekin/shadekin_zz_ch.dm | 19 +------------------
.../species/station/traits_vr/trait_ch.dm | 1 +
3 files changed, 6 insertions(+), 22 deletions(-)
diff --git a/code/modules/client/preference_setup/vore/07_traits.dm b/code/modules/client/preference_setup/vore/07_traits.dm
index 04ee5a32ed..503727ee6f 100644
--- a/code/modules/client/preference_setup/vore/07_traits.dm
+++ b/code/modules/client/preference_setup/vore/07_traits.dm
@@ -41,7 +41,7 @@
S["traits_cheating"] >> pref.traits_cheating
S["max_traits"] >> pref.max_traits
S["trait_points"] >> pref.starting_trait_points
-
+
S["custom_say"] >> pref.custom_say
S["custom_whisper"] >> pref.custom_whisper
S["custom_ask"] >> pref.custom_ask
@@ -58,7 +58,7 @@
S["traits_cheating"] << pref.traits_cheating
S["max_traits"] << pref.max_traits
S["trait_points"] << pref.starting_trait_points
-
+
S["custom_say"] << pref.custom_say
S["custom_whisper"] << pref.custom_whisper
S["custom_ask"] << pref.custom_ask
@@ -179,7 +179,7 @@
. += "Set Color"
. += "R
"
. += "
"
-
+
. += "Custom Say: "
. += "Set Say Verb
"
. += "Custom Whisper: "
@@ -345,7 +345,7 @@
pref.gross_meatbag = 0 //Just to be sure
return TOPIC_REFRESH
- if(pref.species in instance.banned_species)
+ if(pref.species in instance.banned_species || (LAZYLEN(instance.allowed_species) && !(pref.species in instance.allowed_species))) //CHOMPEDIT: Whitelising!
alert("The trait you've selected cannot be taken by the species you've chosen!","Error")
return TOPIC_REFRESH
diff --git a/code/modules/mob/living/carbon/human/species/shadekin/shadekin_zz_ch.dm b/code/modules/mob/living/carbon/human/species/shadekin/shadekin_zz_ch.dm
index 2c4145ee6a..bf6c3cd249 100644
--- a/code/modules/mob/living/carbon/human/species/shadekin/shadekin_zz_ch.dm
+++ b/code/modules/mob/living/carbon/human/species/shadekin/shadekin_zz_ch.dm
@@ -71,24 +71,7 @@
update_shadekin_hud(H)
/datum/trait/kintype
- banned_species = list( SPECIES_AKULA,
- SPECIES_ALRAUNE,
- SPECIES_NEVREAN,
- SPECIES_PROTEAN,
- SPECIES_RAPALA,
- SPECIES_SERGAL,
- SPECIES_SHADEKIN_CREW,
- SPECIES_VASILISSAN,
- SPECIES_VULPKANIN,
- SPECIES_XENOCHIMERA,
- SPECIES_ZORREN_HIGH,
- SPECIES_CUSTOM,
- SPECIES_WEREBEAST,
- SPECIES_FENNEC,
- SPECIES_XENOHYBRID,
- SPECIES_VOX,
- SPECIES_ZADDAT,
- SPECIES_PROMETHEAN)
+ allowed_species = list(SPECIES_SHADEKIN)
var/color = "Blue"
desc = "Makes your shadekin adapted as a Blue eyed kin! This gives you decreased energy regeneration in darkness, decreased regeneration in the light amd unchanged health!"
cost = 0
diff --git a/code/modules/mob/living/carbon/human/species/station/traits_vr/trait_ch.dm b/code/modules/mob/living/carbon/human/species/station/traits_vr/trait_ch.dm
index 662d3ebdc0..fd1f15ccdd 100644
--- a/code/modules/mob/living/carbon/human/species/station/traits_vr/trait_ch.dm
+++ b/code/modules/mob/living/carbon/human/species/station/traits_vr/trait_ch.dm
@@ -1,5 +1,6 @@
/datum/trait
var/special_env = FALSE
+ var/list/allowed_species // A list of species that CAN take this trait, use this if only 1 species can use it. -shark
/datum/trait/proc/handle_environment_special(var/mob/living/carbon/human/H)
return