Page 1 of 1

Script create_entity with fast_replace should replace belts between undergrounds

Posted: Tue Nov 22, 2022 12:11 pm
by Theis
It would be nice if when using LuaSurface.create_entity to place the second underground belt or pipe to ground, if the transport belts or pipes between the pair were removed.
fast-replace-belt.png
fast-replace-belt.png (408.92 KiB) Viewed 1375 times
Top manual placement, bottom is placement through script.

Why?
It matches the description better
If true, building will attempt to simulate fast-replace building.
It matches the expectation, that when adding the second underground the game cleans up the extra entities.


It is for a TAS run, so simulating player behavior is critical. However i can also see, that i will be one the few people who need it.

Re: Script create_entity with fast_replace should replace belts between undergrounds

Posted: Tue Nov 22, 2022 12:42 pm
by Xorimuth
I'd have thought that for a TAS run, player.build_from_cursor would be used. Idk if it has this functionality though.

Re: Script create_entity with fast_replace should replace belts between undergrounds

Posted: Fri Nov 25, 2022 5:18 am
by ssilk
I’m not sure, if those belts can be removed in any case without breaking something. :)

Re: Script create_entity with fast_replace should replace belts between undergrounds

Posted: Fri Nov 25, 2022 1:59 pm
by Nidan
ssilk wrote:
Fri Nov 25, 2022 5:18 am
I’m not sure, if those belts can be removed in any case without breaking something. :)
That doesn't matter. When manually placing the second underground belt, factorio will remove the belts in between, if they go in the same direction as the underground belt. OP is asking for the same action but triggered by script to do the same.

But, when trying to act like a player, the removed belts and their content need to go somewhere... Being a player sounds most reasonable:
Xorimuth wrote:
Tue Nov 22, 2022 12:42 pm
I'd have thought that for a TAS run, player.build_from_cursor would be used. Idk if it has this functionality though.

Re: Script create_entity with fast_replace should replace belts between undergrounds

Posted: Wed Nov 30, 2022 5:58 am
by ssilk
Ah, this belongs to mod requests. Totally overseen. Moved.

Re: Script create_entity with fast_replace should replace belts between undergrounds

Posted: Mon Dec 05, 2022 11:17 am
by Theis
Xorimuth wrote:
Tue Nov 22, 2022 12:42 pm
I'd have thought that for a TAS run, player.build_from_cursor would be used. Idk if it has this functionality though.
I suppose it is worth a try.
I managed to recreate the functionality myself, so it isn't critical to change any more.