Seasons and weather

Seasons

Seasons are defined in the main JSON file of the biomes. A small example of how to setup seasons:

  "seasons": {
     "spring": {
        "display_name": "i18n(stonehearth:data.biome.temperate.seasons.spring.display_name)",
        "description": "i18n(stonehearth:data.biome.temperate.seasons.spring.description)",
        "start_day": 0,
        "weather": [
           {
              "uri": "stonehearth:weather:sunny",
              "weight": 10
           }
        ]
     },
     "summer": {
        "display_name": "i18n(stonehearth:data.biome.temperate.seasons.summer.display_name)",
        "description": "i18n(stonehearth:data.biome.temperate.seasons.summer.description)",
        "start_day": 21,
        "weather": [
           {
              "uri": "stonehearth:weather:thunderstorm",
              "weight": 4
           }
        ]
     },
     "autumn": {
        "display_name": "i18n(stonehearth:data.biome.temperate.seasons.autumn.display_name)",
        "description": "i18n(stonehearth:data.biome.temperate.seasons.autumn.description)",
        "start_day": 42,
        "weather": [
           {
              "uri": "stonehearth:weather:windy",
              "weight": 6
           }
        ]
     },
     "winter": {
        "display_name": "i18n(stonehearth:data.biome.temperate.seasons.winter.display_name)",
        "description": "i18n(stonehearth:data.biome.temperate.seasons.winter.description)",
        "start_day": 63,
        "weather": [
           {
              "uri": "stonehearth:weather:snow",
              "weight": 6
           }
        ]
     }
  }

We'll use custom keys as identifiers for the seasons (for example, "spring" / "summer" / "autumn" / "winter"). We can have an arbitrary number of seasons, but we'll need to make sure that they fit within the year.

You can check the length of the different time intervals in stonehearth/data/calendar/calendar_constants.json. By default they're setup like the real-world time, except for days (we have only 7 days per month). It is not advisable to change the calendar constants, since they might affect other mods and there can be code that depends on them. The names of the months can be found in the calendar constants too, if you want to change them.

Inside each season identifier, we have some properties:

Weather

For creating a custom weather type we'll need to create several files. Existing weather can be found in stonehearth/data/weather, so we can copy one from there, rename it and edit the files.

First let's add the alias to our manifest so that we don't forget about it and we can use it in our custom biomes or add it to existing biomes from the stonehearth mod:

  "aliases" : {
     "weather:sprinkles_rain" : "file(data/weather/sprinkles_rain/sprinkles_rain.json)"
  }

The sprinkles_rain.json file would have the following properties:

Sky settings

The sky is rendered via stonehearth/services/client/sky_renderer/sky_renderer_service.lua. The sky_settings.json file referenced in the weather's JSON file contains data regarding the sky for the weather.

It has these fields:

We can test the sky gradient using the Time Slider debug tool.