Set day longer than the night or select season

amadin
Member
 
Posts: 548
Joined: Tue Jun 16, 2015 16:23

Set day longer than the night or select season

by amadin » Tue Aug 18, 2015 19:18

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?
 

User avatar
Casimir
Member
 
Posts: 1163
Joined: Fri Aug 03, 2012 16:59
GitHub: CasimirKaPazi

Re: Set day longer than the night or select season

by Casimir » Tue Aug 18, 2015 20:31

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.
 

User avatar
Gael de Sailly
Member
 
Posts: 743
Joined: Sun Jan 26, 2014 17:01
Location: Confined somewhere in France...
GitHub: Gael-de-Sailly
IRC: Gael-de-Sailly
In-game: Gael-de-Sailly Ginkgoo

Re: Set day longer than the night or select season

by Gael de Sailly » Mon Aug 31, 2015 11:48

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.
Just realize how bored we would be if the world was perfect.
 

User avatar
ArguablySane
Member
 
Posts: 116
Joined: Sun Oct 12, 2014 21:29

Re: Set day longer than the night or select season

by ArguablySane » Mon Aug 31, 2015 11:57

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.
The above post and any ideas expressed therein are released to the public domain under a Creative Commons CC0 license.
 

Red2
New member
 
Posts: 4
Joined: Fri Sep 04, 2015 21:39
GitHub: red-001
IRC: red1

Re: Set day longer than the night or select season

by Red2 » Sat Sep 05, 2015 08:33

You could increase the speed at day and decrease it at night.
 

User avatar
Don
Member
 
Posts: 1643
Joined: Sat May 17, 2014 18:40
GitHub: DonBatman
IRC: Batman
In-game: Batman

Re: Set day longer than the night or select season

by Don » Sat Sep 12, 2015 19:52

Something like this should do the trick for day/night cycles/

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)
Many of my mods are now a part of Minetest-mods. A place where you know they are maintained!

A list of my mods can be found here
 

User avatar
Krock
Developer
 
Posts: 4478
Joined: Thu Oct 03, 2013 07:48
Location: Switzerland
GitHub: SmallJoker

Re: Set day longer than the night or select season

by Krock » Sat Sep 12, 2015 20:00

Don wrote:Something like this should do the trick for day/night cycles/

<snip>

Nice idea. How about this little bit tuned script?
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..
Look, I programmed a bug for you. >> Mod Search Engine << - Mods by Krock - DuckDuckGo mod search bang: !mtmod <keyword here>
 

User avatar
Don
Member
 
Posts: 1643
Joined: Sat May 17, 2014 18:40
GitHub: DonBatman
IRC: Batman
In-game: Batman

Re: Set day longer than the night or select season

by Don » Sat Sep 12, 2015 20:16

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.
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)
Many of my mods are now a part of Minetest-mods. A place where you know they are maintained!

A list of my mods can be found here
 


Return to Feature Discussion



Who is online

Users browsing this forum: No registered users and 8 guests