From 0cf227f71cbd80fa509d7eccdea1ead4ead8bc87 Mon Sep 17 00:00:00 2001 From: unv-annihilator Date: Wed, 13 Apr 2022 14:55:30 +0000 Subject: [PATCH] Fix moth's ability to eat mice infinitely (#66141) Adds a check to clothing.dm to prevent the ability to eat held mobs (like a mouse), which not only doesn't make sense but also does not remove the source mob correctly and gives an infinite food source for moths. Steps to reproduce the bug: Spawn in a mouse mob (living) As a Moth take the mouse into your hand Eat mouse Mouse will act as appropriate food for Moth's as well as will simply drop the held mouse on the ground allowing you to pick it up and eat again --- code/__DEFINES/is_helpers.dm | 2 ++ code/modules/clothing/clothing.dm | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/code/__DEFINES/is_helpers.dm b/code/__DEFINES/is_helpers.dm index a4932e54b66..93a62e81354 100644 --- a/code/__DEFINES/is_helpers.dm +++ b/code/__DEFINES/is_helpers.dm @@ -203,6 +203,8 @@ GLOBAL_LIST_INIT(turfs_openspace, typecacheof(list( #define isclothing(A) (istype(A, /obj/item/clothing)) +#define ispickedupmob(A) (istype(A, /obj/item/clothing/head/mob_holder)) // Checks if clothing item is actually a held mob + #define iscash(A) (istype(A, /obj/item/coin) || istype(A, /obj/item/stack/spacecash) || istype(A, /obj/item/holochip)) #define isbodypart(A) (istype(A, /obj/item/bodypart)) diff --git a/code/modules/clothing/clothing.dm b/code/modules/clothing/clothing.dm index 1a84714a8bd..9b205fb79c3 100644 --- a/code/modules/clothing/clothing.dm +++ b/code/modules/clothing/clothing.dm @@ -111,7 +111,7 @@ qdel(src) /obj/item/clothing/attack(mob/living/M, mob/living/user, params) - if(user.combat_mode || !ismoth(M)) + if(user.combat_mode || !ismoth(M) || ispickedupmob(src)) return ..() if(isnull(moth_snack)) moth_snack = new