-- Define the initial machine groups and allowed tiles for each group.
local function build_allowed_entities()
local allowed = {}
local filters = {
--{ filter = "subgroup", subgroup = "inserter" },
{ filter = "subgroup", subgroup = "circuit-network" },
}
table.insert(filters, {
filter = "place-result",
elem_filters = {
{ filter = "type", type = "inserter" }
}
})
if script.active_mods["aai-containers"] then
table.insert(filters, { filter = "subgroup", subgroup = "container-1" })
end
--[[
if script.active_mods["kry-inserters"] then
table.insert(filters, { filter = "subgroup", subgroup = "shinyinserter1" })
table.insert(filters, { filter = "subgroup", subgroup = "shinyinserter2" })
end]]--
-- get items from filters
local items = {}
if filters[1] then
items = prototypes.get_item_filtered(filters)
end
for _, item in pairs(items) do
if item.place_result then
allowed[item.place_result.name] = true
end
end
-- storage group but only chest
local storage_filters = { { filter = "subgroup", subgroup = "storage" } }
local storage_items = prototypes.get_item_filtered(storage_filters)
for _, item in pairs(storage_items) do
if item.place_result and string.find(item.name, "chest") then
allowed[item.place_result.name] = true
end
end
-- logistic group but only chest
local logistic_filters = { { filter = "subgroup", subgroup = "logistic-network" } }
local logistic_items = prototypes.get_item_filtered(logistic_filters)
for _, item in pairs(logistic_items) do
if item.place_result and string.find(item.name, "chest") then
allowed[item.place_result.name] = true
end
end
-- logistic group but only chest
local belt_filters = { { filter = "subgroup", subgroup = "belt" } }
local belt_items = prototypes.get_item_filtered(belt_filters)
for _, item in pairs(belt_items) do
if item.place_result and string.find(item.name, "transport") then
allowed[item.place_result.name] = true
end
end
-- additional stuff
allowed["gun-turret"] = true
allowed["heavy-gun-turret"] = true
allowed["flamethrower-turret"] = true
allowed["rocket-turret"] = true
allowed["pipe"] = true
allowed["steel-chest"] = true
allowed["barreling-machine"] = true
allowed["radar"] = true
allowed["canex-excavator"] = true
allowed["entity-ghost"] = true
allowed["pump"] = true
allowed["long-range-delivery-drone-request-depot"] = true
allowed["cargo_ship"] = true
allowed["cargo_ship_engine"] = true
allowed["oil_tanker"] = true
allowed["indep-boat"] = true
allowed["boat_engine"] = true
allowed["oil_rig"] = true
allowed["or_power_electric"] = true
allowed["or_pole"] = true
allowed["or_radar"] = true
allowed["or_tank"] = true
return allowed
end