[Genhis] [1.1.57] Setting item_requests on item request proxy with multiple items seems broken

This subforum contains all the issues which we already resolved.
Post Reply
SWeini
Inserter
Inserter
Posts: 33
Joined: Mon Apr 04, 2022 6:43 am
Contact:

[Genhis] [1.1.57] Setting item_requests on item request proxy with multiple items seems broken

Post by SWeini »

Hello guys,

I was playing around with nanobots and some other mods.
I copy&pasted an entity with 2 prod, 1 speed and 1 eff module, had no modules in inventory
then I grabbed a bunch of prod modules and nanobots filled all 4 module slots with prod modules

I drilled down a bit and to me it looks like setting the item_requests on an item request proxy is broken.

it comes down to this call sequence:

Code: Select all

local proxy = <some-item-request-proxy>
local requests = proxy.item_requests
-- requests is now {["effectivity-module"] = 1, ["productivity-module"] = 2, ["speed-module"] = 1}
-- the 2 prod modules were inserted into the entity by nanobots and should be removed from the request
requests["productivity-module"] = requests["productivity-module"] - 2
-- removing 0 values
requests["productivity-module"] = nil
-- requests is now {["effectivity-module"] = 1, ["speed-module"] = 1}
-- save to entity
proxy.item_requests = requests
local wrong_requests = proxy.item_requests
-- wrong_requests is now {["effectivity-module"] = 1, ["productivity-module"] = 2}
I can share more info if needed, just ask.

Loewchen
Global Moderator
Global Moderator
Posts: 8301
Joined: Wed Jan 07, 2015 5:53 pm
Contact:

Re: [1.1.57] Setting item_requests on item request proxy with multiple items seems broken

Post by Loewchen »

Post a simple save and steps that produce the issue please.

SWeini
Inserter
Inserter
Posts: 33
Joined: Mon Apr 04, 2022 6:43 am
Contact:

Re: [1.1.57] Setting item_requests on item request proxy with multiple items seems broken

Post by SWeini »

this is what you should see when you open the save (sorry for the huge modpack, but looks like I need at least 4 module slots for reproducing):
step0.png
step0.png (284.38 KiB) Viewed 2813 times
then you grab the production modules (and only those) from the box. the nanobots will do their work.

after supplying the two production modules it looks like this:
step1.png
step1.png (33.09 KiB) Viewed 2813 times
due to the bug they try to supply another two production modules, will look like this:
step2.png
step2.png (17.38 KiB) Viewed 2813 times
or the total situation:
final.png
final.png (229.93 KiB) Viewed 2813 times
if you add logging statements into "Nanobots_3.2.17\scripts\nanobots.lua" as shown here
log_code.png
log_code.png (34.9 KiB) Viewed 2813 times
you are going to see the behavior clearly
log_output.png
log_output.png (119.27 KiB) Viewed 2813 times
Attachments
item_requests repro.zip
(3.36 MiB) Downloaded 100 times

SWeini
Inserter
Inserter
Posts: 33
Joined: Mon Apr 04, 2022 6:43 am
Contact:

Re: [1.1.57] Setting item_requests on item request proxy with multiple items seems broken

Post by SWeini »

I might have not played vanilla for too long - the assembling machine 3 has 4 module slots as well :)

I've attached another savegame with only nanobots mod, same bug, grab the production modules and see the nanobots fail
Attachments
item_requests repro2.zip
(2.72 MiB) Downloaded 93 times

Genhis
Factorio Staff
Factorio Staff
Posts: 118
Joined: Wed Dec 24, 2014 8:19 am
Contact:

Re: [Genhis] [1.1.57] Setting item_requests on item request proxy with multiple items seems broken

Post by Genhis »

Thanks for the report and for the attached save, it made testing a lot easier. :) The issue is fixed for the next release.

SWeini
Inserter
Inserter
Posts: 33
Joined: Mon Apr 04, 2022 6:43 am
Contact:

Re: [Genhis] [1.1.57] Setting item_requests on item request proxy with multiple items seems broken

Post by SWeini »

Thanks a lot for the quick fix. You guys are the best.

P.S.: I'm a software dev myself, so I know the benefits of a good repro case. :D

Post Reply

Return to “Resolved Problems and Bugs”