Skip to content

Instantly share code, notes, and snippets.

@morsk
morsk / remove_rocks_on_map.lua
Last active December 30, 2024 14:43
remove rocks on map [Factorio]
/c --[[ remove rocks ]]
local function count_in(t, s)
t[s] = (t[s] or 0) + 1
end
local counts = {}
for _,e in pairs(game.player.surface.find_entities_filtered{type = {"simple-entity"}}) do
--[[ starts rock- , has -rock- in middle, or ends -rock ]]
if e.name:match("^rock%-") or e.name:match("%-rock%-") or e.name:match("%-rock$") then
count_in(counts, e.name)
e.destroy()