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

This subforum contains all the issues which we already resolved.
Post Reply
wyp020610
Manual Inserter
Manual Inserter
Posts: 3
Joined: Fri Jul 02, 2021 9:38 am
Contact:

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

Post 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 6212 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 6212 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.
Attachments
test.zip
The savefile I used to test the bug
(2.13 MiB) Downloaded 248 times

Rseding91
Factorio Staff
Factorio Staff
Posts: 13209
Joined: Wed Jun 11, 2014 5:23 am
Contact:

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

Post by Rseding91 »

Thanks for the report. It's now fixed for the next release.
If you want to get ahold of me I'm almost always on Discord.

User avatar
eradicator
Smart Inserter
Smart Inserter
Posts: 5206
Joined: Tue Jul 12, 2016 9:03 am
Contact:

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

Post 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?
Author of: Belt Planner, Hand Crank Generator, Screenshot Maker, /sudo and more.
Mod support languages: 日本語, Deutsch, English
My code in the post above is dedicated to the public domain under CC0.

Rseding91
Factorio Staff
Factorio Staff
Posts: 13209
Joined: Wed Jun 11, 2014 5:23 am
Contact:

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

Post 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.
If you want to get ahold of me I'm almost always on Discord.

User avatar
eradicator
Smart Inserter
Smart Inserter
Posts: 5206
Joined: Tue Jul 12, 2016 9:03 am
Contact:

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

Post 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.
Author of: Belt Planner, Hand Crank Generator, Screenshot Maker, /sudo and more.
Mod support languages: 日本語, Deutsch, English
My code in the post above is dedicated to the public domain under CC0.

Post Reply

Return to “Resolved Problems and Bugs”