Log inGet started
Package

timeofday.module

README.md

timeOfDay

Make any light, sound, effect or material follow the time of day. TimeOfDay.darkness() reads how dark it is (0 in full day, 1 at night, and a dark storm reads as dusk, the way the lamps decide). TimeOfDay.follow(fn, { from, to, fade, mode }) calls fn(value) as the darkness changes, eased over a few seconds; TimeOfDay.drive(entity, "Light", "intensity", 2, 9) drives one component field with no code of your own, and the DayNight component does the same from the inspector. Every player computes the same darkness from the shared clock.

local TimeOfDay = require("worldClockKit.timeofday")
-- a campfire that burns higher as the light falls
TimeOfDay.drive(fire, "Light", "intensity", 2, 9)
-- anything else: a sound bed, a particle rate, a material
TimeOfDay.follow(function(v) crickets.volume = v end, { from = 0, to = 0.8, fade = 4 })

Followers run every frame the scene's WorldClock ticks. In play a driven field goes back when play stops; in the editor a saved entity keeps the value you gave it.