[MOD 0.15 - 1.1] DayPhaseAdjuster

Topics and discussion about specific mods
Post Reply
User avatar
AliceTheGorgon
Inserter
Inserter
Posts: 21
Joined: Sat Sep 13, 2014 9:10 pm
Contact:

[MOD 0.15 - 1.1] DayPhaseAdjuster

Post by AliceTheGorgon »

DayPhaseAdjuster

Description:
  • Allows you to adjust how long each phase of the day is (dawn, day, dusk, night).
    Lengths are in seconds.
    Setting any phase to 0 seconds will skip it.
    With the default settings, the only change it makes is to make night as long as day.
Details: Quirks:
  • Changing the settings while in a running save requires saving and loading the game to make it recognize the new values.
  • Setting all phases to 0 length makes it permanently night until you change the settings to something else.
  • This will probably freak out any mod that keeps track of the in-game time of day, since altering the time of day is the only way I know of to adjust day length.
Changelog:
v1.0.17+ No changes to code. Just bumping the supported game version so Factorio will actually load the mod.
v1.0.1 Doesn't freeze time anymore, since it's apparently not needed, and will stay frozen even if the mod is removed.
v1.0.0 Initial release

Uninstallation:
If you used version 1.0.0 of the mod, you'll either need to run

Code: Select all

/c game.surfaces['nauvis'].freeze_daytime(false)
in the console, or remove the main mod, enable the TimeUnfreezer mod, load the save, save the save, and then remove TimeUnfreezer.
If you've only ever used version 1.0.1, then time won't have been frozen to begin with, and you should be fine.
Attachments
DayPhaseAdjuster_1.0.19.zip
Same as the 0.15 version, just has info.json set to Factorio 1.1.
(14.68 KiB) Downloaded 81 times
DayPhaseAdjuster_1.0.18.zip
Same as the 0.15 version, just has info.json set to Factorio 0.18.
(15.02 KiB) Downloaded 97 times
DayPhaseAdjuster_1.0.17.zip
Same as the 0.15 version, just has info.json set to Factorio 0.17.
(15.02 KiB) Downloaded 91 times
DayPhaseAdjuster_1.0.16.zip
Same as the 0.15 version, just has info.json set to Factorio 0.16.
(15.02 KiB) Downloaded 91 times
DayPhaseAdjuster_1.0.15.zip
For Factorio 0.15. Only change from 1.0 is it no longer freezes time, since it's not needed.
(15.02 KiB) Downloaded 100 times
TimeUnfreezer_1.0.0.zip
In case your time of day is frozen from the old version of the mod.
(13.46 KiB) Downloaded 104 times
DayPhaseAdjuster_1.0.0.zip
Unnecessarily freezes time. Don't use.
(15.05 KiB) Downloaded 137 times
Last edited by AliceTheGorgon on Thu Jun 17, 2021 2:34 am, edited 15 times in total.

DarkSlayerEX
Inserter
Inserter
Posts: 24
Joined: Sat Nov 15, 2014 4:33 pm
Contact:

Re: [MOD 0.15.x] DayPhaseAdjuster

Post by DarkSlayerEX »

I just wanted to let you know that I've noticed that sandbox mode is affected by this mod, even though always day is on. You may need to look into that as well and add a condition for that flag.
Please keep in mind I have other mods running when I tested it, but I had not noticed the issue until I included your mod.

User avatar
AliceTheGorgon
Inserter
Inserter
Posts: 21
Joined: Sat Sep 13, 2014 9:10 pm
Contact:

Re: [MOD 0.15.x] DayPhaseAdjuster

Post by AliceTheGorgon »

Thanks for the info.
I'll leave the mod as-is though, since if a player really wants the mod enabled and also always day for some reason, then it's pretty easy for them to change the map settings to make this mod only use the daytime portion of the day for that save.

DarkSlayerEX
Inserter
Inserter
Posts: 24
Joined: Sat Nov 15, 2014 4:33 pm
Contact:

Re: [MOD 0.15.x] DayPhaseAdjuster

Post by DarkSlayerEX »

Hm.. I suppose that does work. However, I wanted to point out that since your mod freezes the surface's daytime, it may cause people problems if they decide to uninstall the mod. Players may not want to run the command manually as it would disable achievements.

Perhaps you could find a way to unpause the game's time just before a map is saved. This could solve the issue with uninstallation.

User avatar
AliceTheGorgon
Inserter
Inserter
Posts: 21
Joined: Sat Sep 13, 2014 9:10 pm
Contact:

Re: [MOD 0.15.x] DayPhaseAdjuster

Post by AliceTheGorgon »

Oh my. I didn't realize that time stayed frozen across a save/load. Thank you very much for the info.

I've updated the mod so it doesn't freeze time (since everything seems to work fine even if time isn't frozen), and I've added a time unfreezing mod to the main post to unfreeze the time for anyone who used the old version and wants to remove it but doesn't want to use console commands on the save.
The time unfreezer just needs to be enabled after disabling the old version of the mod, and then the save in question just needs to be loaded and saved again (after letting at least one tick pass, so TimeUnfreezer can do its thing).
After that, it's safe to remove TimeUnfreezer.

Edit:
I would have used the "unfreeze just before saving" idea, but I couldn't find anything in the api docs that would let me run code just before the game saved.

DarkSlayerEX
Inserter
Inserter
Posts: 24
Joined: Sat Nov 15, 2014 4:33 pm
Contact:

Re: [MOD 0.15.x] DayPhaseAdjuster

Post by DarkSlayerEX »

Ah, thanks for the fix. I had already set up a fix on my end too. (It was code I placed in one of my tweak mods, for my modpack)

At least it should help others with the same issue =)

User avatar
AliceTheGorgon
Inserter
Inserter
Posts: 21
Joined: Sat Sep 13, 2014 9:10 pm
Contact:

Re: [MOD 0.16.x] DayPhaseAdjuster

Post by AliceTheGorgon »

Just a quick note that I've uploaded a version of the mod where the info.json lists compatibility with Factorio 0.16.

No actual code changes were made, as everything seemed to still be working fine in 0.16.

I also uploaded an updated version of the TimeUnfreezer, which fixed a typo where I set a variable to "dalse" instead of "false". Nobody should actually need the TimeUnfreezer at this point, but I figured I'd fix it anyway, just for completeness.

User avatar
AliceTheGorgon
Inserter
Inserter
Posts: 21
Joined: Sat Sep 13, 2014 9:10 pm
Contact:

Re: [MOD 0.17.x] DayPhaseAdjuster

Post by AliceTheGorgon »

I've updated the mod in the mod portal. As per usual, no code changes were needed, just updating info.json.

Since there appears to still be no way to mark the mod as compatible with multiple Factorio versions, I've taken to making the "patch" part of the version number follow the main Factorio version number. That way I can upload versions for newer releases to the mod portal without having to delete all the old ones first, since it otherwise complains about the version being the same.

User avatar
Oktokolo
Filter Inserter
Filter Inserter
Posts: 883
Joined: Wed Jul 12, 2017 5:45 pm
Contact:

Re: [MOD 0.17.x] DayPhaseAdjuster

Post by Oktokolo »

AliceTheGorgon wrote:
Fri Feb 21, 2020 4:36 am
I've updated the mod in the mod portal. As per usual, no code changes were needed, just updating info.json.
If it is just about updating the JSON, why not go all the way to 0.18 as you are at it?

User avatar
AliceTheGorgon
Inserter
Inserter
Posts: 21
Joined: Sat Sep 13, 2014 9:10 pm
Contact:

Re: [MOD 0.15+] DayPhaseAdjuster

Post by AliceTheGorgon »

Fair point. I generally don't play the experimental versions, but for a simple mod like this it does make some sense to do a quick test and update so it's listed as compatible ahead of time, instead of just waiting 'till it's in stable and forgetting about it instead.

I've added one marked with 0.18 compatibility.

User avatar
AliceTheGorgon
Inserter
Inserter
Posts: 21
Joined: Sat Sep 13, 2014 9:10 pm
Contact:

Re: [MOD 0.15 - 1.1] DayPhaseAdjuster

Post by AliceTheGorgon »

Bumped the mod version number so it gets recognized by 1.1.
Sorry for the delay, everyone. I'd forgotten that 1.1 released, and didn't think to check until just now when I got another hankerin' to play the game again.

Post Reply

Return to “Mods”