A short debug print function in control.lua:
Code: Select all
local function on_built_entity(event)
game.print(event.tick)
game.print(event.entity.name)
game.print(event.entity.position)
game.print(event.entity.belt_to_ground_type)
-- event.entity.destroy()
end
script.on_event(defines.events.on_built_entity, on_built_entity, {{filter="type", type="underground-belt"}})
When the pair of undergrounds is built, you expect this script event to trigger twice. But instead, you get one merged trigger of the event, somehow printing the event once but both the belts separately.
It gets even weirder when you add an entity.destroy() call, where it seems to bug out the second underground belt's construction, and the response is incomplete. Somehow now only the position gets printed, and the belt_to_ground_type of the second underground is gone. Since you don't get the info that the second belt is an output belt, belt directions are all wrong.