Construction Drones deprecated

by Klonan

Adds ground based personal construction robots.

Content
3 years ago
0.17 - 1.0
389
Logistic network

b Drones inserts modules as inputs.

4 years ago

There are crushers in K2. If you cut and paste a crusher with production modules, the drones attempts to insert modules into the crusher but puts them as inputs instead of the modules slot.

Is this something that should be checked on Construction Drones or have it reported to K2. This doesn't happen using construction bots. If I cut and paste using bots, they insert the modules correctly.

4 years ago

I had the same problem and found a fix.

The problem is that the modules get inserted using the insert function on the LuaEntity (the crusher in our case), this should automatically select the correct inventory, but seems to prioritize the input over the modules if there is a compatible recipe that takes modules as input (which is the case in Krastorio).

My solution is to get the module inventory, and if it exists, insert into that, if the insertion fails (or there is no module inventory), fall back to the normal insert function.

In file script\construction_drone.lua, in the process_request_proxy_command function, at line 1829, replace:
local inserted = proxy_target.insert(stack)
with:
local inserted = 0
local moduleInv = proxy_target.get_module_inventory()

if moduleInv then
inserted = moduleInv.insert(stack)
end

if not moduleInv or inserted == 0 then
inserted = proxy_target.insert(stack)
end

I've tested this with a blueprint with few modules and some stone (which was added using a blueprint editor):
0eNptj9EOgjAMRf/lPg/DUED3K8YYgaqL0JFtGAnZv7thYnzwrb3tvadd0PQTjVazh1qgW8MO6rjA6Rtf+qT5eSQoaE8DBPgypO5hs9ZO7k4WQUBzRy8oGU4CxF57TZ+UtZnPPA1N3FTyn19gNC5aDCdajMlkud+UAnMqi3xTJkKkuzR3I1GXDaabeloD6Xql1utn5HzlrYDzhmNVhHTTerv6eVXgSdatyGIvd/XuUFe1zKuyCuENoHNZ7w==
And it seems to work completely.

New response