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}