mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2025-12-11 10:11:09 +00:00
- Makes QDELETED use isnull(x) instead of !x, giving about 0.2 to 0.25s of speed. - Make disposal constructs only update icon state rather than go through expensive overlay code. Unfortunately did not have much effect, but is something they should've been doing nonetheless. - Makes RegisterSignal only take signals directly as opposed to allocating a fresh list of signals. Very few consumers actually used this and it costs about 0.4s. Also I think this is just a bad API anyway and that separate procs are important `\bRegisterSignal\((.*)list\(` replaced with `RegisterSignals($1list(`
27 lines
875 B
Plaintext
27 lines
875 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)
|
|
SIGNAL_HANDLER
|
|
|
|
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)
|
|
SIGNAL_HANDLER
|
|
|
|
UnregisterSignal(user, signals)
|