From bb85ef62b4cf81b022f514d97401366537b4f651 Mon Sep 17 00:00:00 2001 From: GinjaNinja32 Date: Wed, 15 Jul 2015 20:04:33 +0100 Subject: [PATCH] Changes gender-based words to use a datum list instead of switches. --- baystation12.dme | 1 + code/modules/mob/gender.dm | 56 ++++++ .../mob/living/carbon/human/examine.dm | 161 ++++++++---------- 3 files changed, 130 insertions(+), 88 deletions(-) create mode 100644 code/modules/mob/gender.dm diff --git a/baystation12.dme b/baystation12.dme index a8ccf1fbb95..6b491d34653 100644 --- a/baystation12.dme +++ b/baystation12.dme @@ -1112,6 +1112,7 @@ #include "code\modules\mob\animations.dm" #include "code\modules\mob\death.dm" #include "code\modules\mob\emote.dm" +#include "code\modules\mob\gender.dm" #include "code\modules\mob\hear_say.dm" #include "code\modules\mob\holder.dm" #include "code\modules\mob\inventory.dm" diff --git a/code/modules/mob/gender.dm b/code/modules/mob/gender.dm new file mode 100644 index 00000000000..393e0fb6c2b --- /dev/null +++ b/code/modules/mob/gender.dm @@ -0,0 +1,56 @@ + +/var/list/gender_datums = list() + +/hook/startup/proc/populate_gender_datum_list() + for(var/type in typesof(/datum/gender)) + var/datum/gender/G = new type + gender_datums[G.key] = G + return 1 + +/datum/gender + var/key = "plural" + + var/He = "They" + var/he = "they" + var/His = "Their" + var/his = "their" + var/him = "them" + var/has = "have" + var/is = "are" + var/does = "do" + +/datum/gender/male + key = "male" + + He = "He" + he = "he" + His = "His" + his = "his" + him = "him" + has = "has" + is = "is" + does = "does" + +/datum/gender/female + key = "female" + + He = "She" + he = "she" + His = "Her" + his = "her" + him = "her" + has = "has" + is = "is" + does = "does" + +/datum/gender/neuter + key = "neuter" + + He = "It" + he = "it" + His = "Its" + his = "its" + him = "it" + has = "has" + is = "is" + does = "does" diff --git a/code/modules/mob/living/carbon/human/examine.dm b/code/modules/mob/living/carbon/human/examine.dm index 70c1025b1ea..dfb0044803a 100644 --- a/code/modules/mob/living/carbon/human/examine.dm +++ b/code/modules/mob/living/carbon/human/examine.dm @@ -24,33 +24,18 @@ if(wear_mask) skipface |= wear_mask.flags_inv & HIDEFACE - // crappy hacks because you can't do \his[src] etc. I'm sorry this proc is so unreadable, blame the text macros :< - var/t_He = "It" //capitalised for use at the start of each line. - var/t_his = "its" - var/t_him = "it" - var/t_has = "has" - var/t_is = "is" - var/msg = "*---------*\nThis is " - if( skipjumpsuit && skipface ) //big suits/masks/helmets make it hard to tell their gender - t_He = "They" - t_his = "their" - t_him = "them" - t_has = "have" - t_is = "are" + var/datum/gender/T = gender_datums[gender] + if(skipjumpsuit && skipface) //big suits/masks/helmets make it hard to tell their gender + T = gender_datums[PLURAL] else if(icon) msg += "\icon[icon] " //fucking BYOND: this should stop dreamseeker crashing if we -somehow- examine somebody before their icon is generated - switch(gender) - if(MALE) - t_He = "He" - t_his = "his" - t_him = "him" - if(FEMALE) - t_He = "She" - t_his = "her" - t_him = "her" + + if(!T) + // Just in case someone VVs the gender to something strange. It'll runtime anyway when it hits usages, better to CRASH() now with a helpful message. + CRASH("Gender datum was null; key was '[(skipjumpsuit && skipface) ? PLURAL : gender]'") msg += "[src.name]" if(species.name != "Human") @@ -67,111 +52,111 @@ tie_msg += ". Attached to it is [lowertext(english_list(U.accessories))]" if(w_uniform.blood_DNA) - msg += "[t_He] [t_is] wearing \icon[w_uniform] [w_uniform.gender==PLURAL?"some":"a"] [(w_uniform.blood_color != "#030303") ? "blood" : "oil"]-stained [w_uniform.name][tie_msg]!\n" + msg += "[T.He] [T.is] wearing \icon[w_uniform] [w_uniform.gender==PLURAL?"some":"a"] [(w_uniform.blood_color != "#030303") ? "blood" : "oil"]-stained [w_uniform.name][tie_msg]!\n" else - msg += "[t_He] [t_is] wearing \icon[w_uniform] \a [w_uniform][tie_msg].\n" + msg += "[T.He] [T.is] wearing \icon[w_uniform] \a [w_uniform][tie_msg].\n" //head if(head) if(head.blood_DNA) - msg += "[t_He] [t_is] wearing \icon[head] [head.gender==PLURAL?"some":"a"] [(head.blood_color != "#030303") ? "blood" : "oil"]-stained [head.name] on [t_his] head!\n" + msg += "[T.He] [T.is] wearing \icon[head] [head.gender==PLURAL?"some":"a"] [(head.blood_color != "#030303") ? "blood" : "oil"]-stained [head.name] on [T.his] head!\n" else - msg += "[t_He] [t_is] wearing \icon[head] \a [head] on [t_his] head.\n" + msg += "[T.He] [T.is] wearing \icon[head] \a [head] on [T.his] head.\n" //suit/armour if(wear_suit) if(wear_suit.blood_DNA) - msg += "[t_He] [t_is] wearing \icon[wear_suit] [wear_suit.gender==PLURAL?"some":"a"] [(wear_suit.blood_color != "#030303") ? "blood" : "oil"]-stained [wear_suit.name]!\n" + msg += "[T.He] [T.is] wearing \icon[wear_suit] [wear_suit.gender==PLURAL?"some":"a"] [(wear_suit.blood_color != "#030303") ? "blood" : "oil"]-stained [wear_suit.name]!\n" else - msg += "[t_He] [t_is] wearing \icon[wear_suit] \a [wear_suit].\n" + msg += "[T.He] [T.is] wearing \icon[wear_suit] \a [wear_suit].\n" //suit/armour storage if(s_store && !skipsuitstorage) if(s_store.blood_DNA) - msg += "[t_He] [t_is] carrying \icon[s_store] [s_store.gender==PLURAL?"some":"a"] [(s_store.blood_color != "#030303") ? "blood" : "oil"]-stained [s_store.name] on [t_his] [wear_suit.name]!\n" + msg += "[T.He] [T.is] carrying \icon[s_store] [s_store.gender==PLURAL?"some":"a"] [(s_store.blood_color != "#030303") ? "blood" : "oil"]-stained [s_store.name] on [T.his] [wear_suit.name]!\n" else - msg += "[t_He] [t_is] carrying \icon[s_store] \a [s_store] on [t_his] [wear_suit.name].\n" + msg += "[T.He] [T.is] carrying \icon[s_store] \a [s_store] on [T.his] [wear_suit.name].\n" //back if(back) if(back.blood_DNA) - msg += "[t_He] [t_has] \icon[back] [back.gender==PLURAL?"some":"a"] [(back.blood_color != "#030303") ? "blood" : "oil"]-stained [back] on [t_his] back.\n" + msg += "[T.He] [T.has] \icon[back] [back.gender==PLURAL?"some":"a"] [(back.blood_color != "#030303") ? "blood" : "oil"]-stained [back] on [T.his] back.\n" else - msg += "[t_He] [t_has] \icon[back] \a [back] on [t_his] back.\n" + msg += "[T.He] [T.has] \icon[back] \a [back] on [T.his] back.\n" //left hand if(l_hand) if(l_hand.blood_DNA) - msg += "[t_He] [t_is] holding \icon[l_hand] [l_hand.gender==PLURAL?"some":"a"] [(l_hand.blood_color != "#030303") ? "blood" : "oil"]-stained [l_hand.name] in [t_his] left hand!\n" + msg += "[T.He] [T.is] holding \icon[l_hand] [l_hand.gender==PLURAL?"some":"a"] [(l_hand.blood_color != "#030303") ? "blood" : "oil"]-stained [l_hand.name] in [T.his] left hand!\n" else - msg += "[t_He] [t_is] holding \icon[l_hand] \a [l_hand] in [t_his] left hand.\n" + msg += "[T.He] [T.is] holding \icon[l_hand] \a [l_hand] in [T.his] left hand.\n" //right hand if(r_hand) if(r_hand.blood_DNA) - msg += "[t_He] [t_is] holding \icon[r_hand] [r_hand.gender==PLURAL?"some":"a"] [(r_hand.blood_color != "#030303") ? "blood" : "oil"]-stained [r_hand.name] in [t_his] right hand!\n" + msg += "[T.He] [T.is] holding \icon[r_hand] [r_hand.gender==PLURAL?"some":"a"] [(r_hand.blood_color != "#030303") ? "blood" : "oil"]-stained [r_hand.name] in [T.his] right hand!\n" else - msg += "[t_He] [t_is] holding \icon[r_hand] \a [r_hand] in [t_his] right hand.\n" + msg += "[T.He] [T.is] holding \icon[r_hand] \a [r_hand] in [T.his] right hand.\n" //gloves if(gloves && !skipgloves) if(gloves.blood_DNA) - msg += "[t_He] [t_has] \icon[gloves] [gloves.gender==PLURAL?"some":"a"] [(gloves.blood_color != "#030303") ? "blood" : "oil"]-stained [gloves.name] on [t_his] hands!\n" + msg += "[T.He] [T.has] \icon[gloves] [gloves.gender==PLURAL?"some":"a"] [(gloves.blood_color != "#030303") ? "blood" : "oil"]-stained [gloves.name] on [T.his] hands!\n" else - msg += "[t_He] [t_has] \icon[gloves] \a [gloves] on [t_his] hands.\n" + msg += "[T.He] [T.has] \icon[gloves] \a [gloves] on [T.his] hands.\n" else if(blood_DNA) - msg += "[t_He] [t_has] [(hand_blood_color != "#030303") ? "blood" : "oil"]-stained hands!\n" + msg += "[T.He] [T.has] [(hand_blood_color != "#030303") ? "blood" : "oil"]-stained hands!\n" //handcuffed? //handcuffed? if(handcuffed) if(istype(handcuffed, /obj/item/weapon/handcuffs/cable)) - msg += "[t_He] [t_is] \icon[handcuffed] restrained with cable!\n" + msg += "[T.He] [T.is] \icon[handcuffed] restrained with cable!\n" else - msg += "[t_He] [t_is] \icon[handcuffed] handcuffed!\n" + msg += "[T.He] [T.is] \icon[handcuffed] handcuffed!\n" //buckled if(buckled) - msg += "[t_He] [t_is] \icon[buckled] buckled to [buckled]!\n" + msg += "[T.He] [T.is] \icon[buckled] buckled to [buckled]!\n" //belt if(belt) if(belt.blood_DNA) - msg += "[t_He] [t_has] \icon[belt] [belt.gender==PLURAL?"some":"a"] [(belt.blood_color != "#030303") ? "blood" : "oil"]-stained [belt.name] about [t_his] waist!\n" + msg += "[T.He] [T.has] \icon[belt] [belt.gender==PLURAL?"some":"a"] [(belt.blood_color != "#030303") ? "blood" : "oil"]-stained [belt.name] about [T.his] waist!\n" else - msg += "[t_He] [t_has] \icon[belt] \a [belt] about [t_his] waist.\n" + msg += "[T.He] [T.has] \icon[belt] \a [belt] about [T.his] waist.\n" //shoes if(shoes && !skipshoes) if(shoes.blood_DNA) - msg += "[t_He] [t_is] wearing \icon[shoes] [shoes.gender==PLURAL?"some":"a"] [(shoes.blood_color != "#030303") ? "blood" : "oil"]-stained [shoes.name] on [t_his] feet!\n" + msg += "[T.He] [T.is] wearing \icon[shoes] [shoes.gender==PLURAL?"some":"a"] [(shoes.blood_color != "#030303") ? "blood" : "oil"]-stained [shoes.name] on [T.his] feet!\n" else - msg += "[t_He] [t_is] wearing \icon[shoes] \a [shoes] on [t_his] feet.\n" + msg += "[T.He] [T.is] wearing \icon[shoes] \a [shoes] on [T.his] feet.\n" else if(feet_blood_DNA) - msg += "[t_He] [t_has] [(feet_blood_color != "#030303") ? "blood" : "oil"]-stained feet!\n" + msg += "[T.He] [T.has] [(feet_blood_color != "#030303") ? "blood" : "oil"]-stained feet!\n" //mask if(wear_mask && !skipmask) if(wear_mask.blood_DNA) - msg += "[t_He] [t_has] \icon[wear_mask] [wear_mask.gender==PLURAL?"some":"a"] [(wear_mask.blood_color != "#030303") ? "blood" : "oil"]-stained [wear_mask.name] on [t_his] face!\n" + msg += "[T.He] [T.has] \icon[wear_mask] [wear_mask.gender==PLURAL?"some":"a"] [(wear_mask.blood_color != "#030303") ? "blood" : "oil"]-stained [wear_mask.name] on [T.his] face!\n" else - msg += "[t_He] [t_has] \icon[wear_mask] \a [wear_mask] on [t_his] face.\n" + msg += "[T.He] [T.has] \icon[wear_mask] \a [wear_mask] on [T.his] face.\n" //eyes if(glasses && !skipeyes) if(glasses.blood_DNA) - msg += "[t_He] [t_has] \icon[glasses] [glasses.gender==PLURAL?"some":"a"] [(glasses.blood_color != "#030303") ? "blood" : "oil"]-stained [glasses] covering [t_his] eyes!\n" + msg += "[T.He] [T.has] \icon[glasses] [glasses.gender==PLURAL?"some":"a"] [(glasses.blood_color != "#030303") ? "blood" : "oil"]-stained [glasses] covering [T.his] eyes!\n" else - msg += "[t_He] [t_has] \icon[glasses] \a [glasses] covering [t_his] eyes.\n" + msg += "[T.He] [T.has] \icon[glasses] \a [glasses] covering [T.his] eyes.\n" //left ear if(l_ear && !skipears) - msg += "[t_He] [t_has] \icon[l_ear] \a [l_ear] on [t_his] left ear.\n" + msg += "[T.He] [T.has] \icon[l_ear] \a [l_ear] on [T.his] left ear.\n" //right ear if(r_ear && !skipears) - msg += "[t_He] [t_has] \icon[r_ear] \a [r_ear] on [t_his] right ear.\n" + msg += "[T.He] [T.has] \icon[r_ear] \a [r_ear] on [T.his] right ear.\n" //ID if(wear_id) @@ -183,70 +168,70 @@ var/obj/item/weapon/card/id/idcard = wear_id id = idcard.registered_name if(id && (id != real_name) && (get_dist(src, usr) <= 1) && prob(10)) - msg += "[t_He] [t_is] wearing \icon[wear_id] \a [wear_id] yet something doesn't seem right...\n" + msg += "[T.He] [T.is] wearing \icon[wear_id] \a [wear_id] yet something doesn't seem right...\n" else*/ - msg += "[t_He] [t_is] wearing \icon[wear_id] \a [wear_id].\n" + msg += "[T.He] [T.is] wearing \icon[wear_id] \a [wear_id].\n" //Jitters if(is_jittery) if(jitteriness >= 300) - msg += "[t_He] [t_is] convulsing violently!\n" + msg += "[T.He] [T.is] convulsing violently!\n" else if(jitteriness >= 200) - msg += "[t_He] [t_is] extremely jittery.\n" + msg += "[T.He] [T.is] extremely jittery.\n" else if(jitteriness >= 100) - msg += "[t_He] [t_is] twitching ever so slightly.\n" + msg += "[T.He] [T.is] twitching ever so slightly.\n" //splints for(var/organ in list("l_leg","r_leg","l_arm","r_arm")) var/obj/item/organ/external/o = get_organ(organ) if(o && o.status & ORGAN_SPLINTED) - msg += "[t_He] [t_has] a splint on [t_his] [o.name]!\n" + msg += "[T.He] [T.has] a splint on [T.his] [o.name]!\n" if(suiciding) - msg += "[t_He] appears to have commited suicide... there is no hope of recovery.\n" + msg += "[T.He] appears to have commited suicide... there is no hope of recovery.\n" if(mSmallsize in mutations) - msg += "[t_He] [t_is] small halfling!\n" + msg += "[T.He] [T.is] small halfling!\n" var/distance = get_dist(usr,src) if(istype(usr, /mob/dead/observer) || usr.stat == 2) // ghosts can see anything distance = 1 if (src.stat) - msg += "[t_He] [t_is]n't responding to anything around [t_him] and seems to be asleep.\n" + msg += "[T.He] [T.is]n't responding to anything around [T.him] and seems to be asleep.\n" if((stat == 2 || src.losebreath) && distance <= 3) - msg += "[t_He] does not appear to be breathing.\n" + msg += "[T.He] does not appear to be breathing.\n" if(istype(usr, /mob/living/carbon/human) && !usr.stat && Adjacent(usr)) usr.visible_message("[usr] checks [src]'s pulse.", "You check [src]'s pulse.") spawn(15) if(distance <= 1 && usr.stat != 1) if(pulse == PULSE_NONE) - usr << "[t_He] has no pulse[src.client ? "" : " and [t_his] soul has departed"]..." + usr << "[T.He] [T.has] no pulse[src.client ? "" : " and [T.his] soul has departed"]..." else - usr << "[t_He] has a pulse!" + usr << "[T.He] [T.has] a pulse!" if(fire_stacks) - msg += "[t_He] [t_is] covered in some liquid.\n" + msg += "[T.He] [T.is] covered in some liquid.\n" if(on_fire) - msg += "[t_He] [t_is] on fire!.\n" + msg += "[T.He] [T.is] on fire!.\n" msg += "" if(nutrition < 100) - msg += "[t_He] [t_is] severely malnourished.\n" + msg += "[T.He] [T.is] severely malnourished.\n" else if(nutrition >= 500) /*if(usr.nutrition < 100) - msg += "[t_He] [t_is] plump and delicious looking - Like a fat little piggy. A tasty piggy.\n" + msg += "[T.He] [T.is] plump and delicious looking - Like a fat little piggy. A tasty piggy.\n" else*/ - msg += "[t_He] [t_is] quite chubby.\n" + msg += "[T.He] [T.is] quite chubby.\n" msg += "" if(getBrainLoss() >= 60) - msg += "[t_He] [t_has] a stupid expression on [t_his] face.\n" + msg += "[T.He] [T.has] a stupid expression on [T.his] face.\n" if(species.show_ssd && (!species.has_organ["brain"] || has_brain()) && stat != DEAD) if(!key) - msg += "[t_He] [t_is] [species.show_ssd]. It doesn't look like they are waking up anytime soon.\n" + msg += "[T.He] [T.is] [species.show_ssd]. It doesn't look like they are waking up anytime soon.\n" else if(!client) - msg += "[t_He] [t_is] [species.show_ssd].\n" + msg += "[T.He] [T.is] [species.show_ssd].\n" var/list/wound_flavor_text = list() var/list/is_destroyed = list() @@ -260,9 +245,9 @@ var/obj/item/organ/external/E = organs_by_name[organ_tag] if(!E) - wound_flavor_text["[organ_descriptor]"] = "[t_He] is missing [t_his] [organ_descriptor].\n" + wound_flavor_text["[organ_descriptor]"] = "[T.He] [T.is] missing [T.his] [organ_descriptor].\n" else if(E.is_stump()) - wound_flavor_text["[organ_descriptor]"] = "[t_He] has a stump where [t_his] [organ_descriptor] should be.\n" + wound_flavor_text["[organ_descriptor]"] = "[T.He] [T.has] a stump where [T.his] [organ_descriptor] should be.\n" else is_destroyed["organ_descriptor"] = 0 continue @@ -271,20 +256,20 @@ if(temp) if(temp.status & ORGAN_ROBOT) if(!(temp.brute_dam + temp.burn_dam)) - wound_flavor_text["[temp.name]"] = "[t_He] has a robot [temp.name]!\n" + wound_flavor_text["[temp.name]"] = "[T.He] [T.has] a robot [temp.name]!\n" continue else - wound_flavor_text["[temp.name]"] = "[t_He] has a robot [temp.name]. It has[temp.get_wounds_desc()]!\n" + wound_flavor_text["[temp.name]"] = "[T.He] [T.has] a robot [temp.name]. It has[temp.get_wounds_desc()]!\n" else if(temp.wounds.len > 0 || temp.open) - wound_flavor_text["[temp.name]"] = "[t_He] has [temp.get_wounds_desc()] on [t_his] [temp.name].
" + wound_flavor_text["[temp.name]"] = "[T.He] [T.has] [temp.get_wounds_desc()] on [T.his] [temp.name].
" if(temp.status & ORGAN_BLEEDING) - is_bleeding["[temp.name]"] = "[capitalize(t_his)] [temp.name] is bleeding!
" + is_bleeding["[temp.name]"] = "[T.His] [temp.name] is bleeding!
" else wound_flavor_text["[temp.name]"] = "" if(temp.dislocated == 2) - wound_flavor_text["[temp.name]"] += "[capitalize(t_his)] [temp.joint] is dislocated!
" + wound_flavor_text["[temp.name]"] += "[T.His] [temp.joint] is dislocated!
" if(((temp.status & ORGAN_BROKEN) && temp.brute_dam > temp.min_broken_damage) || (temp.status & ORGAN_MUTATED)) - wound_flavor_text["[temp.name]"] += "[capitalize(t_his)] [temp.name] is dented and swollen!
" + wound_flavor_text["[temp.name]"] += "[T.His] [temp.name] is dented and swollen!
" //Handles the text strings being added to the actual description. //If they have something that covers the limb, and it is not missing, put flavortext. If it is covered but bleeding, add other flavortext. @@ -301,7 +286,7 @@ if(wound_flavor_text["head"] && (is_destroyed["head"] || (!skipmask && !(wear_mask && istype(wear_mask, /obj/item/clothing/mask/gas))))) msg += wound_flavor_text["head"] else if(is_bleeding["head"]) - msg += "[src] has blood running down [t_his] face!\n" + msg += "[src] [T.has] blood running down [T.his] face!\n" if(wound_flavor_text["upper body"] && !w_uniform && !skipjumpsuit) //No need. A missing chest gibs you. msg += wound_flavor_text["upper body"] @@ -352,11 +337,11 @@ display_shoes = 1 if(display_chest) - msg += "[src] has blood soaking through from under [t_his] clothing!\n" + msg += "[src] [T.has] blood soaking through from under [T.his] clothing!\n" if(display_shoes) - msg += "[src] has blood running from [t_his] shoes!\n" + msg += "[src] [T.has] blood running from [T.his] shoes!\n" if(display_gloves) - msg += "[src] has blood running from under [t_his] gloves!\n" + msg += "[src] [T.has] blood running from under [T.his] gloves!\n" */ for(var/limb in wound_flavor_text) @@ -365,9 +350,9 @@ for(var/limb in is_bleeding) msg += is_bleeding[limb] for(var/implant in get_visible_implants(0)) - msg += "[src] has \a [implant] sticking out of [t_his] flesh!\n" + msg += "[src] [T.has] \a [implant] sticking out of [T.his] flesh!\n" if(digitalcamo) - msg += "[t_He] [t_is] repulsively uncanny!\n" + msg += "[T.He] [T.is] repulsively uncanny!\n" if(hasHUD(usr,"security")) var/perpname = "wot" @@ -421,7 +406,7 @@ if (pose) if( findtext(pose,".",lentext(pose)) == 0 && findtext(pose,"!",lentext(pose)) == 0 && findtext(pose,"?",lentext(pose)) == 0 ) pose = addtext(pose,".") //Makes sure all emotes end with a period. - msg += "\n[t_He] is [pose]" + msg += "\n[T.He] is [pose]" user << msg