mirror of
https://github.com/luanti-org/luanti.git
synced 2025-07-22 17:18:39 +00:00
Add EnvRef:set_timeofday(0...1) and EnvRef:get_timeofday()
This commit is contained in:
parent
cb05a28745
commit
2e8e9ee7f5
3 changed files with 60 additions and 2 deletions
|
@ -4,6 +4,8 @@
|
|||
|
||||
-- For testing random stuff
|
||||
|
||||
experimental = {}
|
||||
|
||||
function on_step(dtime)
|
||||
-- print("experimental on_step")
|
||||
--[[
|
||||
|
@ -20,6 +22,26 @@ function on_step(dtime)
|
|||
end
|
||||
end
|
||||
--]]
|
||||
--[[
|
||||
if experimental.t1 == nil then
|
||||
experimental.t1 = 0
|
||||
end
|
||||
experimental.t1 = experimental.t1 + dtime
|
||||
if experimental.t1 >= 2 then
|
||||
experimental.t1 = experimental.t1 - 2
|
||||
minetest.log("time of day is "..minetest.env:get_timeofday())
|
||||
if experimental.day then
|
||||
minetest.log("forcing day->night")
|
||||
experimental.day = false
|
||||
minetest.env:set_timeofday(0.0)
|
||||
else
|
||||
minetest.log("forcing night->day")
|
||||
experimental.day = true
|
||||
minetest.env:set_timeofday(0.5)
|
||||
end
|
||||
minetest.log("time of day is "..minetest.env:get_timeofday())
|
||||
end
|
||||
--]]
|
||||
end
|
||||
minetest.register_globalstep(on_step)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue