Page 1 of 1

[Rseding91] [1.1.35] Partially used ammunition stacks do not combine in player inventory

Posted: Fri Jul 02, 2021 10:56 am
by wyp020610
This is a bug with player inventory autosort merging partially used items.
I can now reliably reproduce this bug.
Step to reproduce:
1.Have a stack of 90 firearm magazine, and expend 5 ammo from this stack, and then put it in a chest
it should be 5/10 ammo
2.Have another stack of 199 firearm magazine, and expend 5 ammo from this stack, then put it in inventory
Should be like this after step 2
Should be like this after step 2
bug.jpg (837.55 KiB) Viewed 6214 times
3.Use mouse to pick up the 90 stack and drop the stack in inventory.
Using stack transfer hotkeys will work correctly, it's not affected by this glitch
4.Now I have a stack of 199(10/10) and a stack of 89(10/10) in inventory, with autosort on, but this is not sorted.
Broken!
Broken!
bug2.jpg (893.46 KiB) Viewed 6214 times
Expected result: I have a stack of 200(10/10) and 88(10/10) in inventory.

I also tested red science pack and repair kits, they are also affected by this glitch.

Re: [Rseding91] [1.1.35] Partially used ammunition stacks do not combine in player inventory

Posted: Fri Aug 13, 2021 3:13 pm
by Rseding91
Thanks for the report. It's now fixed for the next release.

Re: [Rseding91] [1.1.35] Partially used ammunition stacks do not combine in player inventory

Posted: Fri Aug 13, 2021 8:16 pm
by eradicator
Rseding91 wrote:
Fri Aug 13, 2021 3:13 pm
Thanks for the report. It's now fixed for the next release.
Kinda off topic maybe: I noticed that LuaInventory.remove{name =, count = } also ignores the .ammo value (1.5 - 1 = 1), even though LuaInventory.insert works as expected (0.5 + 1 = 1.5). Is that in any way related? Or is that intended behavior?

Re: [Rseding91] [1.1.35] Partially used ammunition stacks do not combine in player inventory

Posted: Sat Aug 14, 2021 4:07 pm
by Rseding91
Removing any .count from an item stack always does fill() and puts ammo/durability to max. It assumes you have consumed or transferred the value to some other item before you go to remove the count.

Re: [Rseding91] [1.1.35] Partially used ammunition stacks do not combine in player inventory

Posted: Sat Aug 14, 2021 4:28 pm
by eradicator
Rseding91 wrote:
Sat Aug 14, 2021 4:07 pm
Removing any .count from an item stack always does fill() and puts ammo/durability to max.
I see. Do you happen to know why remove does that and insert does not?
Rseding91 wrote:
Sat Aug 14, 2021 4:07 pm
It assumes you have consumed or transferred the value to some other item before you go to remove the count.
Well, I'm using *inventory* insert/remove so I don't even know how many stacks there are, let alone which and how many are partial. I'd have to iterate all slots which is too slow on the lua side.