Weather
Manage map weather from the server while keeping a client-side override for local effects.Shared Types
Weather types are exported by@rpgjs/common:
rainsnowfogcloud
Initial Map Weather
Set initial weather in@MapData() or in a map entry inside your server module:
Runtime API (Server)
RpgMap exposes:
map.getWeather(): WeatherState | nullmap.setWeather(next: WeatherState | null, options?: { sync?: boolean })map.patchWeather(patch: Partial<WeatherState>, options?: { sync?: boolean })map.clearWeather(options?: { sync?: boolean })
sync is not false, the weather is broadcast to players in the map.
Runtime API (Client)
RpgClientMap exposes:
map.weatherState(server-synchronized state)map.localWeatherOverride(client-only override)map.weather(computed: local override first, then server state)map.getWeather()map.setLocalWeather(next)map.clearLocalWeather()
Rendering With CanvasEngine Preset
Use your map weather state to feed@canvasengine/presets:
engine.sceneMap.weather() / engine.sceneMap.getWeather().