Page 1 of 1
Non-straight underground belts
Posted: Wed Dec 20, 2017 4:22 am
by DarkMatterMatt
Is it possible to use the built-in type "underground-belt" to create non-straight (i.e. moves five right, one up) underground belts? I'd like to make a belt which looks "right" when traversing cliffs, so going down a cliff would make the belt go down one tile.
Ideally I would be able to manually set the "neighbours" attribute of the LuaEntity, but it's read-only...
Re: Non-straight underground belts
Posted: Wed Dec 20, 2017 2:04 pm
by Mylon
Underground belts search for their neighbor on building and saving/loading. They don't store who their neighbor is. This logic has to be strictly deterministic independent of order or it can change on load, causing a desync.
But I'm definitely looking into it!

Re: Non-straight underground belts
Posted: Wed Dec 20, 2017 2:42 pm
by Ranakastrasz
Ok, that is cool. Can't wait.
Obviously needs to apply to pipes as well
Hmm. Can probably scan on placement somehow, and shift the scan up/down one tiles for left/right cliffs. I have a vague idea of how you might do it.
If you load the game, and it resets the connection, and you, on... load? (that can't be the right one, because on_load isn't multiplayer friendly or something) force it to reconnect the same way... What happens to the items in the tunnel?
Re: Non-straight underground belts
Posted: Wed Dec 20, 2017 3:49 pm
by Mylon
Cliffs overlap so a simple "is there a cliff in this tile?" check may end up counting a cliff twice or counting two overlapping cliffs and resulting in an extreme offset. I can't limit the check to only one elevation change or there can be circumstances where an UB cannot bridge a short u-bend of cliffs, or two cliffs close together would line up with only a single offset. Additionally, the process needs to work in reverse, pathing from the other UB. It's tricky business!
Re: Non-straight underground belts
Posted: Wed Dec 20, 2017 4:39 pm
by Ranakastrasz
Mylon wrote:Cliffs overlap so a simple "is there a cliff in this tile?" check may end up counting a cliff twice or counting two overlapping cliffs and resulting in an extreme offset. I can't limit the check to only one elevation change or there can be circumstances where an UB cannot bridge a short u-bend of cliffs, or two cliffs close together would line up with only a single offset. Additionally, the process needs to work in reverse, pathing from the other UB. It's tricky business!
Hmm, true enough. Can probably detect if they are side-by-side by coordinates being vertically adjacent to each other.
Corners however might be more complex.
Still, Setup some logic, test it, figure out exactly what needs to be handled.