From a24013be5b9cea17bcad4cb904cfdfdafe3d934d Mon Sep 17 00:00:00 2001 From: moxian Date: Mon, 28 Oct 2019 10:19:52 +0000 Subject: [PATCH] Fix stacks being consumed by redspace. Fixes #12606 --- code/game/objects/items/stacks/stack.dm | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/code/game/objects/items/stacks/stack.dm b/code/game/objects/items/stacks/stack.dm index a4141a7a58a..793eb1062d5 100644 --- a/code/game/objects/items/stacks/stack.dm +++ b/code/game/objects/items/stacks/stack.dm @@ -296,6 +296,8 @@ else return ..() +// Returns TRUE if the stack amount is zero. +// Also qdels the stack gracefully if it is. /obj/item/stack/proc/zero_amount() if(amount < 1) if(isrobot(loc)) @@ -305,8 +307,9 @@ if(ismob(loc)) var/mob/living/L = loc // At this stage, stack code is so horrible and atrocious, I wouldn't be all surprised ghosts can somehow have stacks. If this happens, then the world deserves to burn. L.unEquip(src, TRUE) - qdel(src) - return TRUE + if(amount < 1) // check again. Dropping the stuff could have incresed the amount in src (somehow...) + qdel(src) + return TRUE return FALSE /obj/item/stack/proc/merge(obj/item/stack/S) //Merge src into S, as much as possible