Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Define map boundaries
- local mapMinX, mapMinY = 0, 0
- local mapMaxX, mapMaxY = 1024, 1024
- -- Function to check if an entity's position is outside the map area
- local function isOutsideMapArea(position)
- local x, y = position[1], position[2]
- return x < mapMinX or x > mapMaxX or y < mapMinY or y > mapMaxY
- end
- -- Fetch all ASSET_GROUP entities
- for id, asset in pairs(game.interface.getEntities({radius = 1e42}, {type = "ASSET_GROUP", includeData = true})) do
- if asset.position and isOutsideMapArea(asset.position) then
- print("Removing entity with ID: " .. tostring(id)) -- Debugging line
- api.cmd.sendCommand(api.cmd.make.removeField(id)) -- Remove the entity
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement