mirror of
https://github.com/Aurorastation/Aurora.3.git
synced 2025-12-21 15:42:35 +00:00
Species that are neuter (at least from the human/player characters' perspective) will now properly spawn as neuter, and be neuter in the character setup screen. This affects (tagged) IPCs, Dionae, Vox & Vaurca. Also fixes some gender related grammar stuff. I think all the procs that randomise based on gender will just default to one or the other and shouldn't have noticeably weird results. This also fixes the bug where Diona players would be 'he/she', but NPC diona would be 'it'.
38 lines
1.2 KiB
Plaintext
38 lines
1.2 KiB
Plaintext
//general stuff
|
|
/proc/sanitize_integer(number, min=0, max=1, default=0)
|
|
if(isnum(number))
|
|
number = round(number)
|
|
if(min <= number && number <= max)
|
|
return number
|
|
return default
|
|
|
|
/proc/sanitize_text(text, default="")
|
|
if(istext(text))
|
|
return text
|
|
return default
|
|
|
|
/proc/sanitize_inlist(value, list/List, default)
|
|
if(value in List) return value
|
|
if(default) return default
|
|
if(List && List.len)return List[1]
|
|
|
|
//more specialised stuff
|
|
/proc/sanitize_gender(gender, var/species_name)
|
|
var/datum/species/S = all_species[species_name]
|
|
return sanitize_inlist(gender, (valid_player_genders & S.default_genders), pick(S.default_genders))
|
|
|
|
/proc/sanitize_hexcolor(color, default="#000000")
|
|
if(!istext(color)) return default
|
|
var/len = length(color)
|
|
if(len != 7 && len !=4) return default
|
|
if(text2ascii(color,1) != 35) return default //35 is the ascii code for "#"
|
|
. = "#"
|
|
for(var/i=2,i<=len,i++)
|
|
var/ascii = text2ascii(color,i)
|
|
switch(ascii)
|
|
if(48 to 57) . += ascii2text(ascii) //numbers 0 to 9
|
|
if(97 to 102) . += ascii2text(ascii) //letters a to f
|
|
if(65 to 70) . += ascii2text(ascii+32) //letters A to F - translates to lowercase
|
|
else return default
|
|
return .
|