Is there any way to read this property from a transport belt entity placed on the map? Obviously, entity.type property value is "transport-belt-to-ground". I can't find anything like that on wiki, but perhaps it exists in the game and is simply not listed there? Or is it not exposed to the LUA at all?createentity
Parameters:
...
Additional Entity-specific parameters
...
TransportBeltToGround
type ("output" or "input", defaults to "input")
Determining type of transport belt to ground
Determining type of transport belt to ground
When you create a transport belt to ground, you can specify whether it is input or output - wiki says:
My mods
Re: Determining type of transport belt to ground
I think something like
If you wanted to do something with it you could do like
Code: Select all
game.onevent(defines.events.onbuiltentity, function(event)
if event.createdentity.name == "transport-belt-to-ground" then
game.player.print event.createdentity.type
Code: Select all
if event.createdentity.type == input
then do stuff
else other stuff
Re: Determining type of transport belt to ground
Alas, event.createdentity.type value is also "transport-belt-to-ground", there is no indication whether it is input or output.
My mods
Re: Determining type of transport belt to ground
i guess you'll have to work with entity.direction. Find a belt to ground, get the direction, search for another belt to ground up to 4 tiles away and see if this has a direction that connects to the first one. Kind of messy
Re: Determining type of transport belt to ground
Thank you, that kind of workaround should work (in most cases ), I'll try. Perhaps I should write about it in Modding Interface Requests subforum.
EDIT: While experimenting, I found another workaround - position of input and output belts to ground is slightly different, i.e. input belt with direction = east for tile -10, -10 will have position -10.25, -10.5, while output belt with same direction on same tile will have position -10.75, -10.5 - I guess I will use that
EDIT: While experimenting, I found another workaround - position of input and output belts to ground is slightly different, i.e. input belt with direction = east for tile -10, -10 will have position -10.25, -10.5, while output belt with same direction on same tile will have position -10.75, -10.5 - I guess I will use that
My mods
Re: Determining type of transport belt to ground
Ha, and there i was, looking at your code and wondering where the hell you're searching for the other belt to groundkds71 wrote:EDIT: While experimenting, I found another workaround - position of input and output belts to ground is slightly different, i.e. input belt with direction = east for tile -10, -10 will have position -10.25, -10.5, while output belt with same direction on same tile will have position -10.75, -10.5 - I guess I will use that