forked from MineClone5/MineClone5
Fix minor bug in mcl_time
This commit is contained in:
parent
a634137436
commit
5ec7c5d246
|
@ -1,4 +1,4 @@
|
||||||
# mcl_time v2.1
|
# mcl_time v2.2
|
||||||
## by kay27 for MineClone 5
|
## by kay27 for MineClone 5
|
||||||
---------------------------
|
---------------------------
|
||||||
This mod counts time when all players sleep or some area is inactive.
|
This mod counts time when all players sleep or some area is inactive.
|
||||||
|
|
|
@ -102,7 +102,7 @@ function mcl_time.get_number_of_times_at_pos(pos, interval, chance)
|
||||||
local meta = minetest.get_meta(pos)
|
local meta = minetest.get_meta(pos)
|
||||||
local last_time = meta:get_int(meta_name)
|
local last_time = meta:get_int(meta_name)
|
||||||
meta:set_int(meta_name, seconds_irl_public)
|
meta:set_int(meta_name, seconds_irl_public)
|
||||||
local number_of_times = (last_time == 0) and 0 or get_number_of_times(last_time, interval, chance)
|
local number_of_times = (last_time <= 0) and 0 or get_number_of_times(last_time, interval, chance)
|
||||||
return number_of_times
|
return number_of_times
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -125,7 +125,7 @@ function mcl_time.get_irl_seconds_passed_at_pos(pos)
|
||||||
local meta = minetest.get_meta(pos)
|
local meta = minetest.get_meta(pos)
|
||||||
local last_time = meta:get_int(meta_name)
|
local last_time = meta:get_int(meta_name)
|
||||||
meta:set_int(meta_name, seconds_irl_public)
|
meta:set_int(meta_name, seconds_irl_public)
|
||||||
local irl_seconds_passed = (last_time == 0) and 0 or (seconds_irl_public - last_time)
|
local irl_seconds_passed = (last_time <= 0) and 0 or (seconds_irl_public - last_time)
|
||||||
return irl_seconds_passed
|
return irl_seconds_passed
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -135,7 +135,7 @@ function mcl_time.get_irl_seconds_passed_at_pos_or_1(pos)
|
||||||
local meta = minetest.get_meta(pos)
|
local meta = minetest.get_meta(pos)
|
||||||
local last_time = meta:get_int(meta_name)
|
local last_time = meta:get_int(meta_name)
|
||||||
meta:set_int(meta_name, seconds_irl_public)
|
meta:set_int(meta_name, seconds_irl_public)
|
||||||
local irl_seconds_passed = (last_time == 0) and 1 or (seconds_irl_public - last_time)
|
local irl_seconds_passed = (last_time <= 0) and 1 or (seconds_irl_public - last_time)
|
||||||
return irl_seconds_passed
|
return irl_seconds_passed
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -145,7 +145,7 @@ function mcl_time.get_irl_seconds_passed_at_pos_or_nil(pos)
|
||||||
local meta = minetest.get_meta(pos)
|
local meta = minetest.get_meta(pos)
|
||||||
local last_time = meta:get_int(meta_name)
|
local last_time = meta:get_int(meta_name)
|
||||||
meta:set_int(meta_name, seconds_irl_public)
|
meta:set_int(meta_name, seconds_irl_public)
|
||||||
if last_time == 0 then return end
|
if last_time <= 0 then return end
|
||||||
local delta_time = seconds_irl_public - last_time
|
local delta_time = seconds_irl_public - last_time
|
||||||
if delta_time <= 0 then return end
|
if delta_time <= 0 then return end
|
||||||
return delta_time
|
return delta_time
|
||||||
|
|
Loading…
Reference in New Issue