Merge pull request #8121 from Neerti/2_13_2015_examine_tab

Adds the Examine Tab.
This commit is contained in:
Chinsky
2015-02-19 21:00:22 +03:00
10 changed files with 102 additions and 4 deletions

View File

@@ -100,6 +100,7 @@
#include "code\datums\computerfiles.dm"
#include "code\datums\datacore.dm"
#include "code\datums\datumvars.dm"
#include "code\datums\descriptions.dm"
#include "code\datums\disease.dm"
#include "code\datums\mind.dm"
#include "code\datums\mixed.dm"

View File

@@ -0,0 +1,22 @@
/*
This is what is supplied to the examine tab. Everything has a 'descriptions' variable, which is null by default. When it is not null,
it contains this datum. To add this datum to something, all you do is add this to the thing..
descriptions = new/datum/descriptions("I am some helpful blue text","I have backstory text about this obj.","You can use this to kill everyone.")
First string is the 'info' var, second is the 'fluff' var, and third is the 'antag' var. All are optional. Just add it to the object you want to have it.
If you are wondering, BYOND does not let you do desc = new/datum/descriptions .
More strings can be added easily, but you will need to add a proc to retrieve it from the atom. The procs are defined in atoms.dm.
*/
/datum/descriptions
var/info
var/fluff
var/antag
/datum/descriptions/New(var/info, var/fluff, var/antag)
src.info = info
src.fluff = fluff
src.antag = antag

View File

@@ -12,6 +12,9 @@
var/throwpass = 0
var/germ_level = GERM_LEVEL_AMBIENT // The higher the germ level, the more germ on the atom.
//Examine tab
var/datum/descriptions/descriptions = null //See code/datums/descriptions.dm for details.
///Chemistry.
var/datum/reagents/reagents = null
@@ -202,11 +205,47 @@ its easier to just keep the beam vertical.
user << "\icon[src] That's [f_name] [suffix]"
var/datum/descriptions/D = descriptions
if(istype(D))
user.description_holders["info"] = get_descriptions_info()
user.description_holders["fluff"] = get_descriptions_fluff()
if(user.mind.special_role)
user.description_holders["antag"] = get_descriptions_antag()
else
user.description_holders["info"] = null
user.description_holders["fluff"] = null
user.description_holders["antag"] = null
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.
return distance == -1 || (get_dist(src, user) <= distance)
//Override these if you need special behaviour for a specific type.
/atom/proc/get_descriptions_info()
if(descriptions && descriptions.info)
return descriptions.info
return
/atom/proc/get_descriptions_fluff()
if(descriptions && descriptions.fluff)
return descriptions.fluff
return
/atom/proc/get_descriptions_antag()
if(descriptions && descriptions.antag)
return descriptions.antag
return
// called by mobs when e.g. having the atom as their machine, pulledby, loc (AKA mob being inside the atom) or buckled var set.
// see code/modules/mob/mob_movement.dm for more.
/atom/proc/relaymove()

View File

@@ -451,6 +451,7 @@
msg += "\n[t_He] is [pose]"
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.
/proc/hasHUD(mob/M as mob, hudtype)

View File

@@ -1239,7 +1239,7 @@
// Might need re-wording.
user << "<span class='alert'>There is no exposed flesh or thin material [target_zone == "head" ? "on their head" : "on their body"] to inject into.</span>"
/mob/living/carbon/human/print_flavor_text()
/mob/living/carbon/human/print_flavor_text(var/shrink = 1)
var/list/equipment = list(src.head,src.wear_mask,src.glasses,src.w_uniform,src.wear_suit,src.gloves,src.shoes)
var/head_exposed = 1
var/face_exposed = 1
@@ -1275,7 +1275,13 @@
if((T == "head" && head_exposed) || (T == "face" && face_exposed) || (T == "eyes" && eyes_exposed) || (T == "torso" && torso_exposed) || (T == "arms" && arms_exposed) || (T == "hands" && hands_exposed) || (T == "legs" && legs_exposed) || (T == "feet" && feet_exposed))
flavor_text += flavor_texts[T]
flavor_text += "\n\n"
return ..()
if(!shrink)
return flavor_text
else
return ..()
/mob/living/carbon/human/get_descriptions_fluff()
return print_flavor_text(0)
/mob/living/carbon/human/getDNA()
if(species.flags & NO_SCAN)

View File

@@ -172,6 +172,12 @@
// ++++ROCKDTBEN++++ MOB PROCS //END
/mob/living/get_descriptions_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/proc/get_contents()

View File

@@ -3,6 +3,13 @@
real_name = "drone"
icon = 'icons/mob/robots.dmi'
icon_state = "repairbot"
descriptions = new/datum/descriptions("Drones are player-controlled synthetics which are lawed to maintain the station and not \
interact with anyone else, except for other drones. They hold a wide array of tools to build, repair, maintain, and clean. \
They fuction similarly to other synthetics, in that they require recharging regularly, have laws, and are resilient to many hazards, \
such as fire, radiation, vacuum, and more. Ghosts can join the round as a maintenance drone by using the appropriate verb in the 'ghost' tab. \
An inactive drone can be rebooted by swiping an ID card on it with engineering or robotics access.",\
,"An <u>Electromagnetic Sequencer</u> can be used to subvert the drone to your cause.")
//desc_fluff is already provided with flavor_text.
maxHealth = 35
health = 35
universal_speak = 0

View File

@@ -834,6 +834,17 @@ note dizziness decrements automatically in the mob's Life() proc.
statpanel("Spells","[S.charge_counter]/[S.charge_max]",S)
if("holdervar")
statpanel("Spells","[S.holder_var_type] [S.holder_var_amount]",S)
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["desc"]]") //the default examine text.
if(description_holders["info"])
stat(null,"<font color='#084B8A'><b>[description_holders["info"]]</b></font>") //Blue, informative text.
if(description_holders["fluff"])
stat(null,"<font color='#298A08'><b>[description_holders["fluff"]]</b></font>") //Yellow, fluff-related text.
if(mind.special_role)
if(description_holders["antag"])
stat(null,"<font color='#8A0808'><b>[description_holders["antag"]]</b></font>") //Red, malicious antag-related text

View File

@@ -223,3 +223,8 @@
var/list/shouldnt_see = list() //list of objects that this mob shouldn't see in the stat panel. this silliness is needed because of AI alt+click and cult blood runes
var/list/active_genes=list()
//Examine tab vars
//These hold the descriptions and other info, to relay to the actual tab.
var/description_holders[0]

View File

@@ -1828,7 +1828,7 @@ window "infowindow"
elem "info"
type = INFO
pos = 0,0
size = 638x475
size = 636x451
anchor1 = 0,0
anchor2 = 100,100
font-family = ""
@@ -1851,7 +1851,7 @@ window "infowindow"
tab-font-family = ""
tab-font-size = 0
tab-font-style = ""
allow-html = false
allow-html = true
multi-line = true
on-show = ".winset\"rpane.infob.is-visible=true;rpane.browseb.is-visible=true?rpane.infob.pos=130,0:rpane.infob.pos=65,0 rpane.textb.is-visible=true rpane.infob.is-checked=true rpane.rpanewindow.pos=0,30 rpane.rpanewindow.size=0x0 rpane.rpanewindow.left=infowindow\""
on-hide = ".winset\"rpane.infob.is-visible=false;rpane.browseb.is-visible=true?rpane.browseb.is-checked=true rpane.rpanewindow.left=browserwindow:rpane.textb.is-visible=true rpane.rpanewindow.pos=0,30 rpane.rpanewindow.size=0x0 rpane.rpanewindow.left=\""