Files
Bubberstation/code/datums/components/heirloom.dm
LemonInTheDark ae5a4f955d Pulls apart the vestiges of components still hanging onto signals (#75914)
## About The Pull Request

Signals were initially only usable with component listeners, which while
no longer the case has lead to outdated documentation, names, and a
similar location in code.

This pr pulls the two apart. Partially because mso thinks we should, but
also because they really aren't directly linked anymore, and having them
in this midstate just confuses people.

[Renames comp_lookup to listen_lookup, since that's what it
does](102b79694f)

[Moves signal procs over to their own
file](33d07d01fd)

[Renames the PREQDELETING and QDELETING comsigs to drop the parent bit
since they can hook to more then just comps
now](335ea4ad08)

[Does something similar to the attackby comsigs (PARENT ->
ATOM)](210e57051d)

[And finally passes over the examine
signals](65917658fb)

## Why It's Good For The Game

Code makes more sense, things are better teased apart, s just good imo

## Changelog
🆑
refactor: Pulled apart the last vestiges of names/docs directly linking
signals to components
/🆑
2023-06-09 06:14:31 +00:00

41 lines
1.3 KiB
Plaintext

/// Heirloom component. For use with the family heirloom quirk, tracks that an item is someone's family heirloom.
/datum/component/heirloom
/// The mind that actually owns our heirloom.
var/datum/mind/owner
/// Flavor. The family name of the owner of the heirloom.
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_ATOM_EXAMINE, PROC_REF(on_examine))
/datum/component/heirloom/Destroy(force, silent)
owner = null
return ..()
/**
* Signal proc for [COMSIG_ATOM_EXAMINE].
*
* Shows who owns the heirloom on examine.
*/
/datum/component/heirloom/proc/on_examine(datum/source, mob/user, list/examine_list)
SIGNAL_HANDLER
var/datum/mind/examiner_mind = user.mind
if(examiner_mind == owner)
examine_list += span_notice("It is your precious [family_name] family heirloom. Keep it safe!")
return
var/datum/antagonist/obsessed/our_creeper = examiner_mind?.has_antag_datum(/datum/antagonist/obsessed)
if(our_creeper?.trauma.obsession == owner)
examine_list += span_nicegreen("This must be [owner]'s family heirloom! It smells just like them...")
return
examine_list += span_notice("It is the [family_name] family heirloom, belonging to [owner].")