mirror of
https://github.com/KabKebab/GS13.git
synced 2026-07-09 07:02:15 +01:00
Merge pull request #9610 from Ghommie/Ghommie-cit273
ports anti-magic component code updates (holymelon sold separately).
This commit is contained in:
@@ -2,12 +2,13 @@
|
||||
var/magic = FALSE
|
||||
var/holy = FALSE
|
||||
var/psychic = FALSE
|
||||
var/allowed_slots = ~ITEM_SLOT_BACKPACK
|
||||
var/charges = INFINITY
|
||||
var/blocks_self = TRUE
|
||||
var/datum/callback/reaction
|
||||
var/datum/callback/expire
|
||||
|
||||
/datum/component/anti_magic/Initialize(_magic = FALSE, _holy = FALSE, _psychic = FALSE, _charges, _blocks_self = TRUE, datum/callback/_reaction, datum/callback/_expire)
|
||||
/datum/component/anti_magic/Initialize(_magic = FALSE, _holy = FALSE, _psychic = FALSE, _allowed_slots, _charges, _blocks_self = TRUE, datum/callback/_reaction, datum/callback/_expire)
|
||||
if(isitem(parent))
|
||||
RegisterSignal(parent, COMSIG_ITEM_EQUIPPED, .proc/on_equip)
|
||||
RegisterSignal(parent, COMSIG_ITEM_DROPPED, .proc/on_drop)
|
||||
@@ -19,6 +20,8 @@
|
||||
magic = _magic
|
||||
holy = _holy
|
||||
psychic = _psychic
|
||||
if(_allowed_slots)
|
||||
allowed_slots = _allowed_slots
|
||||
if(!isnull(_charges))
|
||||
charges = _charges
|
||||
blocks_self = _blocks_self
|
||||
@@ -26,6 +29,9 @@
|
||||
expire = _expire
|
||||
|
||||
/datum/component/anti_magic/proc/on_equip(datum/source, mob/equipper, slot)
|
||||
if(!CHECK_BITFIELD(allowed_slots, slotdefine2slotbit(slot))) //Check that the slot is valid for antimagic
|
||||
UnregisterSignal(equipper, COMSIG_MOB_RECEIVE_MAGIC)
|
||||
return
|
||||
RegisterSignal(equipper, COMSIG_MOB_RECEIVE_MAGIC, .proc/protect, TRUE)
|
||||
|
||||
/datum/component/anti_magic/proc/on_drop(datum/source, mob/user)
|
||||
|
||||
Reference in New Issue
Block a user