mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2025-12-13 03:02:38 +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(`
21 lines
601 B
Plaintext
21 lines
601 B
Plaintext
/**
|
|
* Attaches to an item, if that item is dropped on the floor delete it
|
|
*/
|
|
/datum/element/delete_on_drop
|
|
var/list/myvar = list()
|
|
|
|
/datum/element/delete_on_drop/Attach(datum/target)
|
|
. = ..()
|
|
if(!isitem(target))
|
|
return COMPONENT_INCOMPATIBLE
|
|
RegisterSignals(target, list(COMSIG_ITEM_DROPPED, COMSIG_CASING_EJECTED), PROC_REF(del_on_drop))
|
|
|
|
/datum/element/delete_on_drop/Detach(datum/source)
|
|
. = ..()
|
|
UnregisterSignal(source, list(COMSIG_ITEM_DROPPED, COMSIG_CASING_EJECTED))
|
|
|
|
/datum/element/delete_on_drop/proc/del_on_drop(atom/source)
|
|
SIGNAL_HANDLER
|
|
if(isturf(source.loc))
|
|
qdel(source)
|