Page 1 of 1

Make source/target inventories of inserters writeable

Posted: Wed Aug 01, 2018 11:39 pm
by Allaizn
Currently, inserters always figure out by themselves which inventory they interact with, if multiple are possible.
The current behavoir allows us to manipulate this through build order. Consider the following setup:
im2.png
im2.png (652.29 KiB) Viewed 2922 times
The car is positioned in such a way that all four inserters are able to interact with it, but two of them would prefer the beacons if they had the choice.
We can "trick" them into choosing the car anyway by placing the beacons after the car and after the inserters.
It's currently rather tedious to correct the link between inserters and inventories, especially on if you need to check multiple thousands. Note that this is only one example of many: similar interactions happen for belt vs car, assembler vs car, etc., too.

It would be nice if I could write some lua script that does that for me.
This is especially important since the new editor clone tool does not copy this link, which can again be at least fixed by a helper script/mod.

I'm not sure on whether or not any entity should be allowed, or only ones that are actually reachable, but I'd say either is fine, so please implement whatever is easier :)

Re: Make source/target inventories of inserters writeable

Posted: Sat Aug 11, 2018 7:04 am
by Rseding91
If I find time I'll try to see if this can be implemented in a safe way.

Re: Make source/target inventories of inserters writeable

Posted: Sun Aug 12, 2018 1:56 pm
by eradicator
This would also greatly help modding concepts that have multiple hidden entities overlapping each other (i.e. miniloader). The current behavior as far as i can tell is that inserters dynamically chose a new input inventory if the current one is empty for some time. Would be a great help if that dynamic changing of in/output could be disabled and replaced by script-set forced in/out inventories. (simply disabling the dynamic changing would already be pretty helpful. build-order is easy to manipulate for create_entity.)

Re: Make source/target inventories of inserters writeable

Posted: Wed Aug 15, 2018 8:25 pm
by Therax
Duplicate / additional use case for my request here? viewtopic.php?f=28&t=61442

Re: Make source/target inventories of inserters writeable

Posted: Thu Aug 16, 2018 3:10 am
by mulark
Here's a bit of lua I made for copying 1 area (ie 1 blueprint + cars) as many times as specified. Basic usage is to start at y = 0 and go north for N tiles that your design will encompass. Supply N to the script. And then run the first command to copy everything except beacons. The second command copies all the beacons. I tried to make both commands in 1 "line" but even when beacons were placed second, it seems like they still were placed in the same tick, so the inserters did not link properly.

https://gist.github.com/mulark/bf2b8f63 ... 773ec2dd85