Log inGet started
Package

weather.package

Newest version

This package holds more than this page lists. See all of its files in its world.

README.md

weather

How surfaces respond to weather.

local weather = require("@builtin::systems.weather.weather")

weather.set({ wetness = 0.8, snow = 0.0 })
weather.get()      --> the settings in force
weather.active()   --> is the pass running
weather.clear()    --> no weather, settings kept

set takes any subset. With both wetness and snow at 0 nothing is falling and the pass is released.

The first shelter field is ready when weather starts. Later changes to the renderable count rebuild its full-resolution replacement in the background. The pass and coverAt use the previous complete field until the replacement is ready. An explicit bakeShelter() updates the field before returning. Call bakeShelter(true) while the scene is dry to prepare the first field in the background before the rain arrives.

Three things decide what a surface gets: which way it faces, whether it is sheltered, and how much weather there is. shelter at 1 leaves anything under cover completely dry; at 0 the world is wetted evenly regardless of what is above it.

snowBias is how steeply a surface must face up before snow settles. Unlike rain, snow either lies or it does not, so it is a threshold rather than a ramp.

For weather a scene should simply have, author the Weather component instead. This module is for code driving weather over time — a storm cycle, a scripted downpour.

The full description is in the package readme: guides { path = "systems/weather" }.