

local on_built_events = {defines.events.on_built_entity, defines.events.on_robot_built_entity,
    defines.events.script_raised_built, defines.events.script_raised_revive,
    defines.events.on_space_platform_built_entity, defines.events.on_entity_cloned
}

local drills = prototypes.mod_data["pure-drills"].data


for _, built in pairs(on_built_events) do 
    break
    
    script.on_event(built, function(event)
        local entity = event.entity
        if entity and drills[entity.name] then 
            game.print(entity) 
            local furnace = entity.surface.create_entity{
                name= "pure-furnace-"..entity.name, 
                position = entity.position, 
                direction = entity.direction,
                --mirror = entity["mirror"],
                force = entity.force,
                
                create_build_effect_smoke = false,
            }
            
            local pump = entity.surface.create_entity{
                name = "pure-pump-"..entity.name, 
                position = entity.position, 
                direction = entity.direction,
                --mirror = entity["mirror"],
                force = entity.force,
                --control_behavior = entity["control_behavior"],
                
                create_build_effect_smoke = false,
                fast_replace = true,
            }

            pump.add_fluid_box_linked_connection(0, furnace, 0)
        end
    end)
    script.set_event_filter(built, {{filter = "type", type = "mining-drill"}})
end