Looking for a lua way to delete all nuclear scorch marks
Looking for a lua way to delete all nuclear scorch marks
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.
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
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
didn't wanna use lua, but now you're using lua
Re: Looking for a lua way to delete all nuclear scorch marks
Thanks for the fast responds, awesome!darkfrei wrote: ↑Sun Nov 29, 2020 9:40 pmCode: 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
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
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.
Re: Looking for a lua way to delete all nuclear scorch marks
- eradicator
- Smart Inserter
- Posts: 5211
- Joined: Tue Jul 12, 2016 9:03 am
- Contact:
Re: Looking for a lua way to delete all nuclear scorch marks
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.
Mod support languages: 日本語, Deutsch, English
My code in the post above is dedicated to the public domain under CC0.
Re: Looking for a lua way to delete all nuclear scorch marks
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
Reason: [Koub] removed the content of the quote, so that if the code evolves, there is no confusion possible
- eradicator
- Smart Inserter
- Posts: 5211
- Joined: Tue Jul 12, 2016 9:03 am
- Contact:
Re: Looking for a lua way to delete all nuclear scorch marks
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.
Mod support languages: 日本語, Deutsch, English
My code in the post above is dedicated to the public domain under CC0.
Re: Looking for a lua way to delete all nuclear scorch marks
Took the liberty to do it myself, as I walked by.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.]
Koub - Please consider English is not my native language.
Re: Looking for a lua way to delete all nuclear scorch marks
TYKoub wrote: ↑Mon Nov 30, 2020 8:08 pmTook the liberty to do it myself, as I walked by.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.]