Auto-resume flight across chunk unload/reload
When the ship's chunk unloads the CC computer powers off and its redstone outputs reset to 0, so on return the ship dropped and the pilot had to re-ENGAGE every time. Flight state now survives the reboot: - engaged.txt flag written while flying, cleared on pilot STOP. - On boot, if engaged + profile present: drive the hover baseline immediately (closes the fall gap), then runStandby(true) re-enters the flight loop automatically with the persisted target -- no manual ENGAGE. - runFly drives hover before its first sleep so no entry path leaves a 0-output gap. - Cleanup no longer lifts a PARKED ship: Ctrl+T out of standby holds hover only when engaged, else valves off. - engaged.txt registered as per-ship state (gitignore, installer keep/reset, menu reset, build excludes). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
21
README.md
21
README.md
@@ -63,7 +63,26 @@ Boot chain (autopilot): `startup.lua` → `ap boot` → `autopilot/main.lua`.
|
||||
Menu any time: `Ctrl+T`, then `ap`. (`stabilizeV2` remains as an alias.)
|
||||
|
||||
Ship state lives on the computer only: `sides.txt`, `calib.txt`, `target.txt`,
|
||||
`settings.txt`. Reset it via menu `p` → `R`, or when re-running the installer.
|
||||
`settings.txt`, `engaged.txt`. Reset it via menu `p` → `R`, or when re-running
|
||||
the installer.
|
||||
|
||||
## Surviving chunk unload / reload
|
||||
|
||||
When you fly away and the ship's chunk unloads, the CC computer powers off and
|
||||
its redstone outputs reset to 0 — so on its own the ship would drop the moment
|
||||
you return. The autopilot handles this:
|
||||
|
||||
- While flying it keeps an `engaged.txt` flag. On boot (`startup.lua` runs
|
||||
automatically when the chunk reloads) it drives the hover baseline
|
||||
**immediately**, then re-enters the flight loop on its own — no manual
|
||||
ENGAGE, holding the same target it had.
|
||||
- A pilot **STOP** clears the flag, so a ship you deliberately stopped stays
|
||||
stopped across reloads. **HOLD**/**LAND** keep flying, so they resume.
|
||||
|
||||
There is still an unavoidable ~1–2 s gap while the computer boots; on this slow
|
||||
ship that is harmless. If the computer comes back *off* after a reload (some
|
||||
server setups), right-click it once — CC then runs `startup.lua` and the
|
||||
auto-resume takes over.
|
||||
|
||||
## Updating the code
|
||||
|
||||
|
||||
Reference in New Issue
Block a user