Files
d19bf6c1cd Makes loadout renamed items able to be examined when worn (#2349)
## About The Pull Request

When an item is renamed due to loadout settings, it shows up as
clickable on the examine of the person wearing it.


![image](https://github.com/user-attachments/assets/3134b0de-6a23-4037-8d8f-92e22bb74456)

Clicking this link then makes the user examine this item further


![image](https://github.com/user-attachments/assets/6dad0d75-d363-47d6-9f98-9ab9107acee7)

## Why It's Good For The Game

Allows people's neat loadout item descriptions to be visible from an
examine without any stripping needed. This means more reason to
customize these items.

## Proof Of Testing

See above

## Changelog

🆑
add: Loadout renamed/redescribed items can be examined when worn.
/🆑

---------

Co-authored-by: LT3 <83487515+lessthnthree@users.noreply.github.com>
2024-11-08 19:53:23 +00:00

18 lines
643 B
Plaintext

// This is cheaper than adding to the Topic() of atom
/datum/element/examined_when_worn
/datum/element/examined_when_worn/Attach(datum/target)
. = ..()
RegisterSignal(target, COMSIG_TOPIC, PROC_REF(on_topic))
ADD_TRAIT(target, TRAIT_WORN_EXAMINE, TRAIT_SUBTREE_REQUIRED_OPERATIONAL_DATUM)
/datum/element/examined_when_worn/proc/on_topic(atom/source, mob/user, href_list)
if(href_list["examine_loadout"])
user.run_examinate(source)
return
/datum/element/examined_when_worn/Detach(datum/source, ...)
. = ..()
UnregisterSignal(source, COMSIG_TOPIC)
REMOVE_TRAIT(source, TRAIT_WORN_EXAMINE, TRAIT_SUBTREE_REQUIRED_OPERATIONAL_DATUM)