Jump to content

ReceiveItem in container_classified.lua should use PreviewStackSize instead of StackSize


Legend_Master
  • Known Issue

This is causing this bug on client (when you enable caves/playing in a server), and can be fixed by this patch

diff --git a/prefabs/container_classified.lua b/prefabs/container_classified.lua
index 166352e..871420a 100644
--- a/prefabs/container_classified.lua
+++ b/prefabs/container_classified.lua
@@ -620,7 +620,7 @@ end
 local function ReceiveItem(inst, item, count, forceslot)
     if not IsBusy(inst) and (forceslot == nil or (forceslot >= 1 and forceslot <= #inst._items)) then
         local isstackable = item.replica.stackable ~= nil
-        local originalstacksize = isstackable and item.replica.stackable:StackSize() or 1
+        local originalstacksize = isstackable and item.replica.stackable:PreviewStackSize() or 1
         local container = inst._parent.replica.container
         if forceslot == nil and container ~= nil then
             forceslot = container:GetSpecificSlotForItem(item)
@@ -651,7 +651,7 @@ local function ReceiveItem(inst, item, count, forceslot)
                 elseif slotitem.prefab == item.prefab and slotitem.AnimState:GetSkinBuild() == item.AnimState:GetSkinBuild() and --slotitem.skinname == item.skinname (this does not work on clients, so we're going to use the AnimState hack instead)
                     slotitem.replica.stackable ~= nil and
                     not slotitem.replica.stackable:IsFull() then
-                    local stacksize = slotitem.replica.stackable:StackSize() + count
+                    local stacksize = slotitem.replica.stackable:PreviewStackSize() + count
                     local maxsize = slotitem.replica.stackable:MaxSize()
                     if stacksize > maxsize then
                         count = math.max(stacksize - maxsize, 0)

Steps to Reproduce

See the video above

  • Sanity 1



User Feedback


I didn't see what this bug will affect in your video

Is that means your can't shift+MBL things into your bag slots?

Share this comment


Link to comment
Share on other sites

On 10/25/2023 at 3:14 PM, july401 said:

Is that means your can't shift+MBL things into your bag slots?

Yes, you can't shift + left click the item to move it to your inventory/backpack

  • Like 1

Share this comment


Link to comment
Share on other sites



Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
  • Create New...