Files
fulpstation/code/__HELPERS/pronouns.dm
MrPerson f7eb2c905b Unicode awareness Part 2 -- copytext() (#48512)
* Unicode support Part 2 -- copytext()

This is the transition of all copytext() calls to be unicode aware and also some nearby calls in the same functions. Most things are just replacing copytext() with copytext_char() as a terrible character limiter but a few others were slightly more involved.

I replaced a ton of
````
var/something = sanitize(input())
something = copytext(something, 1, MAX_MESSAGE_LEN)
````

with a single stripped_input() call. stripped_input() already calls html_encode(), trim(), and some other sanitization so there shouldn't be any major issues there.

This is still VERY rough btw; DNA is a mess, the status displays are complete ass, there's a copytext() in code\datums\shuttles.dm that I'm not sure what to do with, and I didn't touch anything in the tools folder. I haven't tested this much at all yet, I only got it to compile earlier this morning. There's also likely to be weird bugs until I get around to fixing length(), findtext(), and the rest of the string procs.

* Makes the code functional

* Assume color hex strings are always # followed by ascii.
Properly encodes and decodes the stuff in mob_helpers.dm which fixes some issues there.

* Removes ninjaspeak since it's unused
2020-01-18 13:07:22 +13:00

265 lines
6.4 KiB
Plaintext

//pronoun procs, for getting pronouns without using the text macros that only work in certain positions
//datums don't have gender, but most of their subtypes do!
/datum/proc/p_they(capitalized, temp_gender)
. = "it"
if(capitalized)
. = capitalize(.)
/datum/proc/p_their(capitalized, temp_gender)
. = "its"
if(capitalized)
. = capitalize(.)
/datum/proc/p_them(capitalized, temp_gender)
. = "it"
if(capitalized)
. = capitalize(.)
/datum/proc/p_have(temp_gender)
. = "has"
/datum/proc/p_are(temp_gender)
. = "is"
/datum/proc/p_were(temp_gender)
. = "was"
/datum/proc/p_do(temp_gender)
. = "does"
/datum/proc/p_theyve(capitalized, temp_gender)
. = p_they(capitalized, temp_gender) + "'" + copytext_char(p_have(temp_gender), 3)
/datum/proc/p_theyre(capitalized, temp_gender)
. = p_they(capitalized, temp_gender) + "'" + copytext_char(p_are(temp_gender), 2)
/datum/proc/p_s(temp_gender) //is this a descriptive proc name, or what?
. = "s"
/datum/proc/p_es(temp_gender)
. = "es"
//like clients, which do have gender.
/client/p_they(capitalized, temp_gender)
if(!temp_gender)
temp_gender = gender
. = "they"
switch(temp_gender)
if(FEMALE)
. = "she"
if(MALE)
. = "he"
if(capitalized)
. = capitalize(.)
/client/p_their(capitalized, temp_gender)
if(!temp_gender)
temp_gender = gender
. = "their"
switch(temp_gender)
if(FEMALE)
. = "her"
if(MALE)
. = "his"
if(capitalized)
. = capitalize(.)
/client/p_them(capitalized, temp_gender)
if(!temp_gender)
temp_gender = gender
. = "them"
switch(temp_gender)
if(FEMALE)
. = "her"
if(MALE)
. = "him"
if(capitalized)
. = capitalize(.)
/client/p_have(temp_gender)
if(!temp_gender)
temp_gender = gender
. = "has"
if(temp_gender == PLURAL || temp_gender == NEUTER)
. = "have"
/client/p_are(temp_gender)
if(!temp_gender)
temp_gender = gender
. = "is"
if(temp_gender == PLURAL || temp_gender == NEUTER)
. = "are"
/client/p_were(temp_gender)
if(!temp_gender)
temp_gender = gender
. = "was"
if(temp_gender == PLURAL || temp_gender == NEUTER)
. = "were"
/client/p_do(temp_gender)
if(!temp_gender)
temp_gender = gender
. = "does"
if(temp_gender == PLURAL || temp_gender == NEUTER)
. = "do"
/client/p_s(temp_gender)
if(!temp_gender)
temp_gender = gender
if(temp_gender != PLURAL && temp_gender != NEUTER)
. = "s"
/client/p_es(temp_gender)
if(!temp_gender)
temp_gender = gender
if(temp_gender != PLURAL && temp_gender != NEUTER)
. = "es"
//mobs(and atoms but atoms don't really matter write your own proc overrides) also have gender!
/mob/p_they(capitalized, temp_gender)
if(!temp_gender)
temp_gender = gender
. = "it"
switch(temp_gender)
if(FEMALE)
. = "she"
if(MALE)
. = "he"
if(PLURAL)
. = "they"
if(capitalized)
. = capitalize(.)
/mob/p_their(capitalized, temp_gender)
if(!temp_gender)
temp_gender = gender
. = "its"
switch(temp_gender)
if(FEMALE)
. = "her"
if(MALE)
. = "his"
if(PLURAL)
. = "their"
if(capitalized)
. = capitalize(.)
/mob/p_them(capitalized, temp_gender)
if(!temp_gender)
temp_gender = gender
. = "it"
switch(temp_gender)
if(FEMALE)
. = "her"
if(MALE)
. = "him"
if(PLURAL)
. = "them"
if(capitalized)
. = capitalize(.)
/mob/p_have(temp_gender)
if(!temp_gender)
temp_gender = gender
. = "has"
if(temp_gender == PLURAL)
. = "have"
/mob/p_are(temp_gender)
if(!temp_gender)
temp_gender = gender
. = "is"
if(temp_gender == PLURAL)
. = "are"
/mob/p_were(temp_gender)
if(!temp_gender)
temp_gender = gender
. = "was"
if(temp_gender == PLURAL)
. = "were"
/mob/p_do(temp_gender)
if(!temp_gender)
temp_gender = gender
. = "does"
if(temp_gender == PLURAL)
. = "do"
/mob/p_s(temp_gender)
if(!temp_gender)
temp_gender = gender
if(temp_gender != PLURAL)
. = "s"
/mob/p_es(temp_gender)
if(!temp_gender)
temp_gender = gender
if(temp_gender != PLURAL)
. = "es"
//humans need special handling, because they can have their gender hidden
/mob/living/carbon/human/p_they(capitalized, temp_gender)
var/list/obscured = check_obscured_slots()
var/skipface = (wear_mask && (wear_mask.flags_inv & HIDEFACE)) || (head && (head.flags_inv & HIDEFACE))
if((ITEM_SLOT_ICLOTHING in obscured) && skipface)
temp_gender = PLURAL
return ..()
/mob/living/carbon/human/p_their(capitalized, temp_gender)
var/list/obscured = check_obscured_slots()
var/skipface = (wear_mask && (wear_mask.flags_inv & HIDEFACE)) || (head && (head.flags_inv & HIDEFACE))
if((ITEM_SLOT_ICLOTHING in obscured) && skipface)
temp_gender = PLURAL
return ..()
/mob/living/carbon/human/p_them(capitalized, temp_gender)
var/list/obscured = check_obscured_slots()
var/skipface = (wear_mask && (wear_mask.flags_inv & HIDEFACE)) || (head && (head.flags_inv & HIDEFACE))
if((ITEM_SLOT_ICLOTHING in obscured) && skipface)
temp_gender = PLURAL
return ..()
/mob/living/carbon/human/p_have(temp_gender)
var/list/obscured = check_obscured_slots()
var/skipface = (wear_mask && (wear_mask.flags_inv & HIDEFACE)) || (head && (head.flags_inv & HIDEFACE))
if((ITEM_SLOT_ICLOTHING in obscured) && skipface)
temp_gender = PLURAL
return ..()
/mob/living/carbon/human/p_are(temp_gender)
var/list/obscured = check_obscured_slots()
var/skipface = (wear_mask && (wear_mask.flags_inv & HIDEFACE)) || (head && (head.flags_inv & HIDEFACE))
if((ITEM_SLOT_ICLOTHING in obscured) && skipface)
temp_gender = PLURAL
return ..()
/mob/living/carbon/human/p_were(temp_gender)
var/list/obscured = check_obscured_slots()
var/skipface = (wear_mask && (wear_mask.flags_inv & HIDEFACE)) || (head && (head.flags_inv & HIDEFACE))
if((ITEM_SLOT_ICLOTHING in obscured) && skipface)
temp_gender = PLURAL
return ..()
/mob/living/carbon/human/p_do(temp_gender)
var/list/obscured = check_obscured_slots()
var/skipface = (wear_mask && (wear_mask.flags_inv & HIDEFACE)) || (head && (head.flags_inv & HIDEFACE))
if((ITEM_SLOT_ICLOTHING in obscured) && skipface)
temp_gender = PLURAL
return ..()
/mob/living/carbon/human/p_s(temp_gender)
var/list/obscured = check_obscured_slots()
var/skipface = (wear_mask && (wear_mask.flags_inv & HIDEFACE)) || (head && (head.flags_inv & HIDEFACE))
if((ITEM_SLOT_ICLOTHING in obscured) && skipface)
temp_gender = PLURAL
return ..()
/mob/living/carbon/human/p_es(temp_gender)
var/list/obscured = check_obscured_slots()
var/skipface = (wear_mask && (wear_mask.flags_inv & HIDEFACE)) || (head && (head.flags_inv & HIDEFACE))
if((ITEM_SLOT_ICLOTHING in obscured) && skipface)
temp_gender = PLURAL
return ..()