Hovercrafts


Speed across land and water in your own personal hovercraft.

Content
a month ago
0.16 - 2.1
82.1K
Transportation Combat

b a craft can end up permanently without drift physics

6 days ago
(updated 6 days ago)

A craft is only ever added to storage.hovercrafts by the handler at control.lua:397, which is registered for on_built_entity, on_robot_built_entity and script_raised_built. A craft that comes into the world any other way is never added, so it never drifts, and there is nothing that catches up on it later.

Ways in that miss:

  • on_space_platform_built_entity. It is registered at control.lua:709, but only inside the "if use_own_ev_lib" block, and it calls ev_lib.on_built, which is the electric vehicle charging library. It does not touch storage.hovercrafts.
  • script_raised_revive, at control.lua:710, has the same problem: registered, but routed to ev_lib.on_built only.
  • on_entity_cloned is not registered at all, so cloning a surface produces craft the mod does not know about.
  • create_entity from another mod without raise_built = true. That one is arguably the other mod's fault by convention, but it is how I ran into this.

Suggested fix: pull the body of the on_built handler out into a register(entity) function and call it from on_space_platform_built_entity, script_raised_revive and on_entity_cloned as well; then add a cheap guard in on_player_driving_changed_state, or in the existing on_nth_tick(3) pass, that registers any isHovercraft vehicle that is not already on the books. The last one alone would make the whole class of misses self-correcting.

Found while testing Vehicle Physics against Hovercrafts, on Factorio 2.1.17.

This post was partially drafted by Claude Opus 5. It also performed most of the investigation of the failure mode that I encountered.

6 days ago

Thanks for the heads up.

I will look into this tomorrow. They should not be buildable on space platforms by default because they require an atmosphere, but I will look to resolve all issues of being placed/built that causes it not to have drifting.

6 days ago

Are these specific issues you tested and found yourself or just had Claude look through my mod to find issues? If found yourself then what specific mods where used to "revive", "clone", "create_entity from another mod without raise_built" the hovercraft?

I ask this because I haven't had anyone using any specific mod mention an issue and these look like very limited, specific issues that almost nobody would have.

6 days ago

I specifically ran into the one with create_entity. My mod (a test harness for vehicle-physics) created a hovercraft and your physics didn't apply to it. As I said, that's arguably my fault since I didn't raise an event, and I'm fixing that about my mod, but any other mod could also do that and evade your mod while your mod could easily capture such hovercrafts if it wanted to.

I'm also in the middle of updating two of my mods that copy/clone entities (entity-symmetry and world-mirror), which would trigger one of the other problems. I do regularly create symmetric trains and occasionally cars, although I admit I haven't ever had occasion to mirror hovercrafts yet.

6 days ago

Alright, I am just wondering specifics so I know the real risk and confirm my fixes with mods.

Thanks again.

New response