Repository navigation
Reading the Weather
Rough Seas doesn't replace the game's weather; it drives it. Vanilla's weather system still answers every question about the wind and the rain. We set what it answers, from our model, through the same events and calls vanilla uses for itself. So read the weather as you would in vanilla, and you read ours. This page is for a mod that reads or changes the wind, the rain or the temperature.
-
Wind.
BlockAccessor.GetWindSpeedAt(pos)returns the wind there, through the sameOnGetWindSpeedevent as in vanilla. Vanilla's wind has a strength and no direction, so it fills X alone. Ours has a direction, so we fill X toward east and Z toward south. If your mod reads X as the strength, read the vector's length instead; it is the same strength vanilla would give. -
Units. 1.0 is 25 m/s, a storm on the Beaufort scale; vanilla's own
stormpattern blows at 1.0 and itsmediumbreezeat 0.3, so ours land on the scale you already know. Above sea level vanilla caps the wind at 1.5; ours isn't capped there, so a hurricane goes past it. -
Rain. Our rain falls from our model's clouds: ordinary showers, oftener and heavier where worldgen made the climate wetter, and our storms' rain. We write it into the same values vanilla writes its own:
GetClimateAt(pos)gives the rain falling there asRainfalland the cloud asRainCloudOverlay, andWeatherSystemBase.GetPrecipitation(pos)the rain alone. - Temperature. Untouched: we read it. A mod that shifts the temperature shifts where our storms snow and where they thunder, and how strong our gales grow.
Wind direction, waves and currents have no place in vanilla; read them from our own code, on Reading the sea.
Our model of the wind, the storms and the waves stands on two things it never changes: the world as worldgen built it, and its climate as the game computes it. A mod that changes those changes our sea:
- Temperature, moved by any mod, through the game's own climate: how strong our gales grow, which follows the season's temperature gradient, and whether a storm snows or thunders.
-
The world's rainfall as worldgen laid it down, under the world's precipitation setting: how often ordinary showers come. We rebuild it from the seed and the world's settings, so a mod that changes the rain through
OnGetClimatedoesn't change how often our showers come. - The ocean map: where the sea is (The ocean map).
A mod that sets the weather in vanilla's place doesn't reach our model. A wind pattern you set, or another mod's storm, changes what vanilla reports where it blows; our own wind, our storms and the waves they raise go on as our model has them, and so does what ISeaWeather answers. A precipitation override dries our rain, as it dries vanilla's, but leaves the wind and the sea as they were.
The weather a player meets is whatever the last hand to touch it left. Where we set the weather, we take our turn early, so a mod that adjusts the weather after us adjusts ours. Where we only add to vanilla, we go last, so we never stand between vanilla and a mod that adjusts vanilla.
-
OverridePrecipitation(/weather setprecip) dries or soaks our weather as it does vanilla's. A mod that dries the world gets a dry world. -
Event handlers. Our
OnGetWindSpeedandOnGetClimatehandlers run after vanilla's and before those of vanilla's Devastation: our ModSystem'sExecuteOrderis 1. Handlers run in the order they are registered. We register the wind's inStartand the climate's inStartServerSideandStartClientSide; so a handler of yours adjusts our answer when it is registered in the same phase or a later one, from a ModSystem with a higherExecuteOrder. AnOnGetClimatehandler registered inStartruns before ours, and we overwrite its rain. -
Harmony. A postfix of ours that sets a value runs first (
Priority.High), so a postfix of yours at the default priority adjusts our value instead of being overwritten by it. These set the rain and the clouds:-
WeatherSystemBase.GetPrecipitation, both overloads; -
WeatherDataReaderBase.LoadLerp, the rain where no climate is loaded; -
CloudRenderer.CloudTickandCloudRendererMap.CloudTick, the clouds' drift with our wind.
Everything else of ours runs late (
Priority.Low), after yours:- a transpiler on
WeatherSimulationRegion.RandomWeatherEvent(Weather events); - postfixes on
LoadLerpandpgetBlendedCloudBrightnessthat darken a storm's clouds; - a prefix and postfix pair around
DefaultShaderUniforms.UpdateandEntityBoat.OnRenderFrame, which read the wind's X as its strength: we hand them the vector's length for the call and put X back after. At the default priority, a prefix of yours on them runs before ours and sees the wind's X; a postfix of yours runs before ours and sees the length.
-
How each region's wind is set is on Wind patterns, and how weather events are picked on Weather events.
Getting started
The sea
Your vessel
Leaving it
Rivers and lakes
At sea