Change us_time calls to gametime.

This commit is contained in:
Duane 2016-06-21 00:38:38 -05:00
parent 2b8b604162
commit 11c4a7d7d0
3 changed files with 6 additions and 6 deletions

View file

@ -1,7 +1,7 @@
-- see also, fungal_tree.lua
-- player surface damage and hunger
local dps_delay = 3000000
local dps_delay = 3
local last_dps_check = 0
local cold_delay = 5
@ -42,7 +42,7 @@ spike_soil['fun_caves:black_sand'] = true
-- all the fun_caves globalstep functions
------------------------------------------------------------
minetest.register_globalstep(function(dtime)
local time = minetest.get_us_time()
local time = minetest.get_gametime()
-- Execute only after an interval.
if last_dps_check and time - last_dps_check < dps_delay then
@ -170,7 +170,7 @@ minetest.register_globalstep(function(dtime)
dps_count = hunger_delay
end
last_dps_check = minetest.get_us_time()
last_dps_check = minetest.get_gametime()
dps_count = dps_count - 1
end)

View file

@ -5,7 +5,7 @@ local function armor(user, factor)
user:set_armor_groups({fleshy=factor})
--print(dump(user:get_armor_groups()))
minetest.chat_send_player(player_name, 'Your skin feels harder...')
fun_caves.armor_expire[player_name] = minetest.get_us_time() + (3600 * 1000000)
fun_caves.armor_expire[player_name] = minetest.get_gametime() + 3600
end
local descs = {

View file

@ -10,9 +10,9 @@ minetest.register_chatcommand("armor", {
for group, value in pairs(armor) do
minetest.chat_send_player(name, " "..group.." "..value)
end
--print(math.floor(minetest.get_us_time() / (60 * 1000000)))
print(math.floor(minetest.get_gametime() / 60))
if fun_caves.armor_expire and fun_caves.armor_expire[name] then
local min = math.floor((fun_caves.armor_expire[name] - minetest.get_us_time()) / (60 * 1000000))
local min = math.floor((fun_caves.armor_expire[name] - minetest.get_gametime()) / 60)
minetest.chat_send_player(name, "Your elixir will expire in "..min..' minutes.')
end
end