From f9769061b1d87fc0f9f9a686692ddcc925c5f932 Mon Sep 17 00:00:00 2001 From: Kashargul <144968721+Kashargul@users.noreply.github.com> Date: Mon, 13 Jan 2025 01:53:19 +0100 Subject: [PATCH 1/2] prevent sheet snatcher overflow --- code/game/objects/items/weapons/storage/bags.dm | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/code/game/objects/items/weapons/storage/bags.dm b/code/game/objects/items/weapons/storage/bags.dm index 22ca942f6a5..b1a7fc39d80 100644 --- a/code/game/objects/items/weapons/storage/bags.dm +++ b/code/game/objects/items/weapons/storage/bags.dm @@ -310,6 +310,7 @@ var/amount var/inserted = 0 var/current = 0 + var/old_loc = S.loc for(var/obj/item/stack/material/S2 in contents) current += S2.get_amount() if(capacity < current + S.get_amount())//If the stack will fill it up @@ -330,7 +331,12 @@ if (usr.client && usr.s_active != src) usr.client.screen -= S S.dropped(usr) - S.loc = src + if(capacity < current + S.get_amount()) + var/obj/item/stack/F = S.split(amount) + S.forceMove(old_loc) + F.loc = src + else + S.loc = src orient2hud(usr) if(usr.s_active) From fee5b21783f3031eb36fca104d23ec9c4945cec5 Mon Sep 17 00:00:00 2001 From: Kashargul <144968721+Kashargul@users.noreply.github.com> Date: Mon, 13 Jan 2025 02:01:36 +0100 Subject: [PATCH 2/2] Update bags.dm --- code/game/objects/items/weapons/storage/bags.dm | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/code/game/objects/items/weapons/storage/bags.dm b/code/game/objects/items/weapons/storage/bags.dm index b1a7fc39d80..4f9ad56efbf 100644 --- a/code/game/objects/items/weapons/storage/bags.dm +++ b/code/game/objects/items/weapons/storage/bags.dm @@ -310,7 +310,6 @@ var/amount var/inserted = 0 var/current = 0 - var/old_loc = S.loc for(var/obj/item/stack/material/S2 in contents) current += S2.get_amount() if(capacity < current + S.get_amount())//If the stack will fill it up @@ -327,15 +326,14 @@ break if(!inserted) - usr.remove_from_mob(S) - if (usr.client && usr.s_active != src) - usr.client.screen -= S - S.dropped(usr) if(capacity < current + S.get_amount()) var/obj/item/stack/F = S.split(amount) - S.forceMove(old_loc) F.loc = src else + usr.remove_from_mob(S) + if (usr.client && usr.s_active != src) + usr.client.screen -= S + S.dropped(usr) S.loc = src orient2hud(usr)