Page 1 of 1

How to check rail bridge length in Lua?

Posted: Sun Jan 09, 2022 7:30 pm
by smallfly
Hey together,

any tipps how to check the rail bridge length during building a rail bridge? I want to limit the maximum bridge length to a certain amount of straight rails (e.g. max 20 straight rails). On building the 21st rail, the rail placement should be inhibited.

How to check the built object right next to the current building position?

Thanks in advance for your tipps!

Re: How to check rail bridge length in Lua?

Posted: Sun Jan 09, 2022 7:41 pm
by Pi-C
smallfly wrote: Sun Jan 09, 2022 7:30 pm How to check the built object right next to the current building position?
In your case, entity.get_connected_rail should do the trick.

Re: How to check rail bridge length in Lua?

Posted: Sat Jan 22, 2022 9:37 am
by smallfly
I will try that. Thank you so far!