automatic update

This commit is contained in:
HybridDog 2014-08-08 13:39:58 +02:00
parent 51f60dd676
commit 2c18e641f1

View File

@ -151,7 +151,7 @@ function vector.twoline(x, y)
if y < 0 then if y < 0 then
ymin, ymax = ymax, ymin ymin, ymax = ymax, ymin
end end
local m = y/x local m = y/x --y/0 works too
local dir = 1 local dir = 1
if m < 0 then if m < 0 then
dir = -dir dir = -dir
@ -178,6 +178,9 @@ end
vector.zero = {x=0, y=0, z=0} vector.zero = {x=0, y=0, z=0}
function vector.sun_dir(time) function vector.sun_dir(time)
if not time then
time = minetest.get_timeofday()
end
local t = (time-0.5)*5/6+0.5 --the sun rises at 5 o'clock, not at 6 local t = (time-0.5)*5/6+0.5 --the sun rises at 5 o'clock, not at 6
if t < 0.25 if t < 0.25
or t > 0.75 then or t > 0.75 then