Setting and clearing
This is the full list of what the API gives you.
WorldSky is the static class you call. modId is your mod’s id (see Mod id).
WorldSky set and clear your sky values
Use Set to change the sky to your values, Clear to take your values back off, and Current to read the sky as it looks now.
public static class WorldSky
{
public static bool IsAvailable { get; }
public static SkyState Current { get; }
public static bool Set(string modId, SkyOverride values);
public static bool Clear(string modId);
}
| Method | Returns | What it does |
|---|---|---|
Set(modId, values) | bool | Applies your values. true when they were applied. |
Clear(modId) | bool | Removes your values. true when you had some. |
| Property | Type | What it means |
|---|---|---|
IsAvailable | bool | false when the framework could not set up the sky changes. |
Current | SkyState | What the sky looks like now, with any overrides included. null when it cannot be read. |
Things to know
Setapplies your values on top of what the game does. If you callSetagain, your new values replace your earlier ones.- The values are copied, so changing your
SkyOverrideafterwards does nothing until you callSetagain. CloudDensityis held between0and1. A larger or smaller number is clamped to that range.Clearremoves only your values, and returnstruewhen you had some.Currentisnullwhen the framework cannot read the sky. It never throws.
Limits
SetreturnsfalsewhenIsAvailableisfalse.Setthrows anArgumentExceptionfor a bad call. That happens for an invalid mod id, anullvalues, a number that is not a real number (NaNor infinity), or a density, intensity or exposure below0.Clearthrows anArgumentExceptionfor an invalid mod id.