From 82be81dd6efbfdc696288dabe6e73e1fe9a04234 Mon Sep 17 00:00:00 2001 From: NinSam Date: Wed, 1 Jan 2025 22:40:56 -0800 Subject: [PATCH] added customization when an event starts and ends --- about.md | 11 +-- changelog.md | 4 ++ mod.json | 150 ++++++++++++++++++++++++++++++++++++++- src/EditLevelLayer.cpp | 62 ++++++++-------- src/LevelAreaLayer.cpp | 62 ++++++++-------- src/LevelSearchLayer.cpp | 62 ++++++++-------- src/Utils.cpp | 116 +++++++++++++++--------------- 7 files changed, 312 insertions(+), 155 deletions(-) diff --git a/about.md b/about.md index 9d1d8f4..2ea071b 100644 --- a/about.md +++ b/about.md @@ -7,8 +7,9 @@ Adds a Day & Night System in the GD menus! Events: -- Sunrise: 7am-8am (7:00-8:00) -- Normal: 8am-6pm (8:00-18:00) -- Sunset: 6pm-7pm (18:00-19:00) -- Night: 7pm-9pm (19:00-21:00) -- Dark: 9pm-7am (21:00-7:00) \ No newline at end of file +- Sunrise +- Sunset +- Night +- Dark + +You can customize when events start and end in the settings. \ No newline at end of file diff --git a/changelog.md b/changelog.md index 83f6b12..5f6f6ae 100644 --- a/changelog.md +++ b/changelog.md @@ -1,5 +1,9 @@ # Changelog +## v1.1.0 + +- Added customization when an event starts and ends + ## v1.0.2 - Added Dark Overlay to LikeItemLayer and RateStarsLayer diff --git a/mod.json b/mod.json index e2b4e7e..c2d9026 100644 --- a/mod.json +++ b/mod.json @@ -8,7 +8,7 @@ }, "id": "ninsam.day_and_night_system", "name": "Day & Night System", - "version": "v1.0.2", + "version": "v1.1.0", "developer": "NinSam", "description": "Adds a day and night system in the GD menus!", "dependencies":[ @@ -27,6 +27,154 @@ }, "settings":{ + "time-settings":{ + "name": "Customize Time", + "type": "title" + }, + "start-sunrise-hr":{ + "name": "Start Sunrise Hr", + "type": "int", + "default": 7, + "min": 0, + "max": 24, + "description": "Keep in mind this uses military time. Example: 1pm = 13 Do not override the values with other events! Example: Sunset 7pm-8pm, Night 6pm-8pm", + "enable-if": "enable-sunrise" + }, + "start-sunrise-min":{ + "name": "Start Sunrise Min", + "type": "int", + "default": 0, + "min": 0, + "max": 59, + "description": "Keep in mind this uses military time. Example: 1pm = 13 Do not override the values with other events! Example: Sunset 7pm-8pm, Night 6pm-8pm", + "enable-if": "enable-sunrise" + }, + "end-sunrise-hr":{ + "name": "End Sunrise Hr", + "type": "int", + "default": 8, + "min": 0, + "max": 24, + "description": "Keep in mind this uses military time. Example: 1pm = 13 Do not override the values with other events! Example: Sunset 7pm-8pm, Night 6pm-8pm", + "enable-if": "enable-sunrise" + }, + "end-sunrise-min":{ + "name": "End Sunrise Min", + "type": "int", + "default": 0, + "min": 0, + "max": 59, + "description": "Keep in mind this uses military time. Example: 1pm = 13 Do not override the values with other events! Example: Sunset 7pm-8pm, Night 6pm-8pm", + "enable-if": "enable-sunrise" + }, + "start-sunset-hr":{ + "name": "Start Sunset Hr", + "type": "int", + "default": 18, + "min": 0, + "max": 24, + "description": "Keep in mind this uses military time. Example: 1pm = 13 Do not override the values with other events! Example: Sunset 7pm-8pm, Night 6pm-8pm", + "enable-if": "enable-sunset" + }, + "start-sunset-min":{ + "name": "Start Sunset Min", + "type": "int", + "default": 0, + "min": 0, + "max": 59, + "description": "Keep in mind this uses military time. Example: 1pm = 13 Do not override the values with other events! Example: Sunset 7pm-8pm, Night 6pm-8pm", + "enable-if": "enable-sunset" + }, + "end-sunset-hr":{ + "name": "End Sunset Hr", + "type": "int", + "default": 19, + "min": 0, + "max": 24, + "description": "Keep in mind this uses military time. Example: 1pm = 13 Do not override the values with other events! Example: Sunset 7pm-8pm, Night 6pm-8pm", + "enable-if": "enable-sunset" + }, + "end-sunset-min":{ + "name": "End Sunset Min", + "type": "int", + "default": 0, + "min": 0, + "max": 59, + "description": "Keep in mind this uses military time. Example: 1pm = 13 Do not override the values with other events! Example: Sunset 7pm-8pm, Night 6pm-8pm", + "enable-if": "enable-sunset" + }, + "start-night-hr":{ + "name": "Start Night Hr", + "type": "int", + "default": 19, + "min": 0, + "max": 24, + "description": "Keep in mind this uses military time. Example: 1pm = 13 Do not override the values with other events! Example: Sunset 7pm-8pm, Night 6pm-8pm", + "enable-if": "enable-night" + }, + "start-night-min":{ + "name": "Start Night Min", + "type": "int", + "default": 0, + "min": 0, + "max": 59, + "description": "Keep in mind this uses military time. Example: 1pm = 13 Do not override the values with other events! Example: Sunset 7pm-8pm, Night 6pm-8pm", + "enable-if": "enable-night" + }, + "end-night-hr":{ + "name": "End Night Hr", + "type": "int", + "default": 21, + "min": 0, + "max": 24, + "description": "Keep in mind this uses military time. Example: 1pm = 13 Do not override the values with other events! Example: Sunset 7pm-8pm, Night 6pm-8pm", + "enable-if": "enable-night" + }, + "end-night-min":{ + "name": "End Night Min", + "type": "int", + "default": 0, + "min": 0, + "max": 59, + "description": "Keep in mind this uses military time. Example: 1pm = 13 Do not override the values with other events! Example: Sunset 7pm-8pm, Night 6pm-8pm", + "enable-if": "enable-night" + }, + "start-dark-hr":{ + "name": "Start Dark Hr", + "type": "int", + "default": 21, + "min": 0, + "max": 24, + "description": "Keep in mind this uses military time. Example: 1pm = 13 Do not override the values with other events! Example: Sunset 7pm-8pm, Night 6pm-8pm", + "enable-if": "enable-dark" + }, + "start-dark-min":{ + "name": "Start Dark Min", + "type": "int", + "default": 0, + "min": 0, + "max": 59, + "description": "Keep in mind this uses military time. Example: 1pm = 13 Do not override the values with other events! Example: Sunset 7pm-8pm, Night 6pm-8pm", + "enable-if": "enable-dark" + }, + "end-dark-hr":{ + "name": "End Dark Hr", + "type": "int", + "default": 7, + "min": 0, + "max": 24, + "description": "Keep in mind this uses military time. Example: 1pm = 13 Do not override the values with other events! Example: Sunset 7pm-8pm, Night 6pm-8pm", + "enable-if": "enable-dark" + }, + "end-dark-min":{ + "name": "End Dark Min", + "type": "int", + "default": 0, + "min": 0, + "max": 59, + "description": "Keep in mind this uses military time. Example: 1pm = 13 Do not override the values with other events! Example: Sunset 7pm-8pm, Night 6pm-8pm", + "enable-if": "enable-dark" + }, "main-settings":{ "name": "Events", "type": "title" diff --git a/src/EditLevelLayer.cpp b/src/EditLevelLayer.cpp index d4a6479..72d1a73 100644 --- a/src/EditLevelLayer.cpp +++ b/src/EditLevelLayer.cpp @@ -16,34 +16,36 @@ class $modify(EditLevelLayer) { const int hr = localTime->tm_hour; const int min = localTime->tm_min; - const int startHr_morning = 7; // start 7am - const int startMin_morning = 0; - const int endHr_morning = 8; // end 8am - const int endMin_morning = 0; - - const int startHr_sunset = 18; // start 6pm - const int startMin_sunset = 0; - const int endHr_sunset = 19; // end 7pm - const int endMin_sunset = 0; - - const int startHr_night = 19; // start 7pm - const int startMin_night = 0; - const int endHr_night = 21; // end 9pm - const int endMin_night = 0; - - const int startHr_fullnight = 21; // start 9pm - const int startMin_fullnight = 0; - const int endHr_fullnight = 24; - const int endMin_fullnight = 0; - // bugfix (idk why it breaks past midnight) - - const int startHr_fullnightfix = 0; - const int startMin_fullnightfix = 0; - const int endHr_fullnightfix = 7; // end 7am - const int endMin_fullnightfix = 0; - if ((hr > startHr_morning || (hr == startHr_morning && min >= startMin_morning)) && (hr < endHr_morning || (hr == endHr_morning && min < endMin_morning))){ + const int endhrdarkbugfix = 24; + const int endmindarkbugfix = 0; + + const int starthrdarkbugfix = 0; + const int startmindarkbugfix = 0; + + + auto startsunrisehr = Mod::get()->getSettingValue("start-sunrise-hr"); + auto startsunrisemin = Mod::get()->getSettingValue("start-sunrise-min"); + auto endsunrisehr = Mod::get()->getSettingValue("end-sunrise-hr"); + auto endsunrisemin = Mod::get()->getSettingValue("end-sunrise-min"); + + auto startsunsethr = Mod::get()->getSettingValue("start-sunset-hr"); + auto startsunsetmin = Mod::get()->getSettingValue("start-sunset-min"); + auto endsunsethr = Mod::get()->getSettingValue("end-sunset-hr"); + auto endsunsetmin = Mod::get()->getSettingValue("end-sunset-min"); + + auto startnighthr = Mod::get()->getSettingValue("start-night-hr"); + auto startnightmin = Mod::get()->getSettingValue("start-night-min"); + auto endnighthr = Mod::get()->getSettingValue("end-night-hr"); + auto endnightmin = Mod::get()->getSettingValue("end-night-min"); + + auto startdarkhr = Mod::get()->getSettingValue("start-sunset-hr"); + auto startdarkmin = Mod::get()->getSettingValue("start-dark-min"); + auto enddarkhr = Mod::get()->getSettingValue("end-dark-hr"); + auto enddarkmin = Mod::get()->getSettingValue("end-dark-min"); + + if ((hr > startsunrisehr || (hr == startsunrisehr && min >= startsunrisemin)) && (hr < endsunrisehr || (hr == endsunrisehr && min < endsunrisemin))){ if (Mod::get()->getSettingValue("enable-sunrise")){ @@ -80,7 +82,7 @@ class $modify(EditLevelLayer) { } } - else if ((hr > startHr_sunset || (hr == startHr_sunset && min >= startMin_sunset)) && (hr < endHr_sunset || (hr == endHr_sunset && min < endMin_sunset))){ + else if ((hr > startsunsethr || (hr == startsunsethr && min >= startsunsetmin)) && (hr < endsunsethr || (hr == endsunsethr && min < endsunsetmin))){ if (Mod::get()->getSettingValue("enable-sunset")){ @@ -116,7 +118,7 @@ class $modify(EditLevelLayer) { } } - else if ((hr > startHr_night || (hr == startHr_night && min >= startMin_night)) && (hr < endHr_night || (hr == endHr_night && min < endMin_night))){ + else if ((hr > startnighthr || (hr == startnighthr && min >= startnightmin)) && (hr < endnighthr || (hr == endnighthr && min < endnightmin))){ if (Mod::get()->getSettingValue("enable-night")){ @@ -155,7 +157,7 @@ class $modify(EditLevelLayer) { } } - else if ((hr > startHr_fullnight || (hr == startHr_fullnight && min >= startMin_fullnight)) && (hr < endHr_fullnight || (hr == endHr_fullnight && min < endMin_fullnight))){ + else if ((hr > startdarkhr || (hr == startdarkhr && min >= startdarkmin)) && (hr < endhrdarkbugfix || (hr == endhrdarkbugfix && min < endmindarkbugfix))){ if (Mod::get()->getSettingValue("enable-dark")){ @@ -195,7 +197,7 @@ class $modify(EditLevelLayer) { } } - else if ((hr > startHr_fullnightfix || (hr == startHr_fullnightfix && min >= startMin_fullnightfix)) && (hr < endHr_fullnightfix || (hr == endHr_fullnightfix && min < endMin_fullnightfix))){ + else if ((hr > starthrdarkbugfix || (hr == starthrdarkbugfix && min >= startmindarkbugfix)) && (hr < enddarkhr || (hr == enddarkhr && min < enddarkmin))){ if (Mod::get()->getSettingValue("enable-dark")){ diff --git a/src/LevelAreaLayer.cpp b/src/LevelAreaLayer.cpp index d7f51c3..58dccef 100644 --- a/src/LevelAreaLayer.cpp +++ b/src/LevelAreaLayer.cpp @@ -16,34 +16,36 @@ class $modify(LevelAreaLayer) { const int hr = localTime->tm_hour; const int min = localTime->tm_min; - const int startHr_morning = 7; // start 7am - const int startMin_morning = 0; - const int endHr_morning = 8; // end 8am - const int endMin_morning = 0; - - const int startHr_sunset = 18; // start 6pm - const int startMin_sunset = 0; - const int endHr_sunset = 19; // end 7pm - const int endMin_sunset = 0; - - const int startHr_night = 19; // start 7pm - const int startMin_night = 0; - const int endHr_night = 21; // end 9pm - const int endMin_night = 0; - - const int startHr_fullnight = 21; // start 9pm - const int startMin_fullnight = 0; - const int endHr_fullnight = 24; - const int endMin_fullnight = 0; - // bugfix (idk why it breaks past midnight) - - const int startHr_fullnightfix = 0; - const int startMin_fullnightfix = 0; - const int endHr_fullnightfix = 7; // end 7am - const int endMin_fullnightfix = 0; - if ((hr > startHr_morning || (hr == startHr_morning && min >= startMin_morning)) && (hr < endHr_morning || (hr == endHr_morning && min < endMin_morning))){ + const int endhrdarkbugfix = 24; + const int endmindarkbugfix = 0; + + const int starthrdarkbugfix = 0; + const int startmindarkbugfix = 0; + + + auto startsunrisehr = Mod::get()->getSettingValue("start-sunrise-hr"); + auto startsunrisemin = Mod::get()->getSettingValue("start-sunrise-min"); + auto endsunrisehr = Mod::get()->getSettingValue("end-sunrise-hr"); + auto endsunrisemin = Mod::get()->getSettingValue("end-sunrise-min"); + + auto startsunsethr = Mod::get()->getSettingValue("start-sunset-hr"); + auto startsunsetmin = Mod::get()->getSettingValue("start-sunset-min"); + auto endsunsethr = Mod::get()->getSettingValue("end-sunset-hr"); + auto endsunsetmin = Mod::get()->getSettingValue("end-sunset-min"); + + auto startnighthr = Mod::get()->getSettingValue("start-night-hr"); + auto startnightmin = Mod::get()->getSettingValue("start-night-min"); + auto endnighthr = Mod::get()->getSettingValue("end-night-hr"); + auto endnightmin = Mod::get()->getSettingValue("end-night-min"); + + auto startdarkhr = Mod::get()->getSettingValue("start-sunset-hr"); + auto startdarkmin = Mod::get()->getSettingValue("start-dark-min"); + auto enddarkhr = Mod::get()->getSettingValue("end-dark-hr"); + auto enddarkmin = Mod::get()->getSettingValue("end-dark-min"); + + if ((hr > startsunrisehr || (hr == startsunrisehr && min >= startsunrisemin)) && (hr < endsunrisehr || (hr == endsunrisehr && min < endsunrisemin))){ if (Mod::get()->getSettingValue("enable-sunrise")){ @@ -75,7 +77,7 @@ class $modify(LevelAreaLayer) { } } - else if ((hr > startHr_sunset || (hr == startHr_sunset && min >= startMin_sunset)) && (hr < endHr_sunset || (hr == endHr_sunset && min < endMin_sunset))){ + else if ((hr > startsunsethr || (hr == startsunsethr && min >= startsunsetmin)) && (hr < endsunsethr || (hr == endsunsethr && min < endsunsetmin))){ if (Mod::get()->getSettingValue("enable-sunset")){ @@ -107,7 +109,7 @@ class $modify(LevelAreaLayer) { } } - else if ((hr > startHr_night || (hr == startHr_night && min >= startMin_night)) && (hr < endHr_night || (hr == endHr_night && min < endMin_night))){ + else if ((hr > startnighthr || (hr == startnighthr && min >= startnightmin)) && (hr < endnighthr || (hr == endnighthr && min < endnightmin))){ if (Mod::get()->getSettingValue("enable-night")){ @@ -174,7 +176,7 @@ class $modify(LevelAreaLayer) { } } - else if ((hr > startHr_fullnight || (hr == startHr_fullnight && min >= startMin_fullnight)) && (hr < endHr_fullnight || (hr == endHr_fullnight && min < endMin_fullnight))){ + else if ((hr > startdarkhr || (hr == startdarkhr && min >= startdarkmin)) && (hr < endhrdarkbugfix || (hr == endhrdarkbugfix && min < endmindarkbugfix))){ if (Mod::get()->getSettingValue("enable-dark")){ @@ -240,7 +242,7 @@ class $modify(LevelAreaLayer) { } } - else if ((hr > startHr_fullnightfix || (hr == startHr_fullnightfix && min >= startMin_fullnightfix)) && (hr < endHr_fullnightfix || (hr == endHr_fullnightfix && min < endMin_fullnightfix))){ + else if ((hr > starthrdarkbugfix || (hr == starthrdarkbugfix && min >= startmindarkbugfix)) && (hr < enddarkhr || (hr == enddarkhr && min < enddarkmin))){ if (Mod::get()->getSettingValue("enable-dark")){ diff --git a/src/LevelSearchLayer.cpp b/src/LevelSearchLayer.cpp index 7a25822..686044d 100644 --- a/src/LevelSearchLayer.cpp +++ b/src/LevelSearchLayer.cpp @@ -16,34 +16,36 @@ class $modify(LevelSearchLayer) { const int hr = localTime->tm_hour; const int min = localTime->tm_min; - const int startHr_morning = 7; // start 7am - const int startMin_morning = 0; - const int endHr_morning = 8; // end 8am - const int endMin_morning = 0; - - const int startHr_sunset = 18; // start 6pm - const int startMin_sunset = 0; - const int endHr_sunset = 19; // end 7pm - const int endMin_sunset = 0; - - const int startHr_night = 19; // start 7pm - const int startMin_night = 0; - const int endHr_night = 21; // end 9pm - const int endMin_night = 0; - - const int startHr_fullnight = 21; // start 9pm - const int startMin_fullnight = 0; - const int endHr_fullnight = 24; - const int endMin_fullnight = 0; - // bugfix (idk why it breaks past midnight) - - const int startHr_fullnightfix = 0; - const int startMin_fullnightfix = 0; - const int endHr_fullnightfix = 7; // end 7am - const int endMin_fullnightfix = 0; - if ((hr > startHr_morning || (hr == startHr_morning && min >= startMin_morning)) && (hr < endHr_morning || (hr == endHr_morning && min < endMin_morning))){ + const int endhrdarkbugfix = 24; + const int endmindarkbugfix = 0; + + const int starthrdarkbugfix = 0; + const int startmindarkbugfix = 0; + + + auto startsunrisehr = Mod::get()->getSettingValue("start-sunrise-hr"); + auto startsunrisemin = Mod::get()->getSettingValue("start-sunrise-min"); + auto endsunrisehr = Mod::get()->getSettingValue("end-sunrise-hr"); + auto endsunrisemin = Mod::get()->getSettingValue("end-sunrise-min"); + + auto startsunsethr = Mod::get()->getSettingValue("start-sunset-hr"); + auto startsunsetmin = Mod::get()->getSettingValue("start-sunset-min"); + auto endsunsethr = Mod::get()->getSettingValue("end-sunset-hr"); + auto endsunsetmin = Mod::get()->getSettingValue("end-sunset-min"); + + auto startnighthr = Mod::get()->getSettingValue("start-night-hr"); + auto startnightmin = Mod::get()->getSettingValue("start-night-min"); + auto endnighthr = Mod::get()->getSettingValue("end-night-hr"); + auto endnightmin = Mod::get()->getSettingValue("end-night-min"); + + auto startdarkhr = Mod::get()->getSettingValue("start-sunset-hr"); + auto startdarkmin = Mod::get()->getSettingValue("start-dark-min"); + auto enddarkhr = Mod::get()->getSettingValue("end-dark-hr"); + auto enddarkmin = Mod::get()->getSettingValue("end-dark-min"); + + if ((hr > startsunrisehr || (hr == startsunrisehr && min >= startsunrisemin)) && (hr < endsunrisehr || (hr == endsunrisehr && min < endsunrisemin))){ if (Mod::get()->getSettingValue("enable-sunrise")){ @@ -90,7 +92,7 @@ class $modify(LevelSearchLayer) { } } - else if ((hr > startHr_sunset || (hr == startHr_sunset && min >= startMin_sunset)) && (hr < endHr_sunset || (hr == endHr_sunset && min < endMin_sunset))){ + else if ((hr > startsunsethr || (hr == startsunsethr && min >= startsunsetmin)) && (hr < endsunsethr || (hr == endsunsethr && min < endsunsetmin))){ if (Mod::get()->getSettingValue("enable-sunset")){ @@ -137,7 +139,7 @@ class $modify(LevelSearchLayer) { } } - else if ((hr > startHr_night || (hr == startHr_night && min >= startMin_night)) && (hr < endHr_night || (hr == endHr_night && min < endMin_night))){ + else if ((hr > startnighthr || (hr == startnighthr && min >= startnightmin)) && (hr < endnighthr || (hr == endnighthr && min < endnightmin))){ if (Mod::get()->getSettingValue("enable-night")){ @@ -190,7 +192,7 @@ class $modify(LevelSearchLayer) { } } - else if ((hr > startHr_fullnight || (hr == startHr_fullnight && min >= startMin_fullnight)) && (hr < endHr_fullnight || (hr == endHr_fullnight && min < endMin_fullnight))){ + else if ((hr > startdarkhr || (hr == startdarkhr && min >= startdarkmin)) && (hr < endhrdarkbugfix || (hr == endhrdarkbugfix && min < endmindarkbugfix))){ if (Mod::get()->getSettingValue("enable-dark")){ @@ -239,7 +241,7 @@ class $modify(LevelSearchLayer) { } } - else if ((hr > startHr_fullnightfix || (hr == startHr_fullnightfix && min >= startMin_fullnightfix)) && (hr < endHr_fullnightfix || (hr == endHr_fullnightfix && min < endMin_fullnightfix))){ + else if ((hr > starthrdarkbugfix || (hr == starthrdarkbugfix && min >= startmindarkbugfix)) && (hr < enddarkhr || (hr == enddarkhr && min < enddarkmin))){ if (Mod::get()->getSettingValue("enable-dark")){ diff --git a/src/Utils.cpp b/src/Utils.cpp index 6d6945a..144e2f5 100644 --- a/src/Utils.cpp +++ b/src/Utils.cpp @@ -15,34 +15,40 @@ bool DayAndNightSystem::init(){ const int hr = localTime->tm_hour; const int min = localTime->tm_min; - const int startHr_morning = 7; // start 7am - const int startMin_morning = 0; - const int endHr_morning = 8; // end 8am - const int endMin_morning = 0; - - const int startHr_sunset = 18; // start 6pm - const int startMin_sunset = 0; - const int endHr_sunset = 19; // end 7pm - const int endMin_sunset = 0; - - const int startHr_night = 19; // start 7pm - const int startMin_night = 0; - const int endHr_night = 21; // end 9pm - const int endMin_night = 0; - - const int startHr_fullnight = 21; // start 9pm - const int startMin_fullnight = 0; - const int endHr_fullnight = 24; - const int endMin_fullnight = 0; - // bugfix (idk why it breaks past midnight) + + // add later to changelog - Fixed the tower texture from disappearing with the (insert) mod - const int startHr_fullnightfix = 0; - const int startMin_fullnightfix = 0; - const int endHr_fullnightfix = 7; // end 7am - const int endMin_fullnightfix = 0; + const int endhrdarkbugfix = 24; + const int endmindarkbugfix = 0; + + const int starthrdarkbugfix = 0; + const int startmindarkbugfix = 0; + + + auto startsunrisehr = Mod::get()->getSettingValue("start-sunrise-hr"); + auto startsunrisemin = Mod::get()->getSettingValue("start-sunrise-min"); + auto endsunrisehr = Mod::get()->getSettingValue("end-sunrise-hr"); + auto endsunrisemin = Mod::get()->getSettingValue("end-sunrise-min"); + + auto startsunsethr = Mod::get()->getSettingValue("start-sunset-hr"); + auto startsunsetmin = Mod::get()->getSettingValue("start-sunset-min"); + auto endsunsethr = Mod::get()->getSettingValue("end-sunset-hr"); + auto endsunsetmin = Mod::get()->getSettingValue("end-sunset-min"); - if ((hr > startHr_morning || (hr == startHr_morning && min >= startMin_morning)) && (hr < endHr_morning || (hr == endHr_morning && min < endMin_morning))){ + auto startnighthr = Mod::get()->getSettingValue("start-night-hr"); + auto startnightmin = Mod::get()->getSettingValue("start-night-min"); + auto endnighthr = Mod::get()->getSettingValue("end-night-hr"); + auto endnightmin = Mod::get()->getSettingValue("end-night-min"); + + auto startdarkhr = Mod::get()->getSettingValue("start-sunset-hr"); + auto startdarkmin = Mod::get()->getSettingValue("start-dark-min"); + auto enddarkhr = Mod::get()->getSettingValue("end-dark-hr"); + auto enddarkmin = Mod::get()->getSettingValue("end-dark-min"); + + + + if ((hr > startsunrisehr || (hr == startsunrisehr && min >= startsunrisemin)) && (hr < endsunrisehr || (hr == endsunrisehr && min < endsunrisemin))){ if (Mod::get()->getSettingValue("enable-sunrise")){ @@ -56,9 +62,9 @@ bool DayAndNightSystem::init(){ this->addChild(sunrise); } - + } - else if ((hr > startHr_sunset || (hr == startHr_sunset && min >= startMin_sunset)) && (hr < endHr_sunset || (hr == endHr_sunset && min < endMin_sunset))){ + else if ((hr > startsunsethr || (hr == startsunsethr && min >= startsunsetmin)) && (hr < endsunsethr || (hr == endsunsethr && min < endsunsetmin))){ if (Mod::get()->getSettingValue("enable-sunset")){ @@ -74,7 +80,7 @@ bool DayAndNightSystem::init(){ } } - else if ((hr > startHr_night || (hr == startHr_night && min >= startMin_night)) && (hr < endHr_night || (hr == endHr_night && min < endMin_night))){ + else if ((hr > startnighthr || (hr == startnighthr && min >= startnightmin)) && (hr < endnighthr || (hr == endnighthr && min < endnightmin))){ if (Mod::get()->getSettingValue("enable-night")){ @@ -91,7 +97,7 @@ bool DayAndNightSystem::init(){ } } - else if ((hr > startHr_fullnight || (hr == startHr_fullnight && min >= startMin_fullnight)) && (hr < endHr_fullnight || (hr == endHr_fullnight && min < endMin_fullnight))){ + else if ((hr > startdarkhr || (hr == startdarkhr && min >= startdarkmin)) && (hr < endhrdarkbugfix || (hr == endhrdarkbugfix && min < endmindarkbugfix))){ if (Mod::get()->getSettingValue("enable-dark")){ @@ -107,11 +113,12 @@ bool DayAndNightSystem::init(){ } } - else if ((hr > startHr_fullnightfix || (hr == startHr_fullnightfix && min >= startMin_fullnightfix)) && (hr < endHr_fullnightfix || (hr == endHr_fullnightfix && min < endMin_fullnightfix))){ - + else if ((hr > starthrdarkbugfix || (hr == starthrdarkbugfix && min >= startmindarkbugfix)) && (hr < enddarkhr || (hr == enddarkhr && min < enddarkmin))){ + if (Mod::get()->getSettingValue("enable-dark")){ + - float relativescale = CCDirector::sharedDirector()->getContentScaleFactor()/4; + float relativescale = CCDirector::sharedDirector()->getContentScaleFactor()/4; CCSprite* stars = CCSprite::create("stars.png"_spr); stars->setAnchorPoint({0, 0}); @@ -121,9 +128,7 @@ bool DayAndNightSystem::init(){ this->addChild(stars); } - } - return true; } @@ -139,35 +144,28 @@ bool DayAndNightSystemOverlay::init(){ const int hr = localTime->tm_hour; const int min = localTime->tm_min; - const int startHr_morning = 7; // start 7am - const int startMin_morning = 0; - const int endHr_morning = 8; // end 8am - const int endMin_morning = 0; + // bugfix (idk why it breaks past midnight) - const int startHr_sunset = 18; // start 6pm - const int startMin_sunset = 0; - const int endHr_sunset = 19; // end 7pm - const int endMin_sunset = 0; + // add later to changelog - Fixed the tower texture from disappearing with the (insert) mod + + const int endhrdarkbugfix = 24; + const int endmindarkbugfix = 0; - const int startHr_night = 19; // start 7pm - const int startMin_night = 0; - const int endHr_night = 21; // end 9pm - const int endMin_night = 0; + const int starthrdarkbugfix = 0; + const int startmindarkbugfix = 0; - const int startHr_fullnight = 21; // start 9pm - const int startMin_fullnight = 0; - const int endHr_fullnight = 24; - const int endMin_fullnight = 0; + auto startnighthr = Mod::get()->getSettingValue("start-night-hr"); + auto startnightmin = Mod::get()->getSettingValue("start-night-min"); + auto endnighthr = Mod::get()->getSettingValue("end-night-hr"); + auto endnightmin = Mod::get()->getSettingValue("end-night-min"); - // bugfix (idk why it breaks past midnight) - - const int startHr_fullnightfix = 0; - const int startMin_fullnightfix = 0; - const int endHr_fullnightfix = 7; // end 7am - const int endMin_fullnightfix = 0; + auto startdarkhr = Mod::get()->getSettingValue("start-sunset-hr"); + auto startdarkmin = Mod::get()->getSettingValue("start-dark-min"); + auto enddarkhr = Mod::get()->getSettingValue("end-dark-hr"); + auto enddarkmin = Mod::get()->getSettingValue("end-dark-min"); - if ((hr > startHr_night || (hr == startHr_night && min >= startMin_night)) && (hr < endHr_night || (hr == endHr_night && min < endMin_night))){ + if ((hr > startnighthr || (hr == startnighthr && min >= startnightmin)) && (hr < endnighthr || (hr == endnighthr && min < endnightmin))){ if (Mod::get()->getSettingValue("enable-night")){ @@ -186,7 +184,7 @@ bool DayAndNightSystemOverlay::init(){ } } - else if ((hr > startHr_fullnight || (hr == startHr_fullnight && min >= startMin_fullnight)) && (hr < endHr_fullnight || (hr == endHr_fullnight && min < endMin_fullnight))){ + else if ((hr > startdarkhr || (hr == startdarkhr && min >= startdarkmin)) && (hr < endhrdarkbugfix || (hr == endhrdarkbugfix && min < endmindarkbugfix))){ if (Mod::get()->getSettingValue("enable-dark")){ @@ -204,7 +202,7 @@ bool DayAndNightSystemOverlay::init(){ } } } - else if ((hr > startHr_fullnightfix || (hr == startHr_fullnightfix && min >= startMin_fullnightfix)) && (hr < endHr_fullnightfix || (hr == endHr_fullnightfix && min < endMin_fullnightfix))){ + else if ((hr > starthrdarkbugfix || (hr == starthrdarkbugfix && min >= startmindarkbugfix)) && (hr < enddarkhr || (hr == enddarkhr && min < enddarkmin))){ if (Mod::get()->getSettingValue("enable-dark")){