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
This commit is contained in:
unv-annihilator
2022-04-13 15:55:30 +01:00
committed by GitHub
parent 9e5caeef06
commit 0cf227f71c
2 changed files with 3 additions and 1 deletions
+2
View File
@@ -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))
+1 -1
View File
@@ -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