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..