mirror of
https://github.com/KabKebab/GS13.git
synced 2026-04-08 04:21:10 +01:00
23 lines
838 B
Plaintext
23 lines
838 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 = GLOBAL_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))
|
|
RegisterSignal(equipper, signals, proctype, TRUE)
|
|
else
|
|
UnregisterSignal(equipper, signals)
|
|
|
|
/datum/component/wearertargeting/proc/on_drop(datum/source, mob/user)
|
|
UnregisterSignal(user, signals)
|