Page 1 of 1

LuaEntityPrototype - max_underground_distance

Posted: Fri Oct 21, 2016 2:13 am
by aubergine18
When looking at pipe-to-ground ("p-t-g") LuaEntityPrototype in control.lua, the `max_underground_distance` doesn't seem to be exposed - any chance it could be added?

Context: I'm using these entities for bridges, and when a segment (simple-entity) between two p-t-g's gets destroyed I search X tiles along relevant axis to find the "parent" p-t-g. To keep that search area small as possible, I've currently hard-coded the distance, but am at a point (remote interface) where it would really be better to pull it from LuaEntityPrototype rather than have two definitions of the value which could go out of sync.

Re: LuaEntityPrototype - max_underground_distance

Posted: Fri Oct 28, 2016 11:22 pm
by aubergine18
bumping for great justice

if there's any way this could be added to LuaFluidBox, or LuaEntity or LuaEntityPrototype, etc., it would be really, really useful.

Re: LuaEntityPrototype - max_underground_distance

Posted: Sat Oct 29, 2016 11:13 am
by orzelek
Take a look at DistancePlus mod. It adds longer pipes and has underground distance tag in fluid boxes.

Re: LuaEntityPrototype - max_underground_distance

Posted: Sat Oct 29, 2016 6:03 pm
by aubergine18
orzelek wrote:Take a look at DistancePlus mod. It adds longer pipes and has underground distance tag in fluid boxes.
Accessing the value from data.lua is trivial, it's accessing it from control.lua where I am having problem.

There are some workarounds, like I could iterate all the pipe-to-ground in data.lua, create a new fake entity and dump the underground lengths of all the p-t-g's in to it's .order property, but that's really hacky way to do things, hence wanting the max_underground_distance to be available in native Lua API via control.lua.

Re: LuaEntityPrototype - max_underground_distance

Posted: Mon Nov 07, 2016 2:29 pm
by Rseding91
The property already exists for underground belts but I added support for underground pipes in 0.15.

Re: LuaEntityPrototype - max_underground_distance

Posted: Tue Nov 08, 2016 4:45 am
by aubergine18
<3 Thank you!!