use world.getTime() instead of getTimeOfDay()
getTimeOfDay() breaks if doDaylightCycle is false (i.e. testing world)
This commit is contained in:
parent
da20d7517b
commit
a8b2b841f8
@ -687,16 +687,16 @@ function tick()
|
|||||||
setColor()
|
setColor()
|
||||||
end
|
end
|
||||||
-- optimization, only execute these with certain frequency --
|
-- optimization, only execute these with certain frequency --
|
||||||
if world.getTimeOfDay() % 5 == 0 then -- 1/4 second
|
if world.getTime() % 5 == 0 then -- 1/4 second
|
||||||
if player:getPose() == "SLEEPING" then
|
if player:getPose() == "SLEEPING" then
|
||||||
snore()
|
snore()
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
-- unneeded for now but can uncomment if needed
|
-- unneeded for now but can uncomment if needed
|
||||||
--if world.getTimeOfDay() % 20 == 0 then -- 1 second
|
--if world.getTime() % 20 == 0 then -- 1 second
|
||||||
-- Sync state every 10 seconds
|
-- Sync state every 10 seconds
|
||||||
if world.getTimeOfDay() % (20*10) == 0 then
|
if world.getTime() % (20*10) == 0 then
|
||||||
sharedstate.sync()
|
sharedstate.sync()
|
||||||
end
|
end
|
||||||
--end
|
--end
|
||||||
|
Loading…
x
Reference in New Issue
Block a user