HelicopterRevival


Adds a fully animated attack helicopter to the game. Ideal for getting from A to B quickly, exploring the map, building islands and nuking biters from the sky. Originally forked from Kumpu with fixes for Factorio 0.18.2+, but adding some enhancements of my own as well.

Content
a month ago
0.18 - 2.0
80.2K
Transportation

b Crash when mining old vehicle from original mod

4 years ago

I was trying to figure out why I couldn't call or remote-control any of the helicopters we placed in multiplayer under 0.17 using the original mod, and when I tried to mine one of them and re-build it to see if that would work, this error crashed the server:

1282.908 Error MainLoop.cpp:1202: Exception at tick 30454907: The mod HelicopterRevival (0.0.4) caused a non-recoverable
 error.
Please report this error to the mod author.

Error while running event HelicopterRevival::on_player_mined_entity (ID 65)
__HelicopterRevival__/control.lua:158: bad argument #1 of 2 to 'ipairs' (table expected, got nil)
stack traceback:
        [C]: in function 'ipairs'
        __HelicopterRevival__/control.lua:158: in function <__HelicopterRevival__/control.lua:151>
1282.909 Error ServerMultiplayerManager.cpp:90: MultiplayerManager failed: "The mod HelicopterRevival (0.0.4) caused a n
on-recoverable error.
Please report this error to the mod author.

Error while running event HelicopterRevival::on_player_mined_entity (ID 65)
__HelicopterRevival__/control.lua:158: bad argument #1 of 2 to 'ipairs' (table expected, got nil)
stack traceback:
        [C]: in function 'ipairs'
        __HelicopterRevival__/control.lua:158: in function <__HelicopterRevival__/control.lua:151>"

I'm guessing there's some internal state not preserved when switching from the old mod to the new, that needs to be rebuilt. Perhaps a migration script could do this?

4 years ago

Yeah.
The problem is that Helicopters and this mod are using the same identifiers, even though the name of the mod is different.

I think this is / was connected to https://mods.factorio.com/mod/HelicopterRevival/discussion/5e4788a00d05a7000c7ec4c7

So, you have to remove the mod completely to remove all instances of the old mod, and then re-add it again.

4 years ago

So, I have a migration script that seems to work for rebuilding the helis and heliPads global lists, based on the /fixchoppa command from the other fork.

What doesn't work is the autopilot—at least, sending a helicopter to a pad via the GUI doesn't (which is mostly what we use on my multiplayer server, so that's what I'm testing). Not surprising, since I couldn't steal any inspiration from Choppers on this front; the autopilot code is completely removed in that fork, so its fixup code doesn't have to worry about controllers/remotes.

What I have so far is in a pull request on GitHub: https://github.com/wolfhowlmedia/factorio-helicopters/pull/2

If you (or anyone else) has an idea how to fix the remaining issues, I'm all ears!

4 years ago
(updated 4 years ago)

Oh, thank you for this PR; it'll certainly help with the overall issue. Much appreciate it.

Based on that code, I might have some ideas how to migrate the rest of it, but I'm still fumbling around the mod, so it may take me a bit...

4 years ago

fumbling around the mod

This. Same. Every time I try to make changes to something someone else wrote, I rediscover why it's called "code"!

New response