# Seasons

The **Seasons** feature in the InfiniteCrops plugin introduces dynamic seasonal changes, affecting gameplay elements like temperature and water loss. Each season has its own duration, attributes, and world-specific configurations. This guide explains how to configure the `seasons.yml` file and understand how seasons work.

***

#### **File Structure**

The `seasons.yml` file is structured to define attributes for each season, such as:

1. **Duration**: The time each season lasts, randomized between a minimum and maximum.
2. **Temperature**: Seasonal temperature impacts crop growth and water retention.
3. **Worlds**: Specifies the worlds where the season is active.
4. **Water Loss**: Defines how much water crops lose during the season.

***

#### **Configuration Example**

```yaml
seasons:
  spring:
    duration_min: 140
    duration_max: 300
    name: spring
    id: infinitecrops_spring
    temperature: 7.0
    worlds:
    - world
    water_loss: 1.0
  summer:
    duration_min: 140
    duration_max: 320
    name: summer
    id: infinitecrops_summer
    temperature: 15.0
    worlds:
    - world
    water_loss: 1.8
  autumn:
    duration_min: 100
    duration_max: 240
    name: autumn
    id: infinitecrops_autumn
    temperature: 0.0
    worlds:
    - world
    water_loss: 0.5
  winter:
    duration_min: 200
    duration_max: 320
    name: winter
    id: infinitecrops_winter
    temperature: 0.0
    worlds:
    - world
    water_loss: 0.0
```

***

#### **Key Sections**

**1. General Attributes**

* **`duration_min` and `duration_max`**:
  * Define the range (in minutes) for how long the season will last.
  * Example:

    ```yaml
    codeduration_min: 140
    duration_max: 300
    ```

    * The season will last between 140 and 300 minutes.
* **`name`**:
  * The display name of the season.
  * Example: `spring`
* **`id`**:
  * A unique identifier for the season.
  * Example: `infinitecrops_spring`
* **`temperature`**:
  * The temperature during the season. This value can influence crop behavior and growth.
  * Example: `7.0`
* **`worlds`**:
  * The list of worlds where the season is active.
  * Example:

    ```yaml
    codeworlds:
    - world
    ```
* **`water_loss`**:
  * The rate at which crops lose water during the season.
  * Example: `1.8`

***

#### **Season Mechanics**

1. **Season Duration**:
   * Seasons last a random amount of time between `duration_min` and `duration_max`.
2. **Dynamic Transitions**:
   * When a season ends, the plugin automatically transitions to the next season in the cycle.
3. **World-Specific Seasons**:
   * Different worlds can have independent seasonal cycles by listing them in the `worlds` attribute.
4. **Temperature Effects**:
   * Temperature can be used to simulate realistic crop growth conditions, where some crops thrive in warmer seasons and others in cooler ones.
5. **Water Loss**:
   * Defines how quickly crops dry out in a season. Higher values mean crops need to be watered more frequently.

***

#### **Customizing Seasons**

**Adding a New Season**

1. Define a new entry under `seasons`.
2. Provide unique values for `name`, `id`, `duration_min`, `duration_max`, `temperature`, and `water_loss`.
3. Specify the worlds where the new season applies.

Example:

```yaml
seasons:
  rainy:
    duration_min: 150
    duration_max: 300
    name: rainy
    id: infinitecrops_rainy
    temperature: 10.0
    worlds:
    - rainy_world
    water_loss: 0.8
```

**Adjusting Season Order**

The order of seasons is determined by the plugin and follows the sequence defined in the configuration. Adjust the order by reordering entries in the YAML file.

***

#### **Practical Example**

Let’s say you want **summer** to have higher water loss and last longer than **spring**. Update the configuration like this:

```yaml
summer:
  duration_min: 200
  duration_max: 400
  name: summer
  id: infinitecrops_summer
  temperature: 20.0
  worlds:
  - world
  water_loss: 2.5
```

***

#### **Troubleshooting**

* **Season Does Not Apply in a World**:
  * Ensure the world is listed under the `worlds` attribute for the season.
* **Random Duration Is Not Working**:
  * Verify `duration_min` and `duration_max` are set correctly and are integers.
* **Crops Not Behaving Correctly**:
  * Check that the `temperature` and `water_loss` values are appropriately configured for the season.
