Skip to content

Instantly share code, notes, and snippets.

@kurtzilla
kurtzilla / remove_rocks_on_map.lua
Created October 24, 2024 04:14 — forked from morsk/remove_rocks_on_map.lua
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()
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>JS Bin</title>
</head>
<body>
<script id="jsbin-javascript">
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>JS Bin</title>
</head>
<body>
<script id="jsbin-javascript">
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>JS Bin</title>
</head>
<body>
<script id="jsbin-javascript">