Page 1 of 1

Looking for a lua way to delete all nuclear scorch marks

Posted: Sun Nov 29, 2020 9:28 pm
by Diablo
Hi,

Like the title says, i'm Looking for a lua way to delete all nuclear scorch marks.
I have had the need to clear out large specific sections of forests and the nuclear bomb was the best way to do this.
I know there is a way to remove trees via lua but I really didn't want to rely on lua to play the game.
I now realize the black scorch marks never go away. (like all other damage or dead entities)

Does anyone know a way?

Thank you.

Re: Looking for a lua way to delete all nuclear scorch marks

Posted: Sun Nov 29, 2020 9:40 pm
by darkfrei
Diablo wrote:
Sun Nov 29, 2020 9:28 pm
Like the title says, i'm Looking for a lua way to delete all nuclear scorch marks.

Code: Select all

/c
for i, surface in pairs (game.surfaces) do
  local entities = surface.find_entities_filtered{name="huge-scorchmark"}
  for j, entity in pairs (entities) do
    entity.destroy()
  end
end

Re: Looking for a lua way to delete all nuclear scorch marks

Posted: Sun Nov 29, 2020 10:10 pm
by ptx0
didn't wanna use lua, but now you're using lua ;)

Re: Looking for a lua way to delete all nuclear scorch marks

Posted: Sun Nov 29, 2020 10:11 pm
by Diablo
ptx0 wrote:
Sun Nov 29, 2020 10:10 pm
didn't wanna use lua, but now you're using lua ;)
Yup, sometimes you just gotta. :)

Re: Looking for a lua way to delete all nuclear scorch marks

Posted: Sun Nov 29, 2020 10:14 pm
by Diablo
darkfrei wrote:
Sun Nov 29, 2020 9:40 pm

Code: Select all

/c
for i, surface in pairs (game.surfaces) do
  local entities = surface.find_entities_filtered{name="huge-scorchmark"}
  for j, entity in pairs (entities) do
    entity.destroy()
  end
end
Thanks for the fast responds, awesome!
Unless I missed something, this, unfortunately, didn't work.
I copied everything and just pasted it.
No error messages or anything just nothing happend.
It looks like the huge scorch mark is not what is being used for the nuclear scorch marks.
If I use the editor to look for the scorch mark, the huge scorch marks are not the same marks.
In fact I can not find the scorch marks used for the nuclear explosion.

Re: Looking for a lua way to delete all nuclear scorch marks

Posted: Sun Nov 29, 2020 11:42 pm
by ptx0
it's because it actually changes the tile, there's no way to remove them without cloning the area around the scorch marks using lua.
Screenshot_20201129_154122.png
Screenshot_20201129_154122.png (39.71 KiB) Viewed 4448 times

Re: Looking for a lua way to delete all nuclear scorch marks

Posted: Mon Nov 30, 2020 8:06 am
by darkfrei
ptx0 wrote:
Sun Nov 29, 2020 11:42 pm
it's because it actually changes the tile, there's no way to remove them without cloning the area around the scorch marks using lua.

Screenshot_20201129_154122.png
Yeah, something like NiceFill mod.
https://mods.factorio.com/mod/nicefill

Re: Looking for a lua way to delete all nuclear scorch marks

Posted: Mon Nov 30, 2020 1:41 pm
by eradicator
Diablo wrote:
Sun Nov 29, 2020 9:28 pm
Does anyone know a way?
Damn, got nerd-sniped. Here you go.

Description

Uses partial surface cloning to restore original tiles overwritten by nuclear scorch marks. Applies only to the surface that you are currently on. The game will run extremely slow until fixing is completed. A chat message will be printed when completed. Will probably take a few minutes on really large maps.
DO NOT SAVE/LOAD DURING THE PROCESS.

Code

One-line easy copy/paste version:

Code: Select all

/c load(game.decode_string("eNptU8GO2yAQ/ZWpcgi0Dkqyt63Si+97ym21QgiPbRQbXMCrRFH+vQN2Gu8qHIyBmceb94bOadXBW2wL0O1oT0EO6KW+6A7hAC8F7LZb6HJQ2NFOo3oUQ6cu6EUYfa003o/392PtUUWU8zGLLkRvbMN6FVvhla1czzgvwk70apANWhkwRooIfMYqCYrVo9XROMs8h9p50GAskRANRjlxZRwqB/595X/tPg4a0FbgMY7egk8Lfr1ByqiQGLiLrFA7r6L5xHC1xPSwtiMVqvym8W601WZQUbfrW75OFmhjunJQxgdGMLWxlaRNEw0GWZsuosdqRmrHBjeB8HXbK39a3zI3IBrxfj/RhcwRgvZmiMJZaWMro9Enliz4X3EKNDWsSvgDW4gtWkgj0TIkzaosIIvZqzNblZvvzpFrvIDNbmKQxiSrptzy3Xz8zl9aWNN9CTjS3r3QaLpllYpMPWiRpuKZdqTaNBLv41feaYS98Ph3JCVkdMl09KlJZiOvWpx/vuypCcWF5lsBW75Mpco1fsuSM15gj9CsUAEL3478ocKj0MEFKjUKmk1SfBFwnKTJtiY59rnhkhqMosW5SMniwkUKyIsJ4ZB+bwug7PS9hJ0IMwpRIoJ+pNxadeExpT3+JHv6Q4qZoJ73TvJyys5vsMIOF28w7BdnA73GyNZvk38wNS2krqXX07tP1b1C6fohIVQ/1nzJgh7VP3MTVw4="))()
Full Version

Re: Looking for a lua way to delete all nuclear scorch marks

Posted: Mon Nov 30, 2020 5:03 pm
by Diablo
eradicator wrote:
Mon Nov 30, 2020 1:41 pm
[snip]
Thank you, this worked perfectly.
If I could upvote I would, again Thank you.

Re: Looking for a lua way to delete all nuclear scorch marks

Posted: Mon Nov 30, 2020 6:38 pm
by eradicator
Diablo wrote:
Mon Nov 30, 2020 5:03 pm
Thank you, this worked perfectly.
If I could upvote I would, again Thank you.
Np. If you ever see someone with the same problem just link them here ;).

[Edit: Also on second thought it's probably better if you remove the code-quote from your post so in the unlikely case that i need to "bugfix" my original post yours doesn't continue to show the old code.]

Re: Looking for a lua way to delete all nuclear scorch marks

Posted: Mon Nov 30, 2020 8:08 pm
by Koub
eradicator wrote:
Mon Nov 30, 2020 6:38 pm
[Edit: Also on second thought it's probably better if you remove the code-quote from your post so in the unlikely case that i need to "bugfix" my original post yours doesn't continue to show the old code.]
Took the liberty to do it myself, as I walked by.

Re: Looking for a lua way to delete all nuclear scorch marks

Posted: Wed Dec 02, 2020 11:12 am
by Diablo
Koub wrote:
Mon Nov 30, 2020 8:08 pm
eradicator wrote:
Mon Nov 30, 2020 6:38 pm
[Edit: Also on second thought it's probably better if you remove the code-quote from your post so in the unlikely case that i need to "bugfix" my original post yours doesn't continue to show the old code.]
Took the liberty to do it myself, as I walked by.
TY :D