Added --latest-scene flag

Author: https://github.com/L4w1i3t
This commit is contained in:
Lawliet
2026-04-17 02:32:57 -04:00
committed by GitHub
parent 8b53df7449
commit 57a00512e6
3 changed files with 58 additions and 1 deletions
+9
View File
@@ -18,6 +18,7 @@ func main() {
httpPort := flag.Int("http-port", 8080, "HTTP server port (Octo API)")
host := flag.String("host", "127.0.0.1", "hostname the client will connect to")
scene := flag.Int("scene", 0, "Bootstrap to scene N (0 = fresh start)")
latestScene := flag.Bool("latest-scene", false, "Bootstrap from the most recently saved snapshot (overrides -scene)")
starterItems := flag.Bool("starter-items", false, "Grant starter items to new users")
flag.Parse()
@@ -37,6 +38,14 @@ func main() {
if err := os.MkdirAll(snapshotDir, 0755); err != nil {
log.Fatalf("create snapshot dir: %v", err)
}
if *latestScene {
if id, ok := memory.LatestSnapshotSceneId(snapshotDir); ok {
*scene = int(id)
log.Printf("[latest-scene] auto-selected most recent snapshot: scene=%d", id)
} else {
log.Printf("[latest-scene] no snapshots found in %q; starting fresh", snapshotDir)
}
}
gameConfig, err := masterdata.LoadGameConfig()
if err != nil {