Skyclock: Day, Night and Weather Kit
- Author
- claude-code @ auraAgent
- Opened
- Nov 14, 2026
- From
- contrib-g0ywy5zn
- Into
- main
- Merged
- Nov 14, 2026
With persist = true the day (and hour, weather, sky) did not survive Stop and Play. Seen in Castaway Isle (a clock spawned by a scene build: day 3 set, Stop, Play, day 1 again). Built on the current 1.6.8.
Two causes, both in WorldClock.component:
- When Play starts, the editor's clock is unloaded while engine.mode already reads "play", so its onDestroy save() wrote the editor's hour over the game's save. save() now also requires that the clock itself woke in play (awokeIn == "play").
- A play session's clock that wakes with valid records in its synced fields (a clock a scene build spawns carries the editor's) skipped restore() entirely, since restore only ran when the records were invalid. A new restoreIfAhead() runs on the first wake of a play session (no handover note): when the saved moment is further on than the records it woke with, it restores. Time only moves on; a reload in the middle of a session wakes ahead of the last save (saves come every 20 s), so it does not rewind.
Checked in play in Castaway Isle: Clock.setTime(10, 3), wait for the save, Stop, Play: Clock.day() is 3, over three Stop/Play rounds. Version 1.6.9 in package.yaml, Kit.VERSION and the README, with a changelog line.
Source world: 261f357e-6a20-4912-ac33-d9972b929762 Contributed paths:
- worldClockKit.package/README.md
- worldClockKit.package/WorldClock.component/init.luau
- worldClockKit.package/kit.module/init.luau
- worldClockKit.package/package.yaml
- worldClockKit.package
- worldClockKit.package/WorldClock.component
- worldClockKit.package/kit.module
- scenes/main.scene/build.luau
- scenes/main.scene/scene.json
- worldClockKit.package/state.module/init.luau
- worldClockKit.package/worldClockKitTests.testSuite/init.luau
7 files changed
- ChangedworldClockKit.packageFolderBeforeAfter
- ChangedworldClockKit.package/README.md56.5 KB → 57.2 KBBeforeAfter
- ChangedworldClockKit.package/WorldClock.componentFolderBeforeAfter
- ChangedworldClockKit.package/WorldClock.component/init.luau18.2 KB → 19.3 KBBeforeAfter
- ChangedworldClockKit.package/kit.moduleFolderBeforeAfter
- ChangedworldClockKit.package/kit.module/init.luau850 B → 850 BBeforeAfter
- ChangedworldClockKit.package/package.yaml1.2 KB → 1.2 KBBeforeAfter
Checks
No checks have been posted.
Reviews
No reviews yet.
Conversation
- claude-code @ auraAgentNov 14, 2026
Test run: worldClockKitTests suite passed on this head's code (run in Castaway Isle, which holds the same files). Play check: Clock.setTime(10, 3), wait 25 s for the save, Stop, Play -> Clock.day() == 3, repeated three times; runtime_data world key worldClockKit/clock keeps the saved hours across the exit.
Sign in to comment or review.