Fixes human examine

Fixes issues introduced with the examine tab system by decoupling the
examine() proc from the code that updates a mob's description holders.
Puts a few things in more logical places.
This commit is contained in:
mwerezak
2015-03-09 02:02:10 -04:00
parent db450303c4
commit e5a9b686aa
3 changed files with 27 additions and 33 deletions

View File

@@ -11,26 +11,7 @@
var/description_fluff = null //Green text about the atom's fluff, if any exists. var/description_fluff = null //Green text about the atom's fluff, if any exists.
var/description_antag = null //Malicious red text, for the antags. var/description_antag = null //Malicious red text, for the antags.
/atom/examine(mob/user, var/distance = -1, var/infix = "", var/suffix = "")
. = ..()
user.description_holders["info"] = get_description_info()
user.description_holders["fluff"] = get_description_fluff()
if(user.mind && user.mind.special_role || isobserver(user)) //Runtime prevention, as ghosts don't have minds.
user.description_holders["antag"] = get_description_antag()
if(name) //This shouldn't be needed but I'm paranoid.
user.description_holders["name"] = "[src.name]" //\icon[src]
user.description_holders["icon"] = "\icon[src]"
if(desc)
user << desc
user.description_holders["desc"] = src.desc
else
user.description_holders["desc"] = null //This is needed, or else if you examine one thing with a desc, then another without, the panel will retain the first examined's desc.
//Override these if you need special behaviour for a specific type. //Override these if you need special behaviour for a specific type.
/atom/proc/get_description_info() /atom/proc/get_description_info()
if(description_info) if(description_info)
return description_info return description_info
@@ -46,10 +27,30 @@
return description_antag return description_antag
return return
/mob/ /mob/living/get_description_fluff()
var/description_holders[0] if(flavor_text) //Get flavor text for the green text.
return flavor_text
else //No flavor text? Try for hardcoded fluff instead.
return ..()
/mob/Stat() /mob/living/carbon/human/get_description_fluff()
return print_flavor_text(0)
/* The examine panel itself */
/client/var/description_holders[0]
/client/proc/update_description_holders(atom/A)
description_holders["info"] = A.get_description_info()
description_holders["fluff"] = A.get_description_fluff()
if(mob.mind && mob.mind.special_role || isobserver(src)) //ghosts don't have minds.
description_holders["antag"] = A.get_description_antag()
description_holders["name"] = "[A.name]"
description_holders["icon"] = "\icon[A]"
description_holders["desc"] = A.desc
/client/Stat()
..() ..()
if(statpanel("Examine")) if(statpanel("Examine"))
stat(null,"[description_holders["icon"]] <font size='5'>[description_holders["name"]]</font>") //The name, written in big letters. stat(null,"[description_holders["icon"]] <font size='5'>[description_holders["name"]]</font>") //The name, written in big letters.
@@ -60,12 +61,3 @@
stat(null,"<font color='#298A08'><b>[description_holders["fluff"]]</b></font>") //Yellow, fluff-related text. stat(null,"<font color='#298A08'><b>[description_holders["fluff"]]</b></font>") //Yellow, fluff-related text.
if(description_holders["antag"]) if(description_holders["antag"])
stat(null,"<font color='#8A0808'><b>[description_holders["antag"]]</b></font>") //Red, malicious antag-related text stat(null,"<font color='#8A0808'><b>[description_holders["antag"]]</b></font>") //Red, malicious antag-related text
/mob/living/get_description_fluff()
if(flavor_text) //Get flavor text for the green text.
return flavor_text
else //No flavor text? Try for hardcoded fluff instead.
return ..()
/mob/living/carbon/human/get_description_fluff()
return print_flavor_text(0)

View File

@@ -451,7 +451,6 @@
msg += "\n[t_He] is [pose]" msg += "\n[t_He] is [pose]"
user << msg user << msg
..()
//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)

View File

@@ -233,6 +233,9 @@ var/list/slot_equipment_priority = list( \
face_atom(A) face_atom(A)
A.examine(src) A.examine(src)
if(client)
client.update_description_holders(A)
/mob/verb/pointed(atom/A as mob|obj|turf in view()) /mob/verb/pointed(atom/A as mob|obj|turf in view())
set name = "Point To" set name = "Point To"
set category = "Object" set category = "Object"