[0.12.X] Longer Day/Night Cycles (DayNightExtender 1.1.0)

Topics and discussion about specific mods
Vizzy
Burner Inserter
Burner Inserter
Posts: 11
Joined: Tue Aug 04, 2015 5:57 pm
Contact:

[0.12.X] Longer Day/Night Cycles (DayNightExtender 1.1.0)

Post by Vizzy » Tue Aug 04, 2015 6:44 pm

Unofficial update to the mod DayNightExtender. Fixed a bug and updated to the latest factorio version (0.12.2).
  • Type: Mod
    Name: DayNightExtender 1.1.0
    Description: Allows individual customisation of the length of day and/or night.
    License: Use at will
    Version: 1.1.0
    Release: 4th August 2015
    Tested-With-Factorio-Version: 0.12.2
    Category: Unofficial
    Tags: Free, Day, Night, Daytime, Nighttime, Daylength
To Install
To Use
Examples
Limitations
If you use a Clock mod, read this
1.1.0 Changes
Let me know if there's any problems!
Attachments
DayNightExtender_1.1.0.zip
(1.3 KiB) Downloaded 2864 times

LordSkaven
Burner Inserter
Burner Inserter
Posts: 10
Joined: Thu Jul 30, 2015 9:24 am
Contact:

Re: [0.12.X] Longer Day/Night Cycles (DayNightExtender 1.1.0)

Post by LordSkaven » Fri Aug 07, 2015 6:15 pm

Nice.

I was about to start updating the mod when i decided to check if it wasn't done already.

Airat9000
Smart Inserter
Smart Inserter
Posts: 1318
Joined: Fri Mar 28, 2014 12:32 am
Contact:

Re: [0.12.X] Longer Day/Night Cycles (DayNightExtender 1.1.0)

Post by Airat9000 » Sat Aug 08, 2015 3:18 am

:D and if I put in the code instead of the 3 or 2, wherein the 7 or 14 while there will be more night and day ??

jaxterity
Inserter
Inserter
Posts: 28
Joined: Sun Nov 09, 2014 7:26 am
Contact:

Re: [0.12.X] Longer Day/Night Cycles (DayNightExtender 1.1.0)

Post by jaxterity » Tue Aug 18, 2015 10:56 am

Greetings

So we cannot lower/decrease the day time lower than it already is. HOWEVER I am wondering if it would be possible to do this either this in this mod or in a spinoff mod, that you or someone else might want to do with it?

If we could have days get longer for a certain amount of days and the nights would get shorter, and then nights get longer as days get shorter. This would be similar to the way year round day/night cycles work.

However my idea came from the movie Pitch Black. Imagine if there are a few suns in this planet and they show for a very long time but then when the night hits the night is pitch black like the title of the movie.

I suppose if this is not possible or if no one wants to do it, I could just make my days long and then my nights long. But it would be neat if they could be progressive back and forth, so a few long days and short nights, that then flip to long nights and short days.

jaxterity
Inserter
Inserter
Posts: 28
Joined: Sun Nov 09, 2014 7:26 am
Contact:

Re: [0.12.X] Longer Day/Night Cycles (DayNightExtender 1.1.0)

Post by jaxterity » Wed Aug 19, 2015 6:18 pm

This mod seems to be currently blinking a lot between day/night switching over. I do not remember it doing this in version 11 as I used it back then.

If it is the only way to get it working, is it possible to make it just go straight to night and straight to day so it skips the blinking in between stage for long time?

Vizzy
Burner Inserter
Burner Inserter
Posts: 11
Joined: Tue Aug 04, 2015 5:57 pm
Contact:

Re: [0.12.X] Longer Day/Night Cycles (DayNightExtender 1.1.0)

Post by Vizzy » Thu Aug 20, 2015 5:03 pm

LordSkaven wrote:Nice.

I was about to start updating the mod when i decided to check if it wasn't done already.
Thanks :)

Airat9000 wrote::D and if I put in the code instead of the 3 or 2, wherein the 7 or 14 while there will be more night and day ??
If you were to enter values such as 7 or 14 you'd get a much longer day/night. You could use numbers such as 50 and it would still work!

jaxterity wrote:This mod seems to be currently blinking a lot between day/night switching over. I do not remember it doing this in version 11 as I used it back then.

If it is the only way to get it working, is it possible to make it just go straight to night and straight to day so it skips the blinking in between stage for long time?
Sorry, I'm not entirely sure what you mean. Is it the transition periods between day and night you're referring to? In all my testing I've not seen any blinking. Have you installed any graphical mods? Does it still blink if this is the only mod running? If so, any chance you could post a quick video of it on youtube? About whether it's possible for it to skip straight to day and night without the tranistion periods, it MIGHT be possible and it would definitely be quite a bit of work to seperate them out so it might be something I include at a later point.

jaxterity wrote:Greetings

So we cannot lower/decrease the day time lower than it already is. HOWEVER I am wondering if it would be possible to do this either this in this mod or in a spinoff mod, that you or someone else might want to do with it?

If we could have days get longer for a certain amount of days and the nights would get shorter, and then nights get longer as days get shorter. This would be similar to the way year round day/night cycles work.

However my idea came from the movie Pitch Black. Imagine if there are a few suns in this planet and they show for a very long time but then when the night hits the night is pitch black like the title of the movie.

I suppose if this is not possible or if no one wants to do it, I could just make my days long and then my nights long. But it would be neat if they could be progressive back and forth, so a few long days and short nights, that then flip to long nights and short days.
Hey. That's right, the current implementation of the mod cannot decrease the length of day. It SHOULD be possible to change this, I've done a little research and thought of a couple of ways of handling it. It would mean a complete rewrite of the mod however but to be honest this isn't something I'm adverse to. This current mod is just a quick update to Dark's original work and if I were to redo it completely I can think of a number of ways to improve it.


Definitely an interesting idea you've got there, and would be a great reason to fully redo the mod. My quick thoughts on details:

- Have two cycles, a main one that represents a year and a a seconday one that represents a lunar month [Note, lunar month not normal months, so each cycle is independent. Both can have a combined effect however]

- Have random events, things like eclipses etc (what other events can you think of, that only effect day/night/light levels?)

- I could also implement a custom clock that can keep track of time of day, as well as each cycles status. Had a look into clocks and it shouldn't be hard.


To be honest getting the details down is almost the hardest part, actually writing the code isn't too bad. I wouldn't want to make it too complicated and make people have to read a guide, the details would ideally be intuitive with maybe a little forewarning that if the two cycles line up in a certain way something might happen.

Now, unfortunately I'm actually in the middle of writing my thesis so can't spare any time for the next two weeks or so to code, but after that I should have plenty of free time to sink my teeth into this.

Let me know if you or anyone else comes up with any cool ideas for this, we can bounce ideas of each other and I'll let you know if it sounds feasible. I'm a beginner at modding factorio and I'm sure there's people with plenty of experience who can knock this up but it sounds like a fun project I wouldn't mind having a stab at.

jaxterity
Inserter
Inserter
Posts: 28
Joined: Sun Nov 09, 2014 7:26 am
Contact:

Re: [0.12.X] Longer Day/Night Cycles (DayNightExtender 1.1.0)

Post by jaxterity » Fri Aug 21, 2015 11:06 am

Yeah I'll try to see if I can get blinking video up on Youtube and post it here. I do use the WaiTEX HD mod but that shouldn't change anything to do with this mod I believe as it just ups the textures of the game to HD.

I do use other mods like Bob's mods but that shouldn't influence the time as far as I know.

I will try it with no mods but this one. What it is, is it flickers my flashlight and the light around me when it is in the transition point between day and night/night and day. So it was extremely noticeable when I tried to make the day/night length very long like 5 or 6, or do 6 for day and 4 for night. It makes the flickering flashlight/light around character even slower blinking I guess because the transition was slower. I'll try to get videos and also test without mods other than this one though.

jaxterity
Inserter
Inserter
Posts: 28
Joined: Sun Nov 09, 2014 7:26 am
Contact:

Re: [0.12.X] Longer Day/Night Cycles (DayNightExtender 1.1.0)

Post by jaxterity » Sat Aug 22, 2015 12:44 am

Hello

So after further testing the problem was solved. The issue/flickering was due to the Mo Weather mod. I put that in to see it and test it out. But apparently having that with the Day/Night extender makes it flicker a lot when it transitions between day/night. I removed Mo Weather and it works great now.

Now my days are 28 minutes and nights are 21 minutes or whatnot haha.

orzelek
Smart Inserter
Smart Inserter
Posts: 3574
Joined: Fri Apr 03, 2015 10:20 am
Contact:

Re: [0.12.X] Longer Day/Night Cycles (DayNightExtender 1.1.0)

Post by orzelek » Sat Aug 22, 2015 9:49 am

jaxterity wrote:Hello

So after further testing the problem was solved. The issue/flickering was due to the Mo Weather mod. I put that in to see it and test it out. But apparently having that with the Day/Night extender makes it flicker a lot when it transitions between day/night. I removed Mo Weather and it works great now.

Now my days are 28 minutes and nights are 21 minutes or whatnot haha.
Both of those mods try to change time of day - they are simply not compatible with each other and you were seeing the effects.

User avatar
Steejo
Burner Inserter
Burner Inserter
Posts: 6
Joined: Thu Oct 08, 2015 12:00 pm
Contact:

Re: [0.12.X] Longer Day/Night Cycles (DayNightExtender 1.1.0)

Post by Steejo » Sat Oct 17, 2015 1:00 pm

Not working as of 0.12.11 "game" is a nil value, tried fixing it to no avail. Something to do with game.freeze_day_time

ahh ok, turns out that it's because you use an on_load call and it has been changed to no longer give access to game

antisocialian
Burner Inserter
Burner Inserter
Posts: 10
Joined: Tue Jan 20, 2015 6:54 pm
Contact:

Re: [0.12.X] Longer Day/Night Cycles (DayNightExtender 1.1.0)

Post by antisocialian » Sun Oct 18, 2015 4:27 pm

I'm relatively certain I got it working with this code:

Code: Select all

require "defines"


local DAY_LENGTH_MULTIPLIER = 3 -- (integer) Controls how long daytime will be. Set to 1 for default, vanilla length (3.5 minutes).
local NIGHT_LENGTH_MULTIPLIER  = 3 -- (integer) Same as above but for the night.




local counter
-- local freeze = game:freeze_daytime()
local freeze_state -- (boolean) Determines whether the games daytime is currently frozen => Not calling freeze more then needed.


script.on_init(function()
  global.counter = global.counter or 0
  counter = global.counter
  
  global.freeze_state = (type(global.freeze_state) == "nil" ) and false or global.freeze_state
  freeze_state = global.freeze_state
end)

script.on_load(function()
  global.counter = global.counter or 0
  counter = global.counter
  
  global.freeze_state = (type(global.freeze_state) == "nil" ) and false or global.freeze_state
  freeze_state = global.freeze_state
  
  -- if freeze_state then
    -- game:freeze_daytime()
  -- end
end)

-- Removed 0.12.11 https://forums.factorio.com/forum/viewtopic.php?f=3&t=17087
-- game.on_save(function()
  -- global.counter = counter
  -- global.freeze_state = freeze_state
  -- freeze(false)
-- end)

script.on_event(defines.events.on_tick, function(event)
  local tick = event.tick
  if tick % 4 == 0 then
    local dt = game.daytime
    local extension_multiplier = (dt > 0.75 or dt < 0.25) and DAY_LENGTH_MULTIPLIER or NIGHT_LENGTH_MULTIPLIER
    if counter == 0 then
      counter = 1
      if freeze_state then
        game.freeze_daytime(false)
        freeze_state = false
      end
    elseif counter < extension_multiplier then
      counter = counter + 1
      if not freeze_state then
        game.freeze_daytime(true)
        freeze_state = true
      end
    else
      counter = 0
    end
  end
end)
Not entirely sure what all i changed, but it doesn't error out and the day nite cycle seems to be extended with the config of '3' *shrug* I think i commented out things that aren't needed and changed other things so they work. pretty sure we don't need to freeze the game on_load since its just gonna do a freeze/unfreeze at the next tick event.

Edit: On a side note, not sure if it was the aforementioned changes or the original code, but the setting of '3' in the file actually makes the day 4 times as long, it seems to add 3 days to the cycle. Not a big problem i guess. Just figured someone might wanna know if they were trying to keep the time specific.

JyeGuru
Inserter
Inserter
Posts: 21
Joined: Thu Sep 11, 2014 3:59 am
Contact:

Re: [0.12.X] Longer Day/Night Cycles (DayNightExtender 1.1.0)

Post by JyeGuru » Tue Nov 03, 2015 1:07 am

antisocialian wrote:Not entirely sure what all i changed
Patched it based on your code and uploaded it here: https://github.com/yukihyou/factorio-da ... r/releases

The commit history shows the changes (direct link)

User avatar
MalcolmCooks
Filter Inserter
Filter Inserter
Posts: 253
Joined: Mon Apr 06, 2015 8:32 pm
Contact:

Re: [0.12.X] Longer Day/Night Cycles (DayNightExtender 1.1.0)

Post by MalcolmCooks » Sun Nov 15, 2015 5:30 pm

Not working in 12.17, it shows this error when loading/generating a map:
__DayNightExtender__/control.lua:11: attempt to index global 'game' (a nil value)

JyeGuru
Inserter
Inserter
Posts: 21
Joined: Thu Sep 11, 2014 3:59 am
Contact:

Re: [0.12.X] Longer Day/Night Cycles (DayNightExtender 1.1.0)

Post by JyeGuru » Sun Nov 15, 2015 9:11 pm

MalcolmCooks wrote:Not working in 12.17, it shows this error when loading/generating a map:
__DayNightExtender__/control.lua:11: attempt to index global 'game' (a nil value)
Please try using the version linked in the post immediately above yours - it has been updated and works in 0.12.17

cengbrecht
Burner Inserter
Burner Inserter
Posts: 18
Joined: Mon May 12, 2014 7:11 am
Contact:

Re: [0.12.X] Longer Day/Night Cycles (DayNightExtender 1.1.0)

Post by cengbrecht » Sun Dec 20, 2015 9:23 pm

We have tried using the 1.1.1 game version you provided, but its causing desyncs, and seems to have broken the clock after removal.
Please advise. :)

Tritano
Burner Inserter
Burner Inserter
Posts: 17
Joined: Tue Sep 22, 2015 5:12 pm
Contact:

Re: [0.12.X] Longer Day/Night Cycles (DayNightExtender 1.1.0)

Post by Tritano » Thu Apr 07, 2016 1:20 pm

Confirmed, unfortunately. The version 1.1.1 causes desyncs in multiplayer (factorio version 0.12.29)
This happens with client/server on the same fast computer, so it's not a network issue.

mikenlott
Manual Inserter
Manual Inserter
Posts: 1
Joined: Sat Jun 18, 2016 10:48 pm
Contact:

Re: [0.12.X] Longer Day/Night Cycles (DayNightExtender 1.1.0)

Post by mikenlott » Sat Jun 18, 2016 10:57 pm

Hey, i just did a quick dirty update to this mod. Sorts out multiplayer desyncs as far as me and my friend can see (0.12.35). Have a download:
Attachments
DayNightExtender_1.1.2.zip
(1.39 KiB) Downloaded 93 times

EnderTheXenocide
Burner Inserter
Burner Inserter
Posts: 15
Joined: Sat Apr 02, 2016 6:23 pm
Contact:

Re: [0.12.X] Longer Day/Night Cycles (DayNightExtender 1.1.0)

Post by EnderTheXenocide » Fri Jul 08, 2016 9:26 pm

Hey there, I heard of your mod mentioned in a let's play and would love to install it, but I can't get it to work in .13 since I don't know what I'm doing. I changed the info file but when it load it gets mad about references to "game" a nil value or something. No clue.

Would be really cool if you get around to it. Thanks!

User avatar
binbinhfr
Smart Inserter
Smart Inserter
Posts: 1523
Joined: Sat Feb 27, 2016 7:37 pm
Contact:

Re: [0.12.X] Longer Day/Night Cycles (DayNightExtender 1.1.0)

Post by binbinhfr » Sun Jul 10, 2016 2:39 pm

As the original author does not seem to be around anymore, here is my unofficial version, adapted to 0.13 .
I also added a feature so that you can now switch always_day mode on/off, with other mods like timetools
DayNightExtender_1.1.3.zip
(1005 Bytes) Downloaded 101 times
My mods on the Factorio Mod Portal :geek:

EnderTheXenocide
Burner Inserter
Burner Inserter
Posts: 15
Joined: Sat Apr 02, 2016 6:23 pm
Contact:

Re: [0.12.X] Longer Day/Night Cycles (DayNightExtender 1.1.0)

Post by EnderTheXenocide » Mon Jul 11, 2016 10:33 pm

binbinhfr wrote:As the original author does not seem to be around anymore, here is my unofficial version, adapted to 0.13 .
I also added a feature so that you can now switch always_day mode on/off, with other mods like timetools
DayNightExtender_1.1.3.zip

Thanks very much!

Post Reply

Return to “Mods”

Who is online

Users browsing this forum: otakushowboat