Page 1 of 1
Script to remove decorations on already placed concrete
Posted: Tue May 25, 2021 4:49 pm
by JackGruff
Hi.
May someone please give me an up-to-date version of this script:
viewtopic.php?p=117691#p117691
Please
Re: Script to remove decorations on already placed concrete
Posted: Tue May 25, 2021 6:49 pm
by eradicator
The one in the link looks like it should still work if you replace "local_player" by just "player".
Re: Script to remove decorations on already placed concrete
Posted: Tue May 25, 2021 9:54 pm
by cbhj1
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
Posted: Wed May 26, 2021 12:57 pm
by JackGruff
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".
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'.
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
Re: Script to remove decorations on already placed concrete
Posted: Wed May 26, 2021 4:30 pm
by eradicator
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
Re: Script to remove decorations on already placed concrete
Posted: Thu May 27, 2021 10:58 am
by JackGruff
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
Thank you!