I want to run code to modify the terrain wherever it gets nuked. I couldn't see any particular event that would be triggered on a nuke explosion. Currently I'm searching over the surface for 'nuclear-ground' tiles. This of course isn't particularly efficient on large maps.
Can you suggest a better way to get the location of a nuke explosion?
Catch nuke explosion event
-
- Smart Inserter
- Posts: 2768
- Joined: Tue Apr 25, 2017 2:01 pm
- Contact:
Re: Catch nuke explosion event
Like this mod does?
https://mods.factorio.com/mod/True-Nukes
https://mods.factorio.com/mod/True-Nukes
My Mods: Classic Factorio Basic Oil Processing | Sulfur Production from Oils | Wood to Oil Processing | Infinite Resources - Normal Yield | Tree Saplings (Redux) | Alien Biomes Tweaked | Restrictions on Artificial Tiles | New Gear Girl & HR Graphics
Re: Catch nuke explosion event
Wow, that is way better than what I'd planned. Thank you for the link. I'll just use that mod, but I still want to dig in and see 'how' they did it!
- Deadlock989
- Smart Inserter
- Posts: 2529
- Joined: Fri Nov 06, 2015 7:41 pm
-
- Fast Inserter
- Posts: 153
- Joined: Sun Jul 26, 2020 4:05 pm
- Contact:
Re: Catch nuke explosion event
Yeah, the mod works pretty much entirely with script triggers, which are caught on line 340-416 here:
https://github.com/More-Wrong/Factorio- ... ontrol.lua
and are generated from here:
https://github.com/More-Wrong/Factorio- ... osions.lua
each entry specifying an array of TriggerEffects:
https://wiki.factorio.com/Types/TriggerEffect
and the actual scripting done from the entries.
I generate the TriggerEffects and use them in different weapons, and that is all pretty indirect now - it's much clearer how it works in the pre-0.3.x updates, so try looking at the 0.2.13 update, with the github commit:
https://github.com/More-Wrong/Factorio- ... kes_0.2.13
If you want to do it yourself, you can look at:
https://wiki.factorio.com/Prototype_definitions
https://github.com/More-Wrong/Factorio- ... ontrol.lua
and are generated from here:
https://github.com/More-Wrong/Factorio- ... osions.lua
each entry specifying an array of TriggerEffects:
https://wiki.factorio.com/Types/TriggerEffect
and the actual scripting done from the
Code: Select all
type="script"
I generate the TriggerEffects and use them in different weapons, and that is all pretty indirect now - it's much clearer how it works in the pre-0.3.x updates, so try looking at the 0.2.13 update, with the github commit:
https://github.com/More-Wrong/Factorio- ... kes_0.2.13
If you want to do it yourself, you can look at:
https://wiki.factorio.com/Prototype_definitions