https://mods.factorio.com/mod/automatic ... connectors
TL;DR: How can I reliably determine when to place concrete and/or ice platform under a new ghost or entity on Aquilo?
The goal of this mod is that when you place an underground pipe, a pipe gets placed automatically in situations where that's obviously appropriate.
The basic behavior was pretty easy to implement. I never noticed that it didn't work when the pipe needed landfill placed under it, and folks seemed content.
Then Space Age came out and automatically placing foundation tiles under ghost construction became a lot more common. I was able to handle landfill, space platforms, and foundations with some combination of can_fast_replace, can_place_entity, entity_prototype_collides, etc.
Then I got stuck on Aquilo. I wasn't able to reliably figure out when to put concrete and ice platforms under the pipe. Or what kind of concrete.
I eventually gave up on trying to implement those checks manually. I changed gears to take advantage of the game engine's handling of placement in those situations. My solution was to swap out the cursor stack then use build_from_cursor to place the pipe, which got me all the necessary tile placements with no extra logic on my end.
Then I discovered that underground pipe dragging broke if you did another build_from_cursor while dragging.
I worked around that issue by waiting to the end of the tick then destroying and re-build_from_cursor-ing the underground pipe, to trick the game into putting it back into the drag status.
But then I started running into problems with other mods invalidating my stored reference to the underground pipe, and my mod causing the same problem for theirs.
So here I am, back to the drawing board, and rethinking that very first decision to use place_from_cursor at all. And that is why I turn to you... How can I reliably determine when to place concrete and/or ice platform under a new ghost or entity on Aquilo? Or do you have alternative ideas to surmount one of the other hurdles I ran into along the way?
Placing pipes in response to placing underground pipes, a variety of roadblocks
Re: Placing pipes in response to placing underground pipes, a variety of roadblocks
Hello,
Maybe, you can get the tile where the pipe should be placed with surface.get_tile(x,y)
And then determine if you need concrete and/or ice platform
Maybe, you can get the tile where the pipe should be placed with surface.get_tile(x,y)
And then determine if you need concrete and/or ice platform