Merge pull request #5161 from Atermonera/refactor_human_examine

Refactors human/examine.dm
This commit is contained in:
Anewbe
2018-04-19 18:39:00 -05:00
committed by GitHub
3 changed files with 218 additions and 226 deletions

View File

@@ -306,3 +306,28 @@
//Some mob icon layering defines //Some mob icon layering defines
#define BODY_LAYER -100 #define BODY_LAYER -100
// Clothing flags, organized in roughly top-bottom
#define EXAMINE_SKIPHELMET 0x0001
#define EXAMINE_SKIPEARS 0x0002
#define EXAMINE_SKIPEYEWEAR 0x0004
#define EXAMINE_SKIPMASK 0x0008
#define EXAMINE_SKIPJUMPSUIT 0x0010
#define EXAMINE_SKIPTIE 0x0020
#define EXAMINE_SKIPHOLSTER 0x0040
#define EXAMINE_SKIPSUITSTORAGE 0x0080
#define EXAMINE_SKIPBACKPACK 0x0100
#define EXAMINE_SKIPGLOVES 0x0200
#define EXAMINE_SKIPBELT 0x0400
#define EXAMINE_SKIPSHOES 0x0800
// Body flags
#define EXAMINE_SKIPHEAD 0x0001
#define EXAMINE_SKIPEYES 0x0002
#define EXAMINE_SKIPFACE 0x0004
#define EXAMINE_SKIPBODY 0x0008
#define EXAMINE_SKIPGROIN 0x0010
#define EXAMINE_SKIPARMS 0x0020
#define EXAMINE_SKIPHANDS 0x0040
#define EXAMINE_SKIPLEGS 0x0080
#define EXAMINE_SKIPFEET 0x0100

View File

@@ -1,22 +1,6 @@
/mob/living/carbon/human/examine(mob/user) /mob/living/carbon/human/examine(mob/user)
var/skip_gear = 0
var/skipgloves = 0 var/skip_body = 0
var/skipsuitstorage = 0
var/skipjumpsuit = 0
var/skipshoes = 0
var/skipmask = 0
var/skiptie = 0
var/skipholster = 0
var/skipears = 0
var/skipeyes = 0
var/skipface = 0
var/skipchest = 0
var/skipgroin = 0
var/skiphands = 0
var/skiplegs = 0
var/skiparms = 0
var/skipfeet = 0
if(alpha <= 50) if(alpha <= 50)
src.loc.examine(user) src.loc.examine(user)
@@ -26,94 +10,96 @@
//exosuits and helmets obscure our view and stuff. //exosuits and helmets obscure our view and stuff.
if(wear_suit) if(wear_suit)
skipsuitstorage |= wear_suit.flags_inv & HIDESUITSTORAGE if(wear_suit.flags_inv & HIDESUITSTORAGE)
skip_gear |= EXAMINE_SKIPSUITSTORAGE
if(wear_suit.flags_inv & HIDEJUMPSUIT) if(wear_suit.flags_inv & HIDEJUMPSUIT)
skiparms |= 1 skip_body |= EXAMINE_SKIPARMS | EXAMINE_SKIPLEGS | EXAMINE_SKIPBODY | EXAMINE_SKIPGROIN
skiplegs |= 1 skip_gear |= EXAMINE_SKIPJUMPSUIT | EXAMINE_SKIPTIE | EXAMINE_SKIPHOLSTER
skipchest |= 1
skipgroin |= 1
skipjumpsuit |= 1
skiptie |= 1
skipholster |= 1
else if(wear_suit.flags_inv & HIDETIE) else if(wear_suit.flags_inv & HIDETIE)
skiptie |= 1 skip_gear |= EXAMINE_SKIPTIE | EXAMINE_SKIPHOLSTER
skipholster |= 1
else if(wear_suit.flags_inv & HIDEHOLSTER) else if(wear_suit.flags_inv & HIDEHOLSTER)
skipholster |= 1 skip_gear |= EXAMINE_SKIPHOLSTER
if(wear_suit.flags_inv & HIDESHOES) if(wear_suit.flags_inv & HIDESHOES)
skipshoes |= 1 skip_gear |= EXAMINE_SKIPSHOES
skipfeet |= 1 skip_body |= EXAMINE_SKIPFEET
if(wear_suit.flags_inv & HIDEGLOVES) if(wear_suit.flags_inv & HIDEGLOVES)
skipgloves |= 1 skip_gear |= EXAMINE_SKIPGLOVES
skiphands |= 1 skip_body |= EXAMINE_SKIPHANDS
if(w_uniform) if(w_uniform)
skiplegs |= w_uniform.body_parts_covered & LEGS if(w_uniform.body_parts_covered & LEGS)
skiparms |= w_uniform.body_parts_covered & ARMS skip_body |= EXAMINE_SKIPLEGS
skipchest |= w_uniform.body_parts_covered & UPPER_TORSO if(w_uniform.body_parts_covered & ARMS)
skipgroin |= w_uniform.body_parts_covered & LOWER_TORSO skip_body |= EXAMINE_SKIPARMS
if(w_uniform.body_parts_covered & UPPER_TORSO)
skip_body |= EXAMINE_SKIPBODY
if(w_uniform.body_parts_covered & LOWER_TORSO)
skip_body |= EXAMINE_SKIPGROIN
if(gloves) if(gloves && (gloves.body_parts_covered & HANDS))
skiphands |= gloves.body_parts_covered & HANDS skip_body |= EXAMINE_SKIPHANDS
if(shoes) if(shoes && (shoes.body_parts_covered & FEET))
skipfeet |= shoes.body_parts_covered & FEET skip_body |= EXAMINE_SKIPFEET
if(head) if(head)
skipmask |= head.flags_inv & HIDEMASK if(head.flags_inv & HIDEMASK)
skipeyes |= head.flags_inv & HIDEEYES skip_gear |= EXAMINE_SKIPMASK
skipears |= head.flags_inv & HIDEEARS if(head.flags_inv & HIDEEYES)
skipface |= head.flags_inv & HIDEFACE skip_gear |= EXAMINE_SKIPEYEWEAR
skip_body |= EXAMINE_SKIPEYES
if(head.flags_inv & HIDEEARS)
skip_gear |= EXAMINE_SKIPEARS
if(head.flags_inv & HIDEFACE)
skip_body |= EXAMINE_SKIPFACE
if(wear_mask) if(wear_mask && (wear_mask.flags_inv & HIDEFACE))
skipface |= wear_mask.flags_inv & HIDEFACE skip_body |= EXAMINE_SKIPFACE
//This is what hides what //This is what hides what
var/list/hidden = list( var/list/hidden = list(
BP_GROIN = skipgroin, BP_GROIN = skip_body & EXAMINE_SKIPGROIN,
BP_TORSO = skipchest, BP_TORSO = skip_body & EXAMINE_SKIPBODY,
BP_HEAD = skipface, BP_HEAD = skip_body & EXAMINE_SKIPHEAD,
BP_L_ARM = skiparms, BP_L_ARM = skip_body & EXAMINE_SKIPARMS,
BP_R_ARM = skiparms, BP_R_ARM = skip_body & EXAMINE_SKIPARMS,
BP_L_HAND= skiphands, BP_L_HAND= skip_body & EXAMINE_SKIPHANDS,
BP_R_HAND= skiphands, BP_R_HAND= skip_body & EXAMINE_SKIPHANDS,
BP_L_FOOT= skipfeet, BP_L_FOOT= skip_body & EXAMINE_SKIPFEET,
BP_R_FOOT= skipfeet, BP_R_FOOT= skip_body & EXAMINE_SKIPFEET,
BP_L_LEG = skiplegs, BP_L_LEG = skip_body & EXAMINE_SKIPLEGS,
BP_R_LEG = skiplegs) BP_R_LEG = skip_body & EXAMINE_SKIPLEGS)
var/list/msg = list("<span class='info'>*---------*\nThis is ") var/list/msg = list("<span class='info'>*---------*<br>This is ")
if(icon)
var/datum/gender/T = gender_datums[get_visible_gender()] msg += "\icon[icon] " //fucking BYOND: this should stop dreamseeker crashing if we -somehow- examine somebody before their icon is generated
if(skipjumpsuit && skipface) //big suits/masks/helmets make it hard to tell their gender
T = gender_datums[PLURAL]
else if(species && species.ambiguous_genders)
var/can_detect_gender = FALSE
if(isobserver(user)) // Ghosts are all knowing.
can_detect_gender = TRUE
if(issilicon(user)) // Borgs are too because science.
can_detect_gender = TRUE
else if(ishuman(user))
var/mob/living/carbon/human/H = user
if(H.species && istype(species, H.species))
can_detect_gender = TRUE
if(!can_detect_gender)
T = gender_datums[PLURAL] // Species with ambiguous_genders will not show their true gender upon examine if the examiner is not also the same species.
else
if(icon)
msg += "\icon[icon] " //fucking BYOND: this should stop dreamseeker crashing if we -somehow- examine somebody before their icon is generated
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 += "<EM>[src.name]</EM>" msg += "<EM>[src.name]</EM>"
if(!(skipjumpsuit && skipface)) var/datum/gender/T = gender_datums[get_visible_gender()]
if((skip_gear & EXAMINE_SKIPJUMPSUIT) && (skip_body & EXAMINE_SKIPFACE)) //big suits/masks/helmets make it hard to tell their gender
T = gender_datums[PLURAL]
else if(species && species.ambiguous_genders)
if(ishuman(user))
var/mob/living/carbon/human/H = user
if(H.species && !istype(species, H.species))
T = gender_datums[PLURAL]// Species with ambiguous_genders will not show their true gender upon examine if the examiner is not also the same species.
if(!(issilicon(user) || isobserver(user))) // Ghosts and borgs are all knowing
T = gender_datums[PLURAL]
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 '[((skip_gear & EXAMINE_SKIPJUMPSUIT) && (skip_body & EXAMINE_SKIPFACE)) ? PLURAL : gender]'")
if(!((skip_gear & EXAMINE_SKIPJUMPSUIT) && (skip_body & EXAMINE_SKIPFACE)))
if(looks_synth) if(looks_synth)
var/use_gender = "a synthetic" var/use_gender = "a synthetic"
if(gender == MALE) if(gender == MALE)
@@ -128,37 +114,41 @@
var/extra_species_text = species.get_additional_examine_text(src) var/extra_species_text = species.get_additional_examine_text(src)
if(extra_species_text) if(extra_species_text)
msg += "[extra_species_text]<br>" msg += "[extra_species_text]"
msg += "<br>" msg += "<br>"
//uniform //uniform
if(w_uniform && !skipjumpsuit && w_uniform.show_examine) if(w_uniform && !(skip_gear & EXAMINE_SKIPJUMPSUIT) && w_uniform.show_examine)
//Ties //Ties
var/tie_msg var/tie_msg
if(istype(w_uniform,/obj/item/clothing/under) && !skiptie) if(istype(w_uniform,/obj/item/clothing/under) && !(skip_gear & EXAMINE_SKIPTIE))
var/obj/item/clothing/under/U = w_uniform var/obj/item/clothing/under/U = w_uniform
if(U.accessories.len) if(U.accessories.len)
if(skipholster) var/list/accessories_visible = list() //please let this fix the stupid fucking runtimes
var/list/accessories_visible = new/list() //please let this fix the stupid fucking runtimes if(skip_gear & EXAMINE_SKIPHOLSTER)
for(var/obj/item/clothing/accessory/A in U.accessories)
if(A.show_examine && !istype(A, /obj/item/clothing/accessory/holster)) // If we're supposed to skip holsters, actually skip them
accessories_visible.Add(A)
else
for(var/obj/item/clothing/accessory/A in U.accessories) for(var/obj/item/clothing/accessory/A in U.accessories)
if(A.concealed_holster == 0 && A.show_examine) if(A.concealed_holster == 0 && A.show_examine)
accessories_visible.Add(A) accessories_visible.Add(A)
if(accessories_visible.len)
tie_msg += ". Attached to it is [english_list(accessories_visible)]" if(accessories_visible.len)
else tie_msg += ". Attached to it is [english_list(U.accessories)]" tie_msg += " Attached to it is [english_list(accessories_visible)]."
if(w_uniform.blood_DNA) if(w_uniform.blood_DNA)
msg += "<span class='warning'>[T.He] [T.is] wearing \icon[w_uniform] [w_uniform.gender==PLURAL?"some":"a"] [(w_uniform.blood_color != SYNTH_BLOOD_COLOUR) ? "blood" : "oil"]-stained [w_uniform.name][tie_msg]!</span>\n" msg += "<span class='warning'>[T.He] [T.is] wearing \icon[w_uniform] [w_uniform.gender==PLURAL?"some":"a"] [(w_uniform.blood_color != SYNTH_BLOOD_COLOUR) ? "blood" : "oil"]-stained [w_uniform.name]![tie_msg]</span><br>"
else 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].<br>"
//head //head
if(head && head.show_examine) if(head && !(skip_gear & EXAMINE_SKIPHELMET) && head.show_examine)
if(head.blood_DNA) if(head.blood_DNA)
msg += "<span class='warning'>[T.He] [T.is] wearing \icon[head] [head.gender==PLURAL?"some":"a"] [(head.blood_color != SYNTH_BLOOD_COLOUR) ? "blood" : "oil"]-stained [head.name] on [T.his] head!</span>\n" msg += "<span class='warning'>[T.He] [T.is] wearing \icon[head] [head.gender==PLURAL?"some":"a"] [(head.blood_color != SYNTH_BLOOD_COLOUR) ? "blood" : "oil"]-stained [head.name] on [T.his] head!</span><br>"
else 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.<br>"
//suit/armour //suit/armour
if(wear_suit) if(wear_suit)
@@ -166,102 +156,102 @@
if(istype(wear_suit,/obj/item/clothing/suit)) if(istype(wear_suit,/obj/item/clothing/suit))
var/obj/item/clothing/suit/U = wear_suit var/obj/item/clothing/suit/U = wear_suit
if(U.accessories.len) if(U.accessories.len)
tie_msg += ". Attached to it is [english_list(U.accessories)]" tie_msg += " Attached to it is [english_list(U.accessories)]."
if(wear_suit.blood_DNA) if(wear_suit.blood_DNA)
msg += "<span class='warning'>[T.He] [T.is] wearing \icon[wear_suit] [wear_suit.gender==PLURAL?"some":"a"] [(wear_suit.blood_color != SYNTH_BLOOD_COLOUR) ? "blood" : "oil"]-stained [wear_suit.name]!</span>\n" msg += "<span class='warning'>[T.He] [T.is] wearing \icon[wear_suit] [wear_suit.gender==PLURAL?"some":"a"] [(wear_suit.blood_color != SYNTH_BLOOD_COLOUR) ? "blood" : "oil"]-stained [wear_suit.name][tie_msg]!</span><br>"
else else
msg += "[T.He] [T.is] wearing \icon[wear_suit] \a [wear_suit][tie_msg].\n" msg += "[T.He] [T.is] wearing \icon[wear_suit] \a [wear_suit].[tie_msg]<br>"
//suit/armour storage //suit/armour storage
if(s_store && !skipsuitstorage && s_store.show_examine) if(s_store && !(skip_gear & EXAMINE_SKIPSUITSTORAGE) && s_store.show_examine)
if(s_store.blood_DNA) if(s_store.blood_DNA)
msg += "<span class='warning'>[T.He] [T.is] carrying \icon[s_store] [s_store.gender==PLURAL?"some":"a"] [(s_store.blood_color != SYNTH_BLOOD_COLOUR) ? "blood" : "oil"]-stained [s_store.name] on [T.his] [wear_suit.name]!</span>\n" msg += "<span class='warning'>[T.He] [T.is] carrying \icon[s_store] [s_store.gender==PLURAL?"some":"a"] [(s_store.blood_color != SYNTH_BLOOD_COLOUR) ? "blood" : "oil"]-stained [s_store.name] on [T.his] [wear_suit.name]!</span><br>"
else 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].<br>"
//back //back
if(back && back.show_examine) if(back && !(skip_gear & EXAMINE_SKIPBACKPACK) && back.show_examine)
if(back.blood_DNA) if(back.blood_DNA)
msg += "<span class='warning'>[T.He] [T.has] \icon[back] [back.gender==PLURAL?"some":"a"] [(back.blood_color != SYNTH_BLOOD_COLOUR) ? "blood" : "oil"]-stained [back] on [T.his] back.</span>\n" msg += "<span class='warning'>[T.He] [T.has] \icon[back] [back.gender==PLURAL?"some":"a"] [(back.blood_color != SYNTH_BLOOD_COLOUR) ? "blood" : "oil"]-stained [back] on [T.his] back.</span><br>"
else 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.<br>"
//left hand //left hand
if(l_hand && l_hand.show_examine) if(l_hand && l_hand.show_examine)
if(l_hand.blood_DNA) if(l_hand.blood_DNA)
msg += "<span class='warning'>[T.He] [T.is] holding \icon[l_hand] [l_hand.gender==PLURAL?"some":"a"] [(l_hand.blood_color != SYNTH_BLOOD_COLOUR) ? "blood" : "oil"]-stained [l_hand.name] in [T.his] left hand!</span>\n" msg += "<span class='warning'>[T.He] [T.is] holding \icon[l_hand] [l_hand.gender==PLURAL?"some":"a"] [(l_hand.blood_color != SYNTH_BLOOD_COLOUR) ? "blood" : "oil"]-stained [l_hand.name] in [T.his] left hand!</span><br>"
else 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.<br>"
//right hand //right hand
if(r_hand && r_hand.show_examine) if(r_hand && r_hand.show_examine)
if(r_hand.blood_DNA) if(r_hand.blood_DNA)
msg += "<span class='warning'>[T.He] [T.is] holding \icon[r_hand] [r_hand.gender==PLURAL?"some":"a"] [(r_hand.blood_color != SYNTH_BLOOD_COLOUR) ? "blood" : "oil"]-stained [r_hand.name] in [T.his] right hand!</span>\n" msg += "<span class='warning'>[T.He] [T.is] holding \icon[r_hand] [r_hand.gender==PLURAL?"some":"a"] [(r_hand.blood_color != SYNTH_BLOOD_COLOUR) ? "blood" : "oil"]-stained [r_hand.name] in [T.his] right hand!</span><br>"
else 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.<br>"
//gloves //gloves
if(gloves && !skipgloves && gloves.show_examine) if(gloves && !(skip_gear & EXAMINE_SKIPGLOVES) && gloves.show_examine)
if(gloves.blood_DNA) if(gloves.blood_DNA)
msg += "<span class='warning'>[T.He] [T.has] \icon[gloves] [gloves.gender==PLURAL?"some":"a"] [(gloves.blood_color != SYNTH_BLOOD_COLOUR) ? "blood" : "oil"]-stained [gloves.name] on [T.his] hands!</span>\n" msg += "<span class='warning'>[T.He] [T.has] \icon[gloves] [gloves.gender==PLURAL?"some":"a"] [(gloves.blood_color != SYNTH_BLOOD_COLOUR) ? "blood" : "oil"]-stained [gloves.name] on [T.his] hands!</span><br>"
else 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.<br>"
else if(blood_DNA) else if(blood_DNA && !(skip_body & EXAMINE_SKIPHANDS))
msg += "<span class='warning'>[T.He] [T.has] [(hand_blood_color != SYNTH_BLOOD_COLOUR) ? "blood" : "oil"]-stained hands!</span>\n" msg += "<span class='warning'>[T.He] [T.has] [(hand_blood_color != SYNTH_BLOOD_COLOUR) ? "blood" : "oil"]-stained hands!</span><br>"
//handcuffed? //handcuffed?
if(handcuffed && handcuffed.show_examine) if(handcuffed && handcuffed.show_examine)
if(istype(handcuffed, /obj/item/weapon/handcuffs/cable)) if(istype(handcuffed, /obj/item/weapon/handcuffs/cable))
msg += "<span class='warning'>[T.He] [T.is] \icon[handcuffed] restrained with cable!</span>\n" msg += "<span class='warning'>[T.He] [T.is] \icon[handcuffed] restrained with cable!</span><br>"
else else
msg += "<span class='warning'>[T.He] [T.is] \icon[handcuffed] handcuffed!</span>\n" msg += "<span class='warning'>[T.He] [T.is] \icon[handcuffed] handcuffed!</span><br>"
//buckled //buckled
if(buckled) if(buckled)
msg += "<span class='warning'>[T.He] [T.is] \icon[buckled] buckled to [buckled]!</span>\n" msg += "<span class='warning'>[T.He] [T.is] \icon[buckled] buckled to [buckled]!</span><br>"
//belt //belt
if(belt && belt.show_examine) if(belt && !(skip_gear & EXAMINE_SKIPBELT) && belt.show_examine)
if(belt.blood_DNA) if(belt.blood_DNA)
msg += "<span class='warning'>[T.He] [T.has] \icon[belt] [belt.gender==PLURAL?"some":"a"] [(belt.blood_color != SYNTH_BLOOD_COLOUR) ? "blood" : "oil"]-stained [belt.name] about [T.his] waist!</span>\n" msg += "<span class='warning'>[T.He] [T.has] \icon[belt] [belt.gender==PLURAL?"some":"a"] [(belt.blood_color != SYNTH_BLOOD_COLOUR) ? "blood" : "oil"]-stained [belt.name] about [T.his] waist!</span><br>"
else 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.<br>"
//shoes //shoes
if(shoes && !skipshoes && shoes.show_examine) if(shoes && !(skip_gear & EXAMINE_SKIPSHOES) && shoes.show_examine)
if(shoes.blood_DNA) if(shoes.blood_DNA)
msg += "<span class='warning'>[T.He] [T.is] wearing \icon[shoes] [shoes.gender==PLURAL?"some":"a"] [(shoes.blood_color != SYNTH_BLOOD_COLOUR) ? "blood" : "oil"]-stained [shoes.name] on [T.his] feet!</span>\n" msg += "<span class='warning'>[T.He] [T.is] wearing \icon[shoes] [shoes.gender==PLURAL?"some":"a"] [(shoes.blood_color != SYNTH_BLOOD_COLOUR) ? "blood" : "oil"]-stained [shoes.name] on [T.his] feet!</span><br>"
else 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.<br>"
else if(feet_blood_DNA) else if(feet_blood_DNA && !(skip_body & EXAMINE_SKIPHANDS))
msg += "<span class='warning'>[T.He] [T.has] [(feet_blood_color != SYNTH_BLOOD_COLOUR) ? "blood" : "oil"]-stained feet!</span>\n" msg += "<span class='warning'>[T.He] [T.has] [(feet_blood_color != SYNTH_BLOOD_COLOUR) ? "blood" : "oil"]-stained feet!</span><br>"
//mask //mask
if(wear_mask && !skipmask && wear_mask.show_examine) if(wear_mask && !(skip_gear & EXAMINE_SKIPMASK) && wear_mask.show_examine)
var/descriptor = "on [T.his] face" var/descriptor = "on [T.his] face"
if(istype(wear_mask, /obj/item/weapon/grenade) && check_has_mouth()) if(istype(wear_mask, /obj/item/weapon/grenade) && check_has_mouth())
descriptor = "in [T.his] mouth" descriptor = "in [T.his] mouth"
if(wear_mask.blood_DNA) if(wear_mask.blood_DNA)
msg += "<span class='warning'>[T.He] [T.has] \icon[wear_mask] [wear_mask.gender==PLURAL?"some":"a"] [(wear_mask.blood_color != SYNTH_BLOOD_COLOUR) ? "blood" : "oil"]-stained [wear_mask.name] [descriptor]!</span>\n" msg += "<span class='warning'>[T.He] [T.has] \icon[wear_mask] [wear_mask.gender==PLURAL?"some":"a"] [(wear_mask.blood_color != SYNTH_BLOOD_COLOUR) ? "blood" : "oil"]-stained [wear_mask.name] [descriptor]!</span><br>"
else else
msg += "[T.He] [T.has] \icon[wear_mask] \a [wear_mask] [descriptor].\n" msg += "[T.He] [T.has] \icon[wear_mask] \a [wear_mask] [descriptor].<br>"
//eyes //eyes
if(glasses && !skipeyes && glasses.show_examine) if(glasses && !(skip_gear & EXAMINE_SKIPEYEWEAR) && glasses.show_examine)
if(glasses.blood_DNA) if(glasses.blood_DNA)
msg += "<span class='warning'>[T.He] [T.has] \icon[glasses] [glasses.gender==PLURAL?"some":"a"] [(glasses.blood_color != SYNTH_BLOOD_COLOUR) ? "blood" : "oil"]-stained [glasses] covering [T.his] eyes!</span>\n" msg += "<span class='warning'>[T.He] [T.has] \icon[glasses] [glasses.gender==PLURAL?"some":"a"] [(glasses.blood_color != SYNTH_BLOOD_COLOUR) ? "blood" : "oil"]-stained [glasses] covering [T.his] eyes!</span><br>"
else 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.<br>"
//left ear //left ear
if(l_ear && !skipears && l_ear.show_examine) if(l_ear && !(skip_gear & EXAMINE_SKIPEARS) && l_ear.show_examine)
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.<br>"
//right ear //right ear
if(r_ear && !skipears && r_ear.show_examine) if(r_ear && !(skip_gear & EXAMINE_SKIPEARS) && r_ear.show_examine)
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.<br>"
//ID //ID
if(wear_id && wear_id.show_examine) if(wear_id && wear_id.show_examine)
@@ -273,71 +263,55 @@
var/obj/item/weapon/card/id/idcard = wear_id var/obj/item/weapon/card/id/idcard = wear_id
id = idcard.registered_name id = idcard.registered_name
if(id && (id != real_name) && (get_dist(src, usr) <= 1) && prob(10)) if(id && (id != real_name) && (get_dist(src, usr) <= 1) && prob(10))
msg += "<span class='warning'>[T.He] [T.is] wearing \icon[wear_id] \a [wear_id] yet something doesn't seem right...</span>\n" msg += "<span class='warning'>[T.He] [T.is] wearing \icon[wear_id] \a [wear_id] yet something doesn't seem right...</span><br>"
else*/ 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].<br>"
//Jitters //Jitters
if(is_jittery) if(is_jittery)
if(jitteriness >= 300) if(jitteriness >= 300)
msg += "<span class='warning'><B>[T.He] [T.is] convulsing violently!</B></span>\n" msg += "<span class='warning'><B>[T.He] [T.is] convulsing violently!</B></span><br>"
else if(jitteriness >= 200) else if(jitteriness >= 200)
msg += "<span class='warning'>[T.He] [T.is] extremely jittery.</span>\n" msg += "<span class='warning'>[T.He] [T.is] extremely jittery.</span><br>"
else if(jitteriness >= 100) else if(jitteriness >= 100)
msg += "<span class='warning'>[T.He] [T.is] twitching ever so slightly.</span>\n" msg += "<span class='warning'>[T.He] [T.is] twitching ever so slightly.</span><br>"
//splints //splints
for(var/organ in BP_ALL) for(var/organ in BP_ALL)
var/obj/item/organ/external/o = get_organ(organ) var/obj/item/organ/external/o = get_organ(organ)
if(o && o.splinted && o.splinted.loc == o) if(o && o.splinted && o.splinted.loc == o)
msg += "<span class='warning'>[T.He] [T.has] \a [o.splinted] on [T.his] [o.name]!</span>\n" msg += "<span class='warning'>[T.He] [T.has] \a [o.splinted] on [T.his] [o.name]!</span><br>"
if(suiciding) if(suiciding)
msg += "<span class='warning'>[T.He] appears to have commited suicide... there is no hope of recovery.</span>\n" msg += "<span class='warning'>[T.He] appears to have commited suicide... there is no hope of recovery.</span><br>"
if(mSmallsize in mutations) if(mSmallsize in mutations)
msg += "[T.He] [T.is] small halfling!\n" msg += "[T.He] [T.is] very short!<br>"
var/distance = get_dist(usr,src)
if(istype(usr, /mob/observer/dead) || usr.stat == 2) // ghosts can see anything
distance = 1
if (src.stat) if (src.stat)
msg += "<span class='warning'>[T.He] [T.is]n't responding to anything around [T.him] and seems to be asleep.</span>\n" msg += "<span class='warning'>[T.He] [T.is]n't responding to anything around [T.him] and seems to be asleep.</span><br>"
if((stat == 2 || src.losebreath) && distance <= 3) if((stat == 2 || src.losebreath) && get_dist(user, src) <= 3)
msg += "<span class='warning'>[T.He] [T.does] not appear to be breathing.</span>\n" msg += "<span class='warning'>[T.He] [T.does] not appear to be breathing.</span><br>"
if(istype(usr, /mob/living/carbon/human) && !usr.stat && Adjacent(usr)) if(istype(user, /mob/living/carbon/human) && !user.stat && Adjacent(user))
usr.visible_message("<b>[usr]</b> checks [src]'s pulse.", "You check [src]'s pulse.") user.visible_message("<b>[usr]</b> checks [src]'s pulse.", "You check [src]'s pulse.")
spawn(15) spawn(15)
if(distance <= 1 && usr.stat != 1) if(isobserver(user) || (Adjacent(user) && !user.stat)) // If you're a corpse then you can't exactly check their pulse, but ghosts can see anything
if(pulse == PULSE_NONE) if(pulse == PULSE_NONE)
usr << "<span class='deadsay'>[T.He] [T.has] no pulse[src.client ? "" : " and [T.his] soul has departed"]...</span>" to_chat(user, "<span class='deadsay'>[T.He] [T.has] no pulse[src.client ? "" : " and [T.his] soul has departed"]...</span>")
else else
usr << "<span class='deadsay'>[T.He] [T.has] a pulse!</span>" to_chat(user, "<span class='deadsay'>[T.He] [T.has] a pulse!</span>")
if(fire_stacks) if(fire_stacks)
msg += "[T.He] [T.is] covered in some liquid.\n" msg += "[T.He] [T.is] covered in some liquid.<br>"
if(on_fire) if(on_fire)
msg += "<span class='warning'>[T.He] [T.is] on fire!.</span>\n" msg += "<span class='warning'>[T.He] [T.is] on fire!.</span><br>"
msg += "<span class='warning'>"
/*
if(nutrition < 100)
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"
else*/
msg += "[T.He] [T.is] quite chubby.\n"
*/
msg += "</span>"
var/ssd_msg = species.get_ssd(src) var/ssd_msg = species.get_ssd(src)
if(ssd_msg && (!should_have_organ("brain") || has_brain()) && stat != DEAD) if(ssd_msg && (!should_have_organ("brain") || has_brain()) && stat != DEAD)
if(!key) if(!key)
msg += "<span class='deadsay'>[T.He] [T.is] [ssd_msg]. It doesn't look like [T.he] [T.is] waking up anytime soon.</span>\n" msg += "<span class='deadsay'>[T.He] [T.is] [ssd_msg]. It doesn't look like [T.he] [T.is] waking up anytime soon.</span><br>"
else if(!client) else if(!client)
msg += "<span class='deadsay'>[T.He] [T.is] [ssd_msg].</span>\n" msg += "<span class='deadsay'>[T.He] [T.is] [ssd_msg].</span><br>"
var/list/wound_flavor_text = list() var/list/wound_flavor_text = list()
var/list/is_bleeding = list() var/list/is_bleeding = list()
@@ -350,9 +324,9 @@
var/obj/item/organ/external/E = organs_by_name[organ_tag] var/obj/item/organ/external/E = organs_by_name[organ_tag]
if(!E) if(!E)
wound_flavor_text["[organ_descriptor]"] = "<span class='warning'><b>[T.He] [T.is] missing [T.his] [organ_descriptor].</b></span>\n" wound_flavor_text["[organ_descriptor]"] = "<span class='warning'><b>[T.He] [T.is] missing [T.his] [organ_descriptor].</b></span><br>"
else if(E.is_stump()) else if(E.is_stump())
wound_flavor_text["[organ_descriptor]"] = "<span class='warning'><b>[T.He] [T.has] a stump where [T.his] [organ_descriptor] should be.</b></span>\n" wound_flavor_text["[organ_descriptor]"] = "<span class='warning'><b>[T.He] [T.has] a stump where [T.his] [organ_descriptor] should be.</b></span><br>"
else else
continue continue
@@ -361,13 +335,14 @@
if((temp.organ_tag in hidden) && hidden[temp.organ_tag]) if((temp.organ_tag in hidden) && hidden[temp.organ_tag])
continue //Organ is hidden, don't talk about it continue //Organ is hidden, don't talk about it
if(temp.status & ORGAN_DESTROYED) if(temp.status & ORGAN_DESTROYED)
wound_flavor_text["[temp.name]"] = "<span class='warning'><b>[T.He] [T.is] missing [T.his] [temp.name].</b></span>\n" wound_flavor_text["[temp.name]"] = "<span class='warning'><b>[T.He] [T.is] missing [T.his] [temp.name].</b></span><br>"
continue continue
if(!looks_synth && temp.robotic == ORGAN_ROBOT) if(!looks_synth && temp.robotic == ORGAN_ROBOT)
if(!(temp.brute_dam + temp.burn_dam)) if(!(temp.brute_dam + temp.burn_dam))
wound_flavor_text["[temp.name]"] = "[T.He] [T.has] a [temp.name].\n" wound_flavor_text["[temp.name]"] = "[T.He] [T.has] a [temp.name].<br>"
else else
wound_flavor_text["[temp.name]"] = "<span class='warning'>[T.He] [T.has] a [temp.name] with [temp.get_wounds_desc()]!</span>\n" wound_flavor_text["[temp.name]"] = "<span class='warning'>[T.He] [T.has] a [temp.name] with [temp.get_wounds_desc()]!</span><br>"
continue continue
else if(temp.wounds.len > 0 || temp.open) else if(temp.wounds.len > 0 || temp.open)
if(temp.is_stump() && temp.parent_organ && organs_by_name[temp.parent_organ]) if(temp.is_stump() && temp.parent_organ && organs_by_name[temp.parent_organ])
@@ -379,7 +354,7 @@
wound_flavor_text["[temp.name]"] = "" wound_flavor_text["[temp.name]"] = ""
if(temp.dislocated == 2) if(temp.dislocated == 2)
wound_flavor_text["[temp.name]"] += "<span class='warning'>[T.His] [temp.joint] is dislocated!</span><br>" wound_flavor_text["[temp.name]"] += "<span class='warning'>[T.His] [temp.joint] is dislocated!</span><br>"
if(((temp.status & ORGAN_BROKEN) && temp.brute_dam > temp.min_broken_damage) || (temp.status & ORGAN_MUTATED)) if(temp.brute_dam > temp.min_broken_damage || (temp.status & (ORGAN_BROKEN | ORGAN_MUTATED)))
wound_flavor_text["[temp.name]"] += "<span class='warning'>[T.His] [temp.name] is dented and swollen!</span><br>" wound_flavor_text["[temp.name]"] += "<span class='warning'>[T.His] [temp.name] is dented and swollen!</span><br>"
if(temp.germ_level > INFECTION_LEVEL_TWO && !(temp.status & ORGAN_DEAD)) if(temp.germ_level > INFECTION_LEVEL_TWO && !(temp.status & ORGAN_DEAD))
@@ -387,8 +362,8 @@
else if(temp.status & ORGAN_DEAD) else if(temp.status & ORGAN_DEAD)
wound_flavor_text["[temp.name]"] += "<span class='warning'>[T.His] [temp.name] looks rotten!</span><br>" wound_flavor_text["[temp.name]"] += "<span class='warning'>[T.His] [temp.name] looks rotten!</span><br>"
if(!wound_flavor_text["[temp.name]"] && (temp.status & ORGAN_BLEEDING)) if(temp.status & ORGAN_BLEEDING)
is_bleeding["[temp.name]"] = "<span class='danger'>[T.His] [temp.name] is bleeding!</span><br>" is_bleeding["[temp.name]"] += "<span class='danger'>[T.His] [temp.name] is bleeding!</span><br>"
if(temp.applied_pressure == src) if(temp.applied_pressure == src)
applying_pressure = "<span class='info'>[T.He] is applying pressure to [T.his] [temp.name].</span><br>" applying_pressure = "<span class='info'>[T.He] is applying pressure to [T.his] [temp.name].</span><br>"
@@ -398,67 +373,60 @@
for(var/limb in is_bleeding) for(var/limb in is_bleeding)
msg += is_bleeding[limb] msg += is_bleeding[limb]
for(var/implant in get_visible_implants(0)) for(var/implant in get_visible_implants(0))
msg += "<span class='danger'>[src] [T.has] \a [implant] sticking out of [T.his] flesh!</span>\n" msg += "<span class='danger'>[src] [T.has] \a [implant] sticking out of [T.his] flesh!</span><br>"
if(digitalcamo) if(digitalcamo)
msg += "[T.He] [T.is] repulsively uncanny!\n" msg += "[T.He] [T.is] repulsively uncanny!<br>"
if(hasHUD(usr,"security")) if(hasHUD(user,"security"))
var/perpname = "wot" var/perpname = name
var/criminal = "None" var/criminal = "None"
if(wear_id) if(wear_id)
var/obj/item/weapon/card/id/I = wear_id.GetID() if(istype(wear_id, /obj/item/weapon/card/id))
if(I) var/obj/item/weapon/card/id/I = wear_id
perpname = I.registered_name perpname = I.registered_name
else else if(istype(wear_id, /obj/item/device/pda))
perpname = name var/obj/item/device/pda/P = wear_id
else perpname = P.owner
perpname = name
if(perpname) for (var/datum/data/record/R in data_core.security)
for (var/datum/data/record/E in data_core.general) if(R.fields["name"] == perpname)
if(E.fields["name"] == perpname) criminal = R.fields["criminal"]
for (var/datum/data/record/R in data_core.security)
if(R.fields["id"] == E.fields["id"])
criminal = R.fields["criminal"]
msg += "<span class = 'deptradio'>Criminal status:</span> <a href='?src=\ref[src];criminal=1'>\[[criminal]\]</a>\n" msg += "<span class = 'deptradio'>Criminal status:</span> <a href='?src=\ref[src];criminal=1'>\[[criminal]\]</a><br>"
msg += "<span class = 'deptradio'>Security records:</span> <a href='?src=\ref[src];secrecord=`'>\[View\]</a> <a href='?src=\ref[src];secrecordadd=`'>\[Add comment\]</a>\n" msg += "<span class = 'deptradio'>Security records:</span> <a href='?src=\ref[src];secrecord=`'>\[View\]</a> <a href='?src=\ref[src];secrecordadd=`'>\[Add comment\]</a><br>"
if(hasHUD(usr,"medical")) if(hasHUD(user,"medical"))
var/perpname = "wot" var/perpname = name
var/medical = "None" var/medical = "None"
if(wear_id) if(wear_id)
if(istype(wear_id,/obj/item/weapon/card/id)) if(istype(wear_id, /obj/item/weapon/card/id))
perpname = wear_id:registered_name var/obj/item/weapon/card/id/I = wear_id
else if(istype(wear_id,/obj/item/device/pda)) perpname = I.registered_name
var/obj/item/device/pda/tempPda = wear_id else if(istype(wear_id, /obj/item/device/pda))
perpname = tempPda.owner var/obj/item/device/pda/P = wear_id
else perpname = P.owner
perpname = src.name
for (var/datum/data/record/E in data_core.general) for (var/datum/data/record/R in data_core.medical)
if (E.fields["name"] == perpname) if (R.fields["name"] == perpname)
for (var/datum/data/record/R in data_core.general) medical = R.fields["p_stat"]
if (R.fields["id"] == E.fields["id"])
medical = R.fields["p_stat"]
msg += "<span class = 'deptradio'>Physical status:</span> <a href='?src=\ref[src];medical=1'>\[[medical]\]</a>\n" msg += "<span class = 'deptradio'>Physical status:</span> <a href='?src=\ref[src];medical=1'>\[[medical]\]</a><br>"
msg += "<span class = 'deptradio'>Medical records:</span> <a href='?src=\ref[src];medrecord=`'>\[View\]</a> <a href='?src=\ref[src];medrecordadd=`'>\[Add comment\]</a>\n" msg += "<span class = 'deptradio'>Medical records:</span> <a href='?src=\ref[src];medrecord=`'>\[View\]</a> <a href='?src=\ref[src];medrecordadd=`'>\[Add comment\]</a><br>"
if(print_flavor_text()) if(print_flavor_text())
msg += "[print_flavor_text()]\n" msg += "[print_flavor_text()]<br>"
msg += "*---------*</span><br>" msg += "*---------*</span><br>"
msg += applying_pressure msg += applying_pressure
if (pose) if(pose)
if( findtext(pose,".",lentext(pose)) == 0 && findtext(pose,"!",lentext(pose)) == 0 && findtext(pose,"?",lentext(pose)) == 0 ) if(!findtext(pose, regex("\[.?!]$"))) // Will be zero if the last character is not a member of [.?!]
pose = addtext(pose,".") //Makes sure all emotes end with a period. pose = addtext(pose,".") //Makes sure all emotes end with a period.
msg += "[T.He] [pose]" msg += "[T.He] [pose]"
user << jointext(msg, null) to_chat(user, jointext(msg, null))
//Helper procedure. Called by /mob/living/carbon/human/examine() and /mob/living/carbon/human/Topic() to determine HUD access to security and medical records. //Helper procedure. Called by /mob/living/carbon/human/examine() and /mob/living/carbon/human/Topic() to determine HUD access to security and medical records.
/proc/hasHUD(mob/M as mob, hudtype) /proc/hasHUD(mob/M as mob, hudtype)
@@ -469,8 +437,6 @@
return istype(H.glasses, /obj/item/clothing/glasses/hud/security) || istype(H.glasses, /obj/item/clothing/glasses/sunglasses/sechud) return istype(H.glasses, /obj/item/clothing/glasses/hud/security) || istype(H.glasses, /obj/item/clothing/glasses/sunglasses/sechud)
if("medical") if("medical")
return istype(H.glasses, /obj/item/clothing/glasses/hud/health) return istype(H.glasses, /obj/item/clothing/glasses/hud/health)
else
return 0
else if(istype(M, /mob/living/silicon/robot)) else if(istype(M, /mob/living/silicon/robot))
var/mob/living/silicon/robot/R = M var/mob/living/silicon/robot/R = M
switch(hudtype) switch(hudtype)
@@ -478,7 +444,4 @@
return R.hudmode == "Security" return R.hudmode == "Security"
if("medical") if("medical")
return R.hudmode == "Medical" return R.hudmode == "Medical"
else return 0
return 0
else
return 0

View File

@@ -0,0 +1,4 @@
author: Atermonera
delete-after: True
changes:
- tweak: "Human examine code has received a major refactor. If you encounter unusual behaviour that seems wrong, please report it."