Non-straight underground belts

Place to get help with not working mods / modding interface.
Post Reply
DarkMatterMatt
Burner Inserter
Burner Inserter
Posts: 17
Joined: Tue Aug 15, 2017 7:53 am
Contact:

Non-straight underground belts

Post 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...

User avatar
Mylon
Filter Inserter
Filter Inserter
Posts: 513
Joined: Sun Oct 23, 2016 11:42 pm
Contact:

Re: Non-straight underground belts

Post 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!

Image

User avatar
Ranakastrasz
Smart Inserter
Smart Inserter
Posts: 2124
Joined: Thu Jun 12, 2014 3:05 am
Contact:

Re: Non-straight underground belts

Post by Ranakastrasz »

Ok, that is cool. Can't wait.

Obviously needs to apply to pipes as well :D

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?
My Mods:
Modular Armor Revamp - V16
Large Chests - V16
Agent Orange - V16
Flare - V16
Easy Refineries - V16

User avatar
Mylon
Filter Inserter
Filter Inserter
Posts: 513
Joined: Sun Oct 23, 2016 11:42 pm
Contact:

Re: Non-straight underground belts

Post 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!

User avatar
Ranakastrasz
Smart Inserter
Smart Inserter
Posts: 2124
Joined: Thu Jun 12, 2014 3:05 am
Contact:

Re: Non-straight underground belts

Post 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.
My Mods:
Modular Armor Revamp - V16
Large Chests - V16
Agent Orange - V16
Flare - V16
Easy Refineries - V16

Post Reply

Return to “Modding help”