<commit_before># Impact Day/Night Cycle Plugin

A plugin for the Impact game engine that simulates a day/night system and season system based on configurable date, time, and geographical coordinates.


## Features

* General
    * Configurable time speed multiplier to cycle through day and night faster or slower
    * Configurable update rate to update plugin more or less frequently
    * Configurable initial plugin date and time
    * Configurable geographical coordinates
    * Configurable brightness/darkness of nights (for those who like brighter/darker nights)
* Day/Night System
    * Variable length of day and night based on day of year and geographical coordinates
    * Dynamic ambient brightness during sunrise and sunset
* Season System
    * Variable solstice (Summer/Estival, Winter/Hibernal) and equinox (Spring/Vernal, Autumn/Autumnal) based on year
    * Current season detection based on current date and time relative to year


## Basic Usage

1. Download and place the file `impact-day-night.js` in your `lib/plugins/` directory.

2. Add `'plugins.impact-day-night'` to the `.requires( ... )` section of your main game.

3. In the `init` method of your main game, add **one** (and only one) of the following:

    a. To use **all default** settings:

        // Start from current date and time, updating every 60 seconds, running at 1x real time
        this.daynight = new ig.DayNight();

    b. To specify a custom **date and time**, but leave the other arguments to default:

        // Start from April 14, 2014 5:23:37 PM, updating every 60 seconds, running at 1x real time
        this.daynight = new ig.DayNight(new Date(2014, 3, 14, 17, 23, 37));

    c. To specify a custom **date and time** and **update rate**, but leave the other arguments to default:

        // Start from April 14, 2014 5:23:37 PM, updating every 15 seconds, running at 1x real time
        this.daynight = new ig.DayNight(new Date(2014, 3, 14, 17, 23, 37), 15);

    d. To specify a custom **date and time**, **update rate**, and **timescale**:

        // Start from April 14, 2014 5:23:37 PM, updating every 15 seconds, running at 6x real time
        this.daynight = new ig.DayNight(new Date(2014, 3, 14, 17, 23, 37), 15, 6);

4. In the `update` method of your main game, add the following:

        this.daynight.update();

5. In the `draw` method of your main game, add the following:

        this.daynight.draw();

6. That's it! Start up your game and enjoy!


## Configuration

*For reference, the values listed below are the plugin's default values.*

* To configure the plugin's current date and time:

    *Must be a JavaScript Date object. Attempts to convert into Date object if not.*

        this.daynight.datetime = new Date;    // Start plugin from current date and time

* To configure the time in seconds the plugin should update at:

  *Must be a positive number (integer or floating point number). Attempts to convert to positive number if not.*

      this.daynight.update_rate = 60;    // Update plugin every 60 seconds

* To configure the time speed multiplier the plugin should run at:

  *Must be a positive number (integer or floating point number). Attempts to convert to positive number if not.*

      this.daynight.timescale = 1;    // 1 second plugin time = 1 second real time

* To configure the geographical coordinates the plugin should use in its computations:

  *Must be a number (integer or floating point number).*

  *Latitude : North = positive, South = negative*

  *Longitude: East  = positive, West  = negative*

      this.daynight.geo_coords.latitude = 40.7789;      // 40.7789 degrees North
      this.daynight.geo_coords.longitude = -73.9675;    // 73.9675 degrees West

* To configure the "brightness" of nights:

  *Must be a positive number (integer or floating point number) between 0 and 1 (both inclusive).*

  *The greater the number, the darker the nights will be. Exactly zero (0) yields no change compared to day brightness, whereas exactly one (1) yields pitch black.*

      this.daynight.brightness_night = 0.65;


## Bugs and Known Issues
<commit_msg>Updated readme to reflect previous commit's changes in plugin.<commit_after># Impact Day/Night Cycle Plugin

A plugin for the Impact game engine that simulates a day/night system and season system based on configurable date, time, and geographical coordinates.


## Features

* General
    * Configurable time speed multiplier to cycle through day and night faster or slower
    * Configurable update rate to update plugin more or less frequently
    * Configurable initial plugin date and time
    * Configurable geographical coordinates
    * Configurable brightness/darkness of nights (for those who like brighter/darker nights)
* Day/Night System
    * Variable length of day and night based on day of year and geographical coordinates
    * Dynamic ambient brightness during sunrise and sunset
* Season System
    * Variable solstice (Summer/Estival, Winter/Hibernal) and equinox (Spring/Vernal, Autumn/Autumnal) based on year
    * Current season detection based on current date and time relative to year


## Basic Usage

1. Download and place the file `impact-day-night.js` in your `lib/plugins/` directory.

2. Add `'plugins.impact-day-night'` to the `.requires( ... )` section of your main game.

3. In the `init` method of your main game, add **one** (and only one) of the following:

    a. To use **all default** settings:

        // Start from current date and time, updating every 60 seconds, running at 1x real time
        this.daynight = new ig.DayNight();

    b. To specify a custom **date and time**, but leave the other arguments to default:

        // Start from April 14, 2014 5:23:37 PM, updating every 60 seconds, running at 1x real time
        this.daynight = new ig.DayNight(new Date(2014, 3, 14, 17, 23, 37));

    c. To specify a custom **date and time** and **update rate**, but leave the other arguments to default:

        // Start from April 14, 2014 5:23:37 PM, updating every 15 seconds, running at 1x real time
        this.daynight = new ig.DayNight(new Date(2014, 3, 14, 17, 23, 37), 15);

    d. To specify a custom **date and time**, **update rate**, and **timescale**:

        // Start from April 14, 2014 5:23:37 PM, updating every 15 seconds, running at 6x real time
        this.daynight = new ig.DayNight(new Date(2014, 3, 14, 17, 23, 37), 15, 6);

4. In the `update` method of your main game, add the following:

        this.daynight.update();

5. In the `draw` method of your main game, add the following:

        this.daynight.draw();

6. That's it! Start up your game and enjoy!


## Configuration

*For reference, the values listed below are the plugin's default values.*

* To configure the plugin's current date and time:

    *Must be a JavaScript Date object. Attempts to convert into Date object if not.*

        this.daynight.datetime = new Date;    // Start plugin from current date and time

* To configure the time in seconds the plugin should update at:

  *Must be a positive number (integer or floating point number). Attempts to convert to positive number if not.*

      this.daynight.updateUpdateRate(60);    // Update plugin every 60 seconds

* To configure the time speed multiplier the plugin should run at:

  *Must be a positive number (integer or floating point number). Attempts to convert to positive number if not.*

      this.daynight.timescale = 1;    // 1 second plugin time = 1 second real time

* To configure the geographical coordinates the plugin should use in its computations:

  *Must be a number (integer or floating point number).*

  *Latitude : North = positive, South = negative*

  *Longitude: East  = positive, West  = negative*

      this.daynight.geo_coords.latitude = 40.7789;      // 40.7789 degrees North
      this.daynight.geo_coords.longitude = -73.9675;    // 73.9675 degrees West

* To configure the "brightness" of nights:

  *Must be a positive number (integer or floating point number) between 0 and 1 (both inclusive).*

  *The greater the number, the darker the nights will be. Exactly zero (0) yields no change compared to day brightness, whereas exactly one (1) yields pitch black.*

      this.daynight.brightness_night = 0.65;


## Bugs and Known Issues

{'fraction_non_alphanumeric': 0.08013013616098325, 'fraction_numerical': 0.0320520544643933, 'mean_word_length': 3.336468129571578, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '436547', 'n_tokens_mistral': 2529, 'n_tokens_neox': 2178, 'n_words': 1123}