mirror of
https://github.com/CHOMPStation2/CHOMPStation2.git
synced 2025-12-10 18:22:39 +00:00
Merge pull request #14386 from Seris02/shapeshiftersanitization
sanitizes selection of custom bases in prefs
This commit is contained in:
committed by
CHOMPStation2
parent
cb3f0eef48
commit
16008d3571
@@ -25,6 +25,20 @@
|
|||||||
var/dirty_synth = 0 //Are you a synth
|
var/dirty_synth = 0 //Are you a synth
|
||||||
var/gross_meatbag = 0 //Where'd I leave my Voight-Kampff test kit?
|
var/gross_meatbag = 0 //Where'd I leave my Voight-Kampff test kit?
|
||||||
|
|
||||||
|
/datum/preferences/proc/get_custom_bases_for_species(var/new_species)
|
||||||
|
if (!new_species)
|
||||||
|
new_species = species
|
||||||
|
var/list/choices
|
||||||
|
var/datum/species/spec = GLOB.all_species[new_species]
|
||||||
|
if (spec.selects_bodytype == SELECTS_BODYTYPE_SHAPESHIFTER)
|
||||||
|
choices = spec.get_valid_shapeshifter_forms()
|
||||||
|
choices = choices.Copy()
|
||||||
|
else if (spec.selects_bodytype == SELECTS_BODYTYPE_CUSTOM)
|
||||||
|
choices = GLOB.custom_species_bases.Copy()
|
||||||
|
if(new_species != SPECIES_CUSTOM)
|
||||||
|
choices = (choices | new_species)
|
||||||
|
return choices
|
||||||
|
|
||||||
// Definition of the stuff for Ears
|
// Definition of the stuff for Ears
|
||||||
/datum/category_item/player_setup_item/vore/traits
|
/datum/category_item/player_setup_item/vore/traits
|
||||||
name = "Traits"
|
name = "Traits"
|
||||||
@@ -122,7 +136,9 @@
|
|||||||
|
|
||||||
var/datum/species/selected_species = GLOB.all_species[pref.species]
|
var/datum/species/selected_species = GLOB.all_species[pref.species]
|
||||||
if(selected_species.selects_bodytype)
|
if(selected_species.selects_bodytype)
|
||||||
// Allowed!
|
if (!(pref.custom_base in pref.get_custom_bases_for_species()))
|
||||||
|
pref.custom_base = SPECIES_HUMAN
|
||||||
|
//otherwise, allowed!
|
||||||
else if(!pref.custom_base || !(pref.custom_base in GLOB.custom_species_bases))
|
else if(!pref.custom_base || !(pref.custom_base in GLOB.custom_species_bases))
|
||||||
pref.custom_base = SPECIES_HUMAN
|
pref.custom_base = SPECIES_HUMAN
|
||||||
|
|
||||||
@@ -131,6 +147,7 @@
|
|||||||
pref.custom_ask = lowertext(trim(pref.custom_ask))
|
pref.custom_ask = lowertext(trim(pref.custom_ask))
|
||||||
pref.custom_exclaim = lowertext(trim(pref.custom_exclaim))
|
pref.custom_exclaim = lowertext(trim(pref.custom_exclaim))
|
||||||
|
|
||||||
|
|
||||||
/datum/category_item/player_setup_item/vore/traits/copy_to_mob(var/mob/living/carbon/human/character)
|
/datum/category_item/player_setup_item/vore/traits/copy_to_mob(var/mob/living/carbon/human/character)
|
||||||
character.custom_species = pref.custom_species
|
character.custom_species = pref.custom_species
|
||||||
character.custom_say = lowertext(trim(pref.custom_say))
|
character.custom_say = lowertext(trim(pref.custom_say))
|
||||||
@@ -241,15 +258,7 @@
|
|||||||
return TOPIC_REFRESH
|
return TOPIC_REFRESH
|
||||||
|
|
||||||
else if(href_list["custom_base"])
|
else if(href_list["custom_base"])
|
||||||
var/list/choices
|
var/list/choices = pref.get_custom_bases_for_species()
|
||||||
var/datum/species/spec = GLOB.all_species[pref.species]
|
|
||||||
if (spec.selects_bodytype == SELECTS_BODYTYPE_SHAPESHIFTER && istype(spec, /datum/species/shapeshifter))
|
|
||||||
var/datum/species/spec_shifter = spec
|
|
||||||
choices = spec_shifter.get_valid_shapeshifter_forms()
|
|
||||||
else
|
|
||||||
choices = GLOB.custom_species_bases
|
|
||||||
if(pref.species != SPECIES_CUSTOM)
|
|
||||||
choices = (choices | pref.species)
|
|
||||||
var/text_choice = tgui_input_list(usr, "Pick an icon set for your species:","Icon Base", choices)
|
var/text_choice = tgui_input_list(usr, "Pick an icon set for your species:","Icon Base", choices)
|
||||||
if(text_choice in choices)
|
if(text_choice in choices)
|
||||||
pref.custom_base = text_choice
|
pref.custom_base = text_choice
|
||||||
|
|||||||
Reference in New Issue
Block a user