Files
Yogstation/code/datums/components/wearertargeting.dm
adamsong 5a43d8e4ba Port codebase to 515 (#18669)
* Set max version

* Updates most references to .proc (Leaves a couple to check check_grep)

* Actually add check

* Oops

* Hopefully exclude the one place we do want .proc

* AAAAAAA

* Trying this instead

* Hopefully checks go green

* Switch to NAMEOF_STATIC

* Makes 515 acutally build

* LIBCALL
2023-05-08 17:01:37 -05:00

23 lines
834 B
Plaintext

// A dummy parent type used for easily making components that target an item's wearer rather than the item itself.
/datum/component/wearertargeting
var/list/valid_slots = list()
var/list/signals = list()
var/proctype = PROC_REF(pass)
var/mobtype = /mob/living
/datum/component/wearertargeting/Initialize()
if(!isitem(parent))
return COMPONENT_INCOMPATIBLE
RegisterSignal(parent, COMSIG_ITEM_EQUIPPED, PROC_REF(on_equip))
RegisterSignal(parent, COMSIG_ITEM_DROPPED, PROC_REF(on_drop))
/datum/component/wearertargeting/proc/on_equip(datum/source, mob/equipper, slot)
if((slot in valid_slots) && istype(equipper, mobtype))
RegisterSignals(equipper, signals, proctype, TRUE)
else
UnregisterSignal(equipper, signals)
/datum/component/wearertargeting/proc/on_drop(datum/source, mob/user)
UnregisterSignal(user, signals)