Looking for a lua way to delete all nuclear scorch marks

Don't know how to use a machine? Looking for efficient setups? Stuck in a mission?
Post Reply
Diablo
Inserter
Inserter
Posts: 46
Joined: Thu Apr 21, 2016 12:35 pm
Contact:

Looking for a lua way to delete all nuclear scorch marks

Post 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.

User avatar
darkfrei
Smart Inserter
Smart Inserter
Posts: 2903
Joined: Thu Nov 20, 2014 11:11 pm
Contact:

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

Post 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

User avatar
ptx0
Smart Inserter
Smart Inserter
Posts: 1507
Joined: Wed Jan 01, 2020 7:16 pm
Contact:

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

Post by ptx0 »

didn't wanna use lua, but now you're using lua ;)

Diablo
Inserter
Inserter
Posts: 46
Joined: Thu Apr 21, 2016 12:35 pm
Contact:

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

Post 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. :)

Diablo
Inserter
Inserter
Posts: 46
Joined: Thu Apr 21, 2016 12:35 pm
Contact:

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

Post 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.

User avatar
ptx0
Smart Inserter
Smart Inserter
Posts: 1507
Joined: Wed Jan 01, 2020 7:16 pm
Contact:

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

Post 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 4151 times

User avatar
darkfrei
Smart Inserter
Smart Inserter
Posts: 2903
Joined: Thu Nov 20, 2014 11:11 pm
Contact:

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

Post 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

User avatar
eradicator
Smart Inserter
Smart Inserter
Posts: 5206
Joined: Tue Jul 12, 2016 9:03 am
Contact:

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

Post 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
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.

Diablo
Inserter
Inserter
Posts: 46
Joined: Thu Apr 21, 2016 12:35 pm
Contact:

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

Post 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.
Last edited by Koub on Mon Nov 30, 2020 8:07 pm, edited 1 time in total.
Reason: [Koub] removed the content of the quote, so that if the code evolves, there is no confusion possible

User avatar
eradicator
Smart Inserter
Smart Inserter
Posts: 5206
Joined: Tue Jul 12, 2016 9:03 am
Contact:

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

Post 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.]
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.

Koub
Global Moderator
Global Moderator
Posts: 7199
Joined: Fri May 30, 2014 8:54 am
Contact:

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

Post 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.
Koub - Please consider English is not my native language.

Diablo
Inserter
Inserter
Posts: 46
Joined: Thu Apr 21, 2016 12:35 pm
Contact:

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

Post 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

Post Reply

Return to “Gameplay Help”