Page 1 of 1

Set day longer than the night or select season

PostPosted: Tue Aug 18, 2015 19:18
by amadin
I read that the change in the length of day and night varies depending on time of year in minetest. If it's true do i can set the summer forever in minetest.conf to have long day and short nigh or another method?

Re: Set day longer than the night or select season

PostPosted: Tue Aug 18, 2015 20:31
by Casimir
Currently there are no seasons.

This one would do it. You would have to write a small mod so you can use it.
https://github.com/minetest/minetest/bl ... .txt#L2551

Or you could use beds.

Re: Set day longer than the night or select season

PostPosted: Mon Aug 31, 2015 11:48
by Gael de Sailly
minetest.override_day_night_ratio don't change the duration of the day and the night, in that it don't change the "speed" of the sun and the moon. It only changes the brightness.

Re: Set day longer than the night or select season

PostPosted: Mon Aug 31, 2015 11:57
by ArguablySane
You could use minetest.get_timeofday() and minetest.set_timeofday(val) to fake it. It might not look very good, but you could add time to a cycle by periodically setting the time of day back by a small fraction, and subtract time by jumping forward every so often.

It would be an ugly hack, but it would work.

Re: Set day longer than the night or select season

PostPosted: Sat Sep 05, 2015 08:33
by Red2
You could increase the speed at day and decrease it at night.

Re: Set day longer than the night or select season

PostPosted: Sat Sep 12, 2015 19:52
by Don
Something like this should do the trick for day/night cycles/

Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
Code: Select all
local dspeed = "72"
local nspeed = "144"

local morn = 6000
local night = 22000
local timer = 0
minetest.register_globalstep(function(dtime)
   timer = timer + dtime;
   if timer >= 100 then
      if minetest.get_timeofday() * 24000 >= morn and
         minetest.get_timeofday() * 24000 <= morn +1000 then
      minetest.setting_set("time_speed", dspeed)
      elseif minetest.get_timeofday() * 24000 >=night and
             minetest.get_timeofday() * 24000 <=night +1000 then
      minetest.setting_set("time_speed", nspeed)
      end
      timer = 0
   end
end)

Re: Set day longer than the night or select season

PostPosted: Sat Sep 12, 2015 20:00
by Krock
Don wrote:Something like this should do the trick for day/night cycles/

<snip>

Nice idea. How about this little bit tuned script?
Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
Code: Select all
local day_speed = minetest.setting_get("time_speed")
local night_speed = tostring(tonumber(day_speed) * 2)

local morn = 6000
local night = 22000
local timer = 0
minetest.register_globalstep(function(dtime)
   timer = timer + dtime
   if timer < 1 then
      return
   end
   timer = 0
   local time_in_seconds = minetest.get_timeofday() * 24000
   if time_in_seconds >= morn and
         time_in_seconds <= morn + 1000 then
      minetest.setting_set("time_speed", day_speed)
   elseif time_in_seconds >= night and
         time_in_seconds <= night + 1000 then
      minetest.setting_set("time_speed", night_speed)
   end
end)

Sadly, I'm not sure whether the time setting is saved nor not..

Re: Set day longer than the night or select season

PostPosted: Sat Sep 12, 2015 20:16
by Don
Krock wrote:
Don wrote:Something like this should do the trick for day/night cycles/

<snip>

Nice idea. How about this little bit tuned script?

Sadly, I'm not sure whether the time setting is saved nor not..


That looks nice. Just need to make a little change cause it is changing the speed a few time for each. I am just changing the morn+1000 to morn+100 an same for night.
Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
Code: Select all
    local day_speed = minetest.setting_get("time_speed")
    local night_speed = tostring(tonumber(day_speed) * 2)

    local morn = 6000
    local night = 22000
    local timer = 0
    minetest.register_globalstep(function(dtime)
       timer = timer + dtime
       if timer < 1 then
          return
       end
       timer = 0
       local time_in_seconds = minetest.get_timeofday() * 24000
       if time_in_seconds >= morn and
             time_in_seconds <= morn + 100 then
          minetest.setting_set("time_speed", day_speed)
       elseif time_in_seconds >= night and
             time_in_seconds <= night + 100 then
          minetest.setting_set("time_speed", night_speed)
       end
    end)