mirror of
https://github.com/ParadiseSS13/Paradise.git
synced 2026-08-31 07:57:47 +01:00
Prevent stacks from being consumed by redspace. (#12661)
* Fix stacks being consumed by redspace. Fixes #12606 * Add comment on why (I think) the stack fix happens to work. * Fix a potential minor logic error. If the stack has no items left, we drop it, it gets merged with another stack on the ground, then we should still report the stack as having zero items. Otherwise there's a potential to accidentally use items on the ground once you run out of items in hand, which is slightly surprising.
This commit is contained in:
@@ -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,7 +307,11 @@
|
||||
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)
|
||||
if(amount < 1)
|
||||
// If you stand on top of a stack, and drop a - different - 0-amount stack on the floor,
|
||||
// the two get merged, so the amount of items in the stack can increase from the 0 that it had before.
|
||||
// Check the amount again, to be sure we're not qdeling healthy stacks.
|
||||
qdel(src)
|
||||
return TRUE
|
||||
return FALSE
|
||||
|
||||
|
||||
Reference in New Issue
Block a user