Hi.
May someone please give me an up-to-date version of this script: viewtopic.php?p=117691#p117691
Please
Script to remove decorations on already placed concrete
- eradicator
- Smart Inserter
- Posts: 5211
- Joined: Tue Jul 12, 2016 9:03 am
- Contact:
Re: Script to remove decorations on already placed concrete
The one in the link looks like it should still work if you replace "local_player" by just "player".
Author of: Belt Planner, Hand Crank Generator, Screenshot Maker, /sudo and more.
Mod support languages: 日本語, Deutsch, English
My code in the post above is dedicated to the public domain under CC0.
Mod support languages: 日本語, Deutsch, English
My code in the post above is dedicated to the public domain under CC0.
Re: Script to remove decorations on already placed concrete
might need to adjust the tile specification depending on what concrete is being used in the base
Re: Script to remove decorations on already placed concrete
It doesn't. This is a multiplayer game if that matters. I've disabled all the mods but RSO. I changed the item name to 'refined-concrete'.eradicator wrote: ↑Tue May 25, 2021 6:49 pm The one in the link looks like it should still work if you replace "local_player" by just "player".
Script so far:
Code: Select all
/c for coord in game.player.surface.get_chunks() do
for key, e in pairs(game.player.surface.find_entities_filtered({area={{coord.x * 32, coord.y * 32}, {coord.x * 32 + 32, coord.y * 32 + 32}}, type="decorative"})) do
if game.player.surface.get_tile(e.position.x, e.position.y).name == "refined-concrete" then
e.destroy()
end
end
end
- eradicator
- Smart Inserter
- Posts: 5211
- Joined: Tue Jul 12, 2016 9:03 am
- Contact:
Re: Script to remove decorations on already placed concrete
Oh right, decoratives stopped to be entities at some point. It all works differently now. This cleans with half a tile radius, without radius the result isn't quite what I expected. Feel free to add in any other tile types you want cleaned.
Code: Select all
/c
local s = game.player.surface
local f = s.destroy_decoratives
local r = 0.5
for _, tile in pairs(s.find_tiles_filtered{name = {'concrete', 'refined-concrete'}}) do
local pos = tile.position
f{area = {{pos.x-r, pos.y-r}, {pos.x+r,pos.y+r}}}
end
Author of: Belt Planner, Hand Crank Generator, Screenshot Maker, /sudo and more.
Mod support languages: 日本語, Deutsch, English
My code in the post above is dedicated to the public domain under CC0.
Mod support languages: 日本語, Deutsch, English
My code in the post above is dedicated to the public domain under CC0.
Re: Script to remove decorations on already placed concrete
Thank you!eradicator wrote: ↑Wed May 26, 2021 4:30 pm Oh right, decoratives stopped to be entities at some point. It all works differently now. This cleans with half a tile radius, without radius the result isn't quite what I expected. Feel free to add in any other tile types you want cleaned.Code: Select all
/c local s = game.player.surface local f = s.destroy_decoratives local r = 0.5 for _, tile in pairs(s.find_tiles_filtered{name = {'concrete', 'refined-concrete'}}) do local pos = tile.position f{area = {{pos.x-r, pos.y-r}, {pos.x+r,pos.y+r}}} end