Code: Select all
-- Function to populate the placeableEntities table
local function populatePlaceableEntities()
for _, prototype in ipairs(game.entity_prototypes) do --I have tried pairs and ipairs here, ipairs seems to get through the function, but pairs errors out
-- Check if the entity is placeable and does not have the "not-blueprintable" flag
if not prototype.flags["not-blueprintable"] then
-- Create a copy of the entity with only necessary fields
local entityCopy = {
name = prototype.name,
selection_box = prototype.selection_box,
}
table.insert(placeableEntities, entityCopy) --This seems to be where pairs errors out at.
end
end
end