Module src.helpers.daycycle

Daycycle helper module.

Calculates the sky‐time factor and environment brightness from a 24h clock, and provides a formatter for human‐readable HH:MM strings.

Functions

computeDaycycle (dayTime) Compute sky‐time and environment brightness from a dayTime value.
formatTime (dayTime) Format a floating‐point hour into an HH:MM string.


Functions

computeDaycycle (dayTime)

Compute sky‐time and environment brightness from a dayTime value. Wraps any 24h‐based dayTime into: 1. a sunFactor in [0..1] suitable for skyExt:setDaytime() 2. an envBright in 0..constants.maxBrightness or up to

  constants.maxNightBright (night) for <code>dream:setSky()</code>

Parameters:

  • dayTime number Current time in hours (can be outside 0–24; will wrap)

Returns:

  1. number sunFactor Normalized sun position factor (0–1)
  2. number envBright Computed environment brightness
formatTime (dayTime)
Format a floating‐point hour into an HH:MM string.

Parameters:

  • dayTime number Time in hours (float; wraps into 0–24)

Returns:

    string timeStr Formatted time string, zero-padded (e.g. “09:05”)
generated by LDoc 1.5.0 Last updated 2025-09-04 12:20:37