Files
Bubberstation/code/datums/components/heirloom.dm
T
Watermelon914andGitHub 375a20e49b Refactors most spans into span procs (#59645)
Converts most spans into span procs. Mostly used regex for this and sorted out any compile time errors afterwards so there could be some bugs.
Was initially going to do defines, but ninja said to make it into a proc, and if there's any overhead, they can easily be changed to defines.

Makes it easier to control the formatting and prevents typos when creating spans as it'll runtime if you misspell instead of silently failing.
Reduces the code you need to write when writing spans, as you don't need to close the span as that's automatically handled by the proc.

(Note from Lemon: This should be converted to defines once we update the minimum version to 514. Didn't do it now because byond pain and such)
2021-06-14 13:03:53 -07:00

25 lines
901 B
Plaintext

/datum/component/heirloom
var/datum/mind/owner
var/family_name
/datum/component/heirloom/Initialize(new_owner, new_family_name)
if(!isitem(parent))
return COMPONENT_INCOMPATIBLE
owner = new_owner
family_name = new_family_name
RegisterSignal(parent, COMSIG_PARENT_EXAMINE, .proc/examine)
/datum/component/heirloom/proc/examine(datum/source, mob/user, list/examine_list)
SIGNAL_HANDLER
if(user.mind == owner)
examine_list += span_notice("It is your precious [family_name] family heirloom. Keep it safe!")
else if(isobserver(user))
examine_list += span_notice("It is the [family_name] family heirloom, belonging to [owner].")
else
var/datum/antagonist/obsessed/creeper = user.mind.has_antag_datum(/datum/antagonist/obsessed)
if(creeper && creeper.trauma.obsession == owner)
examine_list += span_nicegreen("This must be [owner]'s family heirloom! It smells just like them...")