From 654216f14904c17749a2c9c43d7347318c6022cd Mon Sep 17 00:00:00 2001 From: Matthew Date: Sun, 18 Nov 2018 07:00:22 -0500 Subject: [PATCH] Add day/night cycle options (#360) * Add day/night cycle options * txt to markdown and fix formatting errors --- map_gen/day_night_cycles/bright.lua | 6 ++++++ map_gen/day_night_cycles/day_night_cycle.lua | 11 ++++++++++ .../day_night_cycles/double_length_cycle.lua | 6 ++++++ map_gen/day_night_cycles/gloomy.lua | 6 ++++++ .../day_night_cycles/half_length_cycle.lua | 6 ++++++ ...long_days_long_nights_fast_transitions.lua | 6 ++++++ map_gen/day_night_cycles/readme.md | 20 +++++++++++++++++++ map_gen/day_night_cycles/vanilla.lua | 7 +++++++ 8 files changed, 68 insertions(+) create mode 100644 map_gen/day_night_cycles/bright.lua create mode 100644 map_gen/day_night_cycles/day_night_cycle.lua create mode 100644 map_gen/day_night_cycles/double_length_cycle.lua create mode 100644 map_gen/day_night_cycles/gloomy.lua create mode 100644 map_gen/day_night_cycles/half_length_cycle.lua create mode 100644 map_gen/day_night_cycles/long_days_long_nights_fast_transitions.lua create mode 100644 map_gen/day_night_cycles/readme.md create mode 100644 map_gen/day_night_cycles/vanilla.lua diff --git a/map_gen/day_night_cycles/bright.lua b/map_gen/day_night_cycles/bright.lua new file mode 100644 index 00000000..ab206ab7 --- /dev/null +++ b/map_gen/day_night_cycles/bright.lua @@ -0,0 +1,6 @@ +-- 10 minute cycle, 4m of full light, 4m light to dark, 6s full dark, 2m dark to light +game.player.surface.ticks_per_day = 36000 +game.player.surface.dusk = 0.2 +game.player.surface.evening = 0.59 +game.player.surface.morning = 0.6 +game.player.surface.dawn = 0.8 diff --git a/map_gen/day_night_cycles/day_night_cycle.lua b/map_gen/day_night_cycles/day_night_cycle.lua new file mode 100644 index 00000000..dab199ff --- /dev/null +++ b/map_gen/day_night_cycles/day_night_cycle.lua @@ -0,0 +1,11 @@ +local Event = require "utils.event" + +-- Uncomment the desired day/night cycle + +-- requires +-- requires + +local function init() +end + +Event.on_init(init) diff --git a/map_gen/day_night_cycles/double_length_cycle.lua b/map_gen/day_night_cycles/double_length_cycle.lua new file mode 100644 index 00000000..0719e63a --- /dev/null +++ b/map_gen/day_night_cycles/double_length_cycle.lua @@ -0,0 +1,6 @@ +-- ~14 minute cycle, 6m56s of full light, 2m46s light to dark, 1m24s full dark, 2m46s dark to light +game.player.surface.ticks_per_day = 50000 +game.player.surface.dusk = 0.25 +game.player.surface.evening = 0.45 +game.player.surface.morning = 0.55 +game.player.surface.dawn = 0.75 diff --git a/map_gen/day_night_cycles/gloomy.lua b/map_gen/day_night_cycles/gloomy.lua new file mode 100644 index 00000000..5f4c8830 --- /dev/null +++ b/map_gen/day_night_cycles/gloomy.lua @@ -0,0 +1,6 @@ +-- 10 minute cycle, 6s of full light, 2m light to dark, 4m full dark, 4m dark to light +game.player.surface.ticks_per_day = 36000 +game.player.surface.dusk = 0 +game.player.surface.evening = 0.2 +game.player.surface.morning = 0.6 +game.player.surface.dawn = 0.99 diff --git a/map_gen/day_night_cycles/half_length_cycle.lua b/map_gen/day_night_cycles/half_length_cycle.lua new file mode 100644 index 00000000..180b2ef4 --- /dev/null +++ b/map_gen/day_night_cycles/half_length_cycle.lua @@ -0,0 +1,6 @@ +-- ~3.5 minute cycle, 1m44s of full light, 42s light to dark, 21s full dark, 42s dark to light +game.player.surface.ticks_per_day = 12500 +game.player.surface.dusk = 0.25 +game.player.surface.evening = 0.45 +game.player.surface.morning = 0.55 +game.player.surface.dawn = 0.75 diff --git a/map_gen/day_night_cycles/long_days_long_nights_fast_transitions.lua b/map_gen/day_night_cycles/long_days_long_nights_fast_transitions.lua new file mode 100644 index 00000000..1cdfc956 --- /dev/null +++ b/map_gen/day_night_cycles/long_days_long_nights_fast_transitions.lua @@ -0,0 +1,6 @@ +-- 20 minute cycle, 9m of full light, 1m light to dark, 9m full dark, 1m dark to light +game.player.surface.ticks_per_day = 72000 +game.player.surface.dusk = 0.225 +game.player.surface.evening = 0.275 +game.player.surface.morning = 0.725 +game.player.surface.dawn = 0.775 diff --git a/map_gen/day_night_cycles/readme.md b/map_gen/day_night_cycles/readme.md new file mode 100644 index 00000000..7b92eeda --- /dev/null +++ b/map_gen/day_night_cycles/readme.md @@ -0,0 +1,20 @@ +In terms of daylight during the day/night cycle: + +when dusk begins the light decreases until +evening (aka nighttime) which is full darkness until +morning which increases the light level until +dawn (aka daytime) which is full brightness until dusk + +Defaults as follows: +ticks_per_day=25000 (approx 6 mins 56.4 secs) +dusk=0.25, evening=0.45, morning=0.55, dawn=0.75 + +If you keep your numbers < 1 , it's the percentage +of the total ticks at which the phase of day will change +Not sure what happens if you go > 1 + +When setting these variables, the command will fail if it changes +the *order* of the phases. Ex: morning must be > evening but < dawn + +Lastly, the map starts at time tick 0 so if you want to start during full +daylight you want a dusk > 0 diff --git a/map_gen/day_night_cycles/vanilla.lua b/map_gen/day_night_cycles/vanilla.lua new file mode 100644 index 00000000..6533f72f --- /dev/null +++ b/map_gen/day_night_cycles/vanilla.lua @@ -0,0 +1,7 @@ +-- vanilla day/night cycle, mostly just here as reference +-- ~7 minute cycle, 3m28s of full light, 1m23s light to dark, 42s full dark, 1m23s dark to light +game.player.surface.ticks_per_day = 25000 +game.player.surface.dusk = 0.25 +game.player.surface.evening = 0.45 +game.player.surface.morning = 0.55 +game.player.surface.dawn = 0.75