mirror of
https://github.com/yogstation13/Yogstation.git
synced 2025-02-26 09:04:50 +00:00
* 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
23 lines
834 B
Plaintext
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)
|