Goal: When you drop a logistic storage container (over an existing chest) it will check to see if there's an inserter for the container, and if that inserter takes from an assembler. If so, the mod will set the filter for the container to match the assembler's output. Further, it will remove the inventory block, if any, and replace it with a circuit network override on the inserter (i.e., "blue belts < 1000").
Just getting started, but when I'm having trouble with inserters.
Code: Select all
script.on_event(defines.events.on_built_entity, function(event)
local box = event.created_entity
local player = game.get_player(event.player_index)
local surface = player.surface
local inserters = surface.find_entities_filtered {
-- TODO: Maybe entity.collision_box would work instead
position = box.position,
type = "inserter",
radius = 1.0
}
I think I can use drop_position and compare it to box.position, but I'm wondering if there's a correct way to do this, i.e., a built-in function on the LuaEntity that I'm missing?