Last active
December 30, 2024 14:43
-
-
Save morsk/8d9f78fdcc2cf465cc688177a176f302 to your computer and use it in GitHub Desktop.
remove rocks on map [Factorio]
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/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() | |
end | |
end | |
game.print("removed rocks:") | |
for name,count in pairs(counts) do | |
game.print(" "..name..": "..count) | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment