From 114628ad7ca07bcd8e177fa01e1513ce93bbcc0a Mon Sep 17 00:00:00 2001 From: XDTM Date: Mon, 24 Jun 2019 16:31:11 +0200 Subject: [PATCH] Fixes antimagic not working in hand slots (#44606) * Fixes antimagic not working in hand slots * proper changes * Update code/modules/mining/lavaland/necropolis_chests.dm Co-Authored-By: Emmett Gaines --- code/__DEFINES/inventory.dm | 6 ++++++ code/datums/components/anti_magic.dm | 4 ++-- code/modules/clothing/head/misc_special.dm | 2 +- code/modules/clothing/spacesuits/hardsuit.dm | 2 +- code/modules/clothing/spacesuits/miscellaneous.dm | 4 ++-- code/modules/hydroponics/grown/melon.dm | 2 +- code/modules/projectiles/guns/magic/wand.dm | 7 +++++-- 7 files changed, 18 insertions(+), 9 deletions(-) diff --git a/code/__DEFINES/inventory.dm b/code/__DEFINES/inventory.dm index 2c3398597db..99509bd623c 100644 --- a/code/__DEFINES/inventory.dm +++ b/code/__DEFINES/inventory.dm @@ -28,6 +28,8 @@ #define ITEM_SLOT_POCKET (1<<11) // this is to allow items with a w_class of WEIGHT_CLASS_NORMAL or WEIGHT_CLASS_BULKY to fit in pockets. #define ITEM_SLOT_DENYPOCKET (1<<12) // this is to deny items with a w_class of WEIGHT_CLASS_SMALL or WEIGHT_CLASS_TINY to fit in pockets. #define ITEM_SLOT_NECK (1<<13) +#define ITEM_SLOT_HANDS (1<<14) +#define ITEM_SLOT_BACKPACK (1<<15) //SLOTS #define SLOT_BACK 1 @@ -84,6 +86,10 @@ . = ITEM_SLOT_ICLOTHING if(SLOT_L_STORE, SLOT_R_STORE) . = ITEM_SLOT_POCKET + if(SLOT_HANDS) + . = ITEM_SLOT_HANDS + if(SLOT_IN_BACKPACK) + . = ITEM_SLOT_BACKPACK //Bit flags for the flags_inv variable, which determine when a piece of clothing hides another. IE a helmet hiding glasses. diff --git a/code/datums/components/anti_magic.dm b/code/datums/components/anti_magic.dm index a1ac6c0b028..bca6a0a3814 100644 --- a/code/datums/components/anti_magic.dm +++ b/code/datums/components/anti_magic.dm @@ -2,7 +2,7 @@ var/magic = FALSE var/holy = FALSE var/psychic = FALSE - var/allowed_slots = ITEM_SLOT_BACK|ITEM_SLOT_MASK|ITEM_SLOT_NECK|ITEM_SLOT_BELT|ITEM_SLOT_ID|ITEM_SLOT_EARS|ITEM_SLOT_EYES|ITEM_SLOT_GLOVES|ITEM_SLOT_HEAD|ITEM_SLOT_FEET|ITEM_SLOT_OCLOTHING|ITEM_SLOT_ICLOTHING|ITEM_SLOT_POCKET + var/allowed_slots = ~ITEM_SLOT_BACKPACK var/charges = INFINITY var/blocks_self = TRUE var/datum/callback/reaction @@ -29,7 +29,7 @@ expire = _expire /datum/component/anti_magic/proc/on_equip(datum/source, mob/equipper, slot) - if(!CHECK_BITFIELD(allowed_slots, slotdefine2slotbit(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) diff --git a/code/modules/clothing/head/misc_special.dm b/code/modules/clothing/head/misc_special.dm index 3b75de4738a..5843f7a20da 100644 --- a/code/modules/clothing/head/misc_special.dm +++ b/code/modules/clothing/head/misc_special.dm @@ -271,7 +271,7 @@ /obj/item/clothing/head/foilhat/Initialize(mapload) . = ..() if(!warped) - AddComponent(/datum/component/anti_magic, FALSE, FALSE, TRUE, ITEM_SLOT_HEAD, 6, TRUE, null, CALLBACK(src, .proc/warp_up)) + AddComponent(/datum/component/anti_magic, FALSE, FALSE, TRUE, ITEM_SLOT_HEAD, 6, TRUE, null, CALLBACK(src, .proc/warp_up)) /obj/item/clothing/head/foilhat/equipped(mob/living/carbon/human/user, slot) . = ..() diff --git a/code/modules/clothing/spacesuits/hardsuit.dm b/code/modules/clothing/spacesuits/hardsuit.dm index cd8ba56fc53..cc28900495d 100644 --- a/code/modules/clothing/spacesuits/hardsuit.dm +++ b/code/modules/clothing/spacesuits/hardsuit.dm @@ -423,7 +423,7 @@ /obj/item/clothing/suit/space/hardsuit/wizard/Initialize() . = ..() - AddComponent(/datum/component/anti_magic, TRUE, FALSE, FALSE, null, INFINITY, FALSE) + AddComponent(/datum/component/anti_magic, TRUE, FALSE, FALSE, ITEM_SLOT_OCLOTHING, INFINITY, FALSE) //Medical hardsuit diff --git a/code/modules/clothing/spacesuits/miscellaneous.dm b/code/modules/clothing/spacesuits/miscellaneous.dm index e767c0f2038..1d5b4dbabd3 100644 --- a/code/modules/clothing/spacesuits/miscellaneous.dm +++ b/code/modules/clothing/spacesuits/miscellaneous.dm @@ -331,7 +331,7 @@ Contains: /obj/item/clothing/suit/space/hardsuit/ert/paranormal/Initialize() . = ..() - AddComponent(/datum/component/anti_magic, FALSE, FALSE, TRUE) + AddComponent(/datum/component/anti_magic, FALSE, FALSE, TRUE, ITEM_SLOT_OCLOTHING) /obj/item/clothing/suit/space/hardsuit/ert/paranormal name = "paranormal response team hardsuit" @@ -344,7 +344,7 @@ Contains: /obj/item/clothing/suit/space/hardsuit/ert/paranormal/Initialize() . = ..() - AddComponent(/datum/component/anti_magic, TRUE, TRUE) + AddComponent(/datum/component/anti_magic, TRUE, TRUE, TRUE, ITEM_SLOT_OCLOTHING) /obj/item/clothing/suit/space/hardsuit/ert/paranormal/inquisitor name = "inquisitor's hardsuit" diff --git a/code/modules/hydroponics/grown/melon.dm b/code/modules/hydroponics/grown/melon.dm index 3bebfb5cbd5..cf9bf8ee63d 100644 --- a/code/modules/hydroponics/grown/melon.dm +++ b/code/modules/hydroponics/grown/melon.dm @@ -63,7 +63,7 @@ var/uses = 1 if(seed) uses = round(seed.potency / 20) - AddComponent(/datum/component/anti_magic, TRUE, TRUE, FALSE, null, uses, TRUE, CALLBACK(src, .proc/block_magic), CALLBACK(src, .proc/expire)) //deliver us from evil o melon god + AddComponent(/datum/component/anti_magic, TRUE, TRUE, FALSE, ITEM_SLOT_HANDS, uses, TRUE, CALLBACK(src, .proc/block_magic), CALLBACK(src, .proc/expire)) //deliver us from evil o melon god /obj/item/reagent_containers/food/snacks/grown/holymelon/proc/block_magic(mob/user, major) if(major) diff --git a/code/modules/projectiles/guns/magic/wand.dm b/code/modules/projectiles/guns/magic/wand.dm index fc26612a74d..6dcfbde387c 100644 --- a/code/modules/projectiles/guns/magic/wand.dm +++ b/code/modules/projectiles/guns/magic/wand.dm @@ -94,14 +94,17 @@ max_charges = 10 //10, 5, 5, 4 /obj/item/gun/magic/wand/resurrection/zap_self(mob/living/user) + ..() + charges-- + if(user.anti_magic_check()) + user.visible_message("[src] has no effect on [user]!") + return user.revive(full_heal = 1) if(iscarbon(user)) var/mob/living/carbon/C = user C.regenerate_limbs() C.regenerate_organs() to_chat(user, "You feel great!") - charges-- - ..() /obj/item/gun/magic/wand/resurrection/debug //for testing desc = "Is it possible for something to be even more powerful than regular magic? This wand is."