mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2025-12-29 02:51:41 +00:00
* Adds the signal origin as the first arg to all signals * Fixes some storage and nanite procs
27 lines
917 B
Plaintext
27 lines
917 B
Plaintext
/datum/component/anti_magic
|
|
var/magic = FALSE
|
|
var/holy = FALSE
|
|
|
|
/datum/component/anti_magic/Initialize(_magic = FALSE, _holy = FALSE)
|
|
if(isitem(parent))
|
|
RegisterSignal(parent, COMSIG_ITEM_EQUIPPED, .proc/on_equip)
|
|
RegisterSignal(parent, COMSIG_ITEM_DROPPED, .proc/on_drop)
|
|
else if(ismob(parent))
|
|
RegisterSignal(parent, COMSIG_MOB_RECEIVE_MAGIC, .proc/can_protect)
|
|
else
|
|
return COMPONENT_INCOMPATIBLE
|
|
|
|
magic = _magic
|
|
holy = _holy
|
|
|
|
/datum/component/anti_magic/proc/on_equip(datum/source, mob/equipper, slot)
|
|
RegisterSignal(equipper, COMSIG_MOB_RECEIVE_MAGIC, .proc/can_protect, TRUE)
|
|
|
|
/datum/component/anti_magic/proc/on_drop(datum/source, mob/user)
|
|
UnregisterSignal(user, COMSIG_MOB_RECEIVE_MAGIC)
|
|
|
|
/datum/component/anti_magic/proc/can_protect(datum/source, _magic, _holy, list/protection_sources)
|
|
if((_magic && magic) || (_holy && holy))
|
|
protection_sources += parent
|
|
return COMPONENT_BLOCK_MAGIC
|