mirror of
https://github.com/CHOMPStation2/CHOMPStation2.git
synced 2025-12-11 18:53:06 +00:00
[MIRROR] Sanitizes languages, ears/wings/tail prefs on login
This commit is contained in:
@@ -23,8 +23,26 @@
|
||||
if(!islist(pref.alternate_languages)) pref.alternate_languages = list()
|
||||
if(pref.species)
|
||||
var/datum/species/S = GLOB.all_species[pref.species]
|
||||
<<<<<<< HEAD
|
||||
if(S && pref.alternate_languages.len > pref.numlanguage()) //CHOMPEdit
|
||||
pref.alternate_languages.len = pref.numlanguage() // Truncate to allowed length CHOMPEdit
|
||||
||||||| parent of 0c51187d69... Merge pull request #10223 from VOREStation/upstream-merge-8030
|
||||
if(S && pref.alternate_languages.len > S.num_alternate_languages)
|
||||
pref.alternate_languages.len = S.num_alternate_languages // Truncate to allowed length
|
||||
=======
|
||||
if(!istype(S))
|
||||
return
|
||||
|
||||
if(pref.alternate_languages.len > S.num_alternate_languages)
|
||||
pref.alternate_languages.len = S.num_alternate_languages // Truncate to allowed length
|
||||
|
||||
// Sanitize illegal languages
|
||||
for(var/language in pref.alternate_languages)
|
||||
var/datum/language/L = GLOB.all_languages[language]
|
||||
if((L.flags & RESTRICTED) || (!(language in S.secondary_langs) && !is_lang_whitelisted(pref.client, L)))
|
||||
pref.alternate_languages -= language
|
||||
|
||||
>>>>>>> 0c51187d69... Merge pull request #10223 from VOREStation/upstream-merge-8030
|
||||
if(isnull(pref.language_prefixes) || !pref.language_prefixes.len)
|
||||
pref.language_prefixes = config.language_prefixes.Copy()
|
||||
for(var/prefix in pref.language_prefixes)
|
||||
|
||||
@@ -244,21 +244,12 @@ var/global/list/valid_bloodtypes = list("A+", "A-", "B+", "B-", "AB+", "AB-", "O
|
||||
pref.r_wing3 = sanitize_integer(pref.r_wing3, 0, 255, initial(pref.r_wing3))
|
||||
pref.g_wing3 = sanitize_integer(pref.g_wing3, 0, 255, initial(pref.g_wing3))
|
||||
pref.b_wing3 = sanitize_integer(pref.b_wing3, 0, 255, initial(pref.b_wing3))
|
||||
if(pref.ear_style)
|
||||
pref.ear_style = sanitize_inlist(pref.ear_style, ear_styles_list, initial(pref.ear_style))
|
||||
var/datum/sprite_accessory/temp_ear_style = ear_styles_list[pref.ear_style]
|
||||
if(temp_ear_style.apply_restrictions && (!(pref.species in temp_ear_style.species_allowed)))
|
||||
pref.ear_style = initial(pref.ear_style)
|
||||
if(pref.tail_style)
|
||||
pref.tail_style = sanitize_inlist(pref.tail_style, tail_styles_list, initial(pref.tail_style))
|
||||
var/datum/sprite_accessory/temp_tail_style = tail_styles_list[pref.tail_style]
|
||||
if(temp_tail_style.apply_restrictions && (!(pref.species in temp_tail_style.species_allowed)))
|
||||
pref.tail_style = initial(pref.tail_style)
|
||||
if(pref.wing_style)
|
||||
pref.wing_style = sanitize_inlist(pref.wing_style, wing_styles_list, initial(pref.wing_style))
|
||||
var/datum/sprite_accessory/temp_wing_style = wing_styles_list[pref.wing_style]
|
||||
if(temp_wing_style.apply_restrictions && (!(pref.species in temp_wing_style.species_allowed)))
|
||||
pref.wing_style = initial(pref.wing_style)
|
||||
if(!(pref.ear_style in get_ear_styles()))
|
||||
pref.ear_style = initial(pref.ear_style)
|
||||
if(!(pref.wing_style in get_wing_styles()))
|
||||
pref.wing_style = initial(pref.wing_style)
|
||||
if(!(pref.tail_style in get_tail_styles()))
|
||||
pref.tail_style = initial(pref.tail_style)
|
||||
|
||||
// Moved from /datum/preferences/proc/copy_to()
|
||||
/datum/category_item/player_setup_item/general/body/copy_to_mob(var/mob/living/carbon/human/character)
|
||||
@@ -705,7 +696,15 @@ var/global/list/valid_bloodtypes = list("A+", "A-", "B+", "B-", "AB+", "AB-", "O
|
||||
|
||||
reset_limbs() // Safety for species with incompatible manufacturers; easier than trying to do it case by case.
|
||||
pref.body_markings.Cut() // Basically same as above.
|
||||
|
||||
|
||||
// Sanitize ear/wing/tail styles
|
||||
if(!(pref.ear_style in get_ear_styles()))
|
||||
pref.ear_style = initial(pref.ear_style)
|
||||
if(!(pref.wing_style in get_wing_styles()))
|
||||
pref.wing_style = initial(pref.wing_style)
|
||||
if(!(pref.tail_style in get_tail_styles()))
|
||||
pref.tail_style = initial(pref.tail_style)
|
||||
|
||||
var/min_age = get_min_age()
|
||||
var/max_age = get_max_age()
|
||||
pref.age = max(min(pref.age, max_age), min_age)
|
||||
@@ -1172,11 +1171,7 @@ var/global/list/valid_bloodtypes = list("A+", "A-", "B+", "B-", "AB+", "AB-", "O
|
||||
|
||||
else if(href_list["ear_style"])
|
||||
// Construct the list of names allowed for this user.
|
||||
var/list/pretty_ear_styles = list("Normal" = null)
|
||||
for(var/path in ear_styles_list)
|
||||
var/datum/sprite_accessory/ears/instance = ear_styles_list[path]
|
||||
if(((!instance.ckeys_allowed) || (usr.ckey in instance.ckeys_allowed)) && ((!instance.apply_restrictions) || (pref.species in instance.species_allowed)) || check_rights(R_ADMIN | R_EVENT | R_FUN, 0, user)) //VOREStation Edit
|
||||
pretty_ear_styles[instance.name] = path
|
||||
var/list/pretty_ear_styles = get_ear_styles()
|
||||
|
||||
// Present choice to user
|
||||
var/new_ear_style = input(user, "Pick ears", "Character Preference", pref.ear_style) as null|anything in pretty_ear_styles
|
||||
@@ -1214,11 +1209,7 @@ var/global/list/valid_bloodtypes = list("A+", "A-", "B+", "B-", "AB+", "AB-", "O
|
||||
|
||||
else if(href_list["tail_style"])
|
||||
// Construct the list of names allowed for this user.
|
||||
var/list/pretty_tail_styles = list("Normal" = null)
|
||||
for(var/path in tail_styles_list)
|
||||
var/datum/sprite_accessory/tail/instance = tail_styles_list[path]
|
||||
if(((!instance.ckeys_allowed) || (usr.ckey in instance.ckeys_allowed)) && ((!instance.apply_restrictions) || (pref.species in instance.species_allowed)) || check_rights(R_ADMIN | R_EVENT | R_FUN, 0, user)) //VOREStation Edit
|
||||
pretty_tail_styles[instance.name] = path
|
||||
var/list/pretty_tail_styles = get_tail_styles()
|
||||
|
||||
// Present choice to user
|
||||
var/new_tail_style = input(user, "Pick tails", "Character Preference", pref.tail_style) as null|anything in pretty_tail_styles
|
||||
@@ -1256,11 +1247,7 @@ var/global/list/valid_bloodtypes = list("A+", "A-", "B+", "B-", "AB+", "AB-", "O
|
||||
|
||||
else if(href_list["wing_style"])
|
||||
// Construct the list of names allowed for this user.
|
||||
var/list/pretty_wing_styles = list("Normal" = null)
|
||||
for(var/path in wing_styles_list)
|
||||
var/datum/sprite_accessory/wing/instance = wing_styles_list[path]
|
||||
if(((!instance.ckeys_allowed) || (usr.ckey in instance.ckeys_allowed)) && ((!instance.apply_restrictions) || (pref.species in instance.species_allowed)) || check_rights(R_ADMIN | R_EVENT | R_FUN, 0, user)) //VOREStation Edit
|
||||
pretty_wing_styles[instance.name] = path
|
||||
var/list/pretty_wing_styles = get_wing_styles()
|
||||
|
||||
// Present choice to user
|
||||
var/new_wing_style = input(user, "Pick wings", "Character Preference", pref.wing_style) as null|anything in pretty_wing_styles
|
||||
@@ -1389,4 +1376,32 @@ var/global/list/valid_bloodtypes = list("A+", "A-", "B+", "B-", "AB+", "AB-", "O
|
||||
dat += "</center></body>"
|
||||
|
||||
user << browse(dat, "window=species;size=700x400")
|
||||
<<<<<<< HEAD
|
||||
|
||||
||||||| parent of 0c51187d69... Merge pull request #10223 from VOREStation/upstream-merge-8030
|
||||
=======
|
||||
|
||||
/datum/category_item/player_setup_item/general/body/proc/get_tail_styles()
|
||||
var/list/pretty_tail_styles = list("Normal" = null)
|
||||
for(var/path in tail_styles_list)
|
||||
var/datum/sprite_accessory/tail/instance = tail_styles_list[path]
|
||||
if(((!instance.ckeys_allowed) || (pref.client.ckey in instance.ckeys_allowed)) && ((!instance.apply_restrictions) || (pref.species in instance.species_allowed)) || check_rights(R_ADMIN | R_EVENT | R_FUN, 0, pref.client)) //VOREStation Edit
|
||||
pretty_tail_styles[instance.name] = path
|
||||
return pretty_tail_styles
|
||||
|
||||
/datum/category_item/player_setup_item/general/body/proc/get_ear_styles()
|
||||
var/list/pretty_ear_styles = list("Normal" = null)
|
||||
for(var/path in ear_styles_list)
|
||||
var/datum/sprite_accessory/ears/instance = ear_styles_list[path]
|
||||
if(((!instance.ckeys_allowed) || (pref.client.ckey in instance.ckeys_allowed)) && ((!instance.apply_restrictions) || (pref.species in instance.species_allowed)) || check_rights(R_ADMIN | R_EVENT | R_FUN, 0, pref.client)) //VOREStation Edit
|
||||
pretty_ear_styles[instance.name] = path
|
||||
return pretty_ear_styles
|
||||
|
||||
/datum/category_item/player_setup_item/general/body/proc/get_wing_styles()
|
||||
var/list/pretty_wing_styles = list("Normal" = null)
|
||||
for(var/path in wing_styles_list)
|
||||
var/datum/sprite_accessory/wing/instance = wing_styles_list[path]
|
||||
if(((!instance.ckeys_allowed) || (pref.client.ckey in instance.ckeys_allowed)) && ((!instance.apply_restrictions) || (pref.species in instance.species_allowed)) || check_rights(R_ADMIN | R_EVENT | R_FUN, 0, pref.client)) //VOREStation Edit
|
||||
pretty_wing_styles[instance.name] = path
|
||||
return pretty_wing_styles
|
||||
>>>>>>> 0c51187d69... Merge pull request #10223 from VOREStation/upstream-merge-8030
|
||||
|
||||
Reference in New Issue
Block a user