Replaces the three atom procs with just one and a datum-based system.

This commit is contained in:
Neerti
2015-02-15 23:52:39 -05:00
parent e75a4ebbc8
commit f2f893d42a
8 changed files with 88 additions and 38 deletions

View File

@@ -100,6 +100,7 @@
#include "code\datums\computerfiles.dm" #include "code\datums\computerfiles.dm"
#include "code\datums\datacore.dm" #include "code\datums\datacore.dm"
#include "code\datums\datumvars.dm" #include "code\datums\datumvars.dm"
#include "code\datums\descriptions.dm"
#include "code\datums\disease.dm" #include "code\datums\disease.dm"
#include "code\datums\mind.dm" #include "code\datums\mind.dm"
#include "code\datums\mixed.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,10 +12,8 @@
var/throwpass = 0 var/throwpass = 0
var/germ_level = GERM_LEVEL_AMBIENT // The higher the germ level, the more germ on the atom. var/germ_level = GERM_LEVEL_AMBIENT // The higher the germ level, the more germ on the atom.
//Examine tab vars //Examine tab
var/desc_info = null //Blue 'tutorial' text, which details how this atom works, and perhaps some tips and tricks. var/datum/descriptions/descriptions = null //See code/datums/descriptions.dm for details.
var/desc_fluff = null //Green text, with quotes, to tell a short blurb or a paragraph about this atom's place in the fluff, should one exist.
///Chemistry. ///Chemistry.
var/datum/reagents/reagents = null var/datum/reagents/reagents = null
@@ -207,35 +205,52 @@ its easier to just keep the beam vertical.
user << "\icon[src] That's [f_name] [suffix]" user << "\icon[src] That's [f_name] [suffix]"
if(name) //This shouldn't be needed but I'm paranoid. var/datum/descriptions/D = descriptions
user.desc_name_holder = "[src.name]" //\icon[src] 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
user.desc_icon_holder = "\icon[src]" 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) if(desc)
user << desc user << desc
user.desc_holder = src.desc user.description_holders["desc"] = src.desc
else else
user.desc_holder = 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. 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.
user.desc_info_holder = get_desc_info()
user.desc_fluff_holder = get_desc_fluff()
return distance == -1 || (get_dist(src, user) <= distance) return distance == -1 || (get_dist(src, user) <= distance)
//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_desc_info() /atom/proc/get_descriptions_info()
if(desc_info) var/datum/descriptions/D = descriptions
return desc_info if(istype(D) && D.info)
return D.info
else else
return return null
/atom/proc/get_desc_fluff() /atom/proc/get_descriptions_fluff()
if(desc_fluff) var/datum/descriptions/D = descriptions
return src.desc_fluff if(istype(D) && D.fluff)
return D.fluff
else else
return return null
/atom/proc/get_descriptions_antag()
var/datum/descriptions/D = descriptions
if(istype(D) && D.antag)
return D.antag
else
return null
// called by mobs when e.g. having the atom as their machine, pulledby, loc (AKA mob being inside the atom) or buckled var set. // 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. // see code/modules/mob/mob_movement.dm for more.

View File

@@ -1277,7 +1277,7 @@
else else
return ..() return ..()
/mob/living/carbon/human/get_desc_fluff() /mob/living/carbon/human/get_descriptions_fluff()
return print_flavor_text(0) return print_flavor_text(0)
/mob/living/carbon/human/getDNA() /mob/living/carbon/human/getDNA()

View File

@@ -172,13 +172,11 @@
// ++++ROCKDTBEN++++ MOB PROCS //END // ++++ROCKDTBEN++++ MOB PROCS //END
/mob/living/get_desc_fluff() /mob/living/get_descriptions_fluff()
if(flavor_text) //Get flavor text for the green text. if(flavor_text) //Get flavor text for the green text.
return flavor_text return flavor_text
else if(desc_fluff) //No flavor text? Try for hardcoded fluff instead. else //No flavor text? Try for hardcoded fluff instead.
return desc_fluff return ..()
else
return
/mob/proc/get_contents() /mob/proc/get_contents()

View File

@@ -3,7 +3,13 @@
real_name = "drone" real_name = "drone"
icon = 'icons/mob/robots.dmi' icon = 'icons/mob/robots.dmi'
icon_state = "repairbot" icon_state = "repairbot"
desc_info = "Drones are player-controlled synthetics which are lawed to maintain the station and not \ 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_info = "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. \ 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, \ 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." 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."

View File

@@ -835,12 +835,15 @@ note dizziness decrements automatically in the mob's Life() proc.
statpanel("Spells","[S.holder_var_type] [S.holder_var_amount]",S) statpanel("Spells","[S.holder_var_type] [S.holder_var_amount]",S)
if(client) if(client)
statpanel("Examine") statpanel("Examine")
stat(null,"[desc_icon_holder] <font size='5'>[desc_name_holder]</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.
stat(null,"[desc_holder]") //the default examine text. stat(null,"[description_holders["desc"]]") //the default examine text.
if(desc_info_holder) if(description_holders["info"])
stat(null,"<font color='#086A87'><b>[desc_info_holder]</b></font>") //Blue, informative text. stat(null,"<font color='#084B8A'><b>[description_holders["info"]]</b></font>") //Blue, informative text.
if(desc_fluff_holder) if(description_holders["fluff"])
stat(null,"<font color='#298A08'><b>[desc_fluff_holder]</b></font>") //Yellow, fluff-related text. 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

@@ -226,8 +226,13 @@
//Examine tab vars //Examine tab vars
//These hold the descriptions and other info, to relay to the actual tab. //These hold the descriptions and other info, to relay to the actual tab.
var/desc_name_holder = null var/description_holders[0]
var/desc_holder = null /*
var/desc_info_holder = null description_holders["name"] = null
var/desc_fluff_holder = null description_holders["icon"] = null
var/desc_icon_holder = null description_holders["desc"] = null
description_holders["info"] = null
description_holders["fluff"] = null
description_holders["antag"] = null
*/