mirror of
https://github.com/mt-mods/spacesuit.git
synced 2026-05-04 05:46:52 -06:00
Merge pull request #7 from coil0/timer
Wear spacesuit accounting for server lag
This commit is contained in:
+6
-6
@@ -30,7 +30,7 @@ minetest.register_globalstep(function(dtime)
|
||||
if not stack:is_empty() then
|
||||
local name = stack:get_name()
|
||||
if name:sub(1, 10) == "spacesuit:" then
|
||||
local use = minetest.get_item_group(name, "armor_use") or 0
|
||||
local use = minetest.get_item_group(name, "armor_use") * timer or 0
|
||||
armor:damage(player, i, stack, use)
|
||||
end
|
||||
end
|
||||
@@ -41,10 +41,10 @@ minetest.register_globalstep(function(dtime)
|
||||
end
|
||||
timer = 0
|
||||
|
||||
local t1 = minetest.get_us_time()
|
||||
local diff = t1 - t0
|
||||
if diff > 10000 then
|
||||
minetest.log("warning", "[spacesuit] update took " .. diff .. " us")
|
||||
end
|
||||
local t1 = minetest.get_us_time()
|
||||
local diff = t1 - t0
|
||||
if diff > 10000 then
|
||||
minetest.log("warning", "[spacesuit] update took " .. diff .. " us")
|
||||
end
|
||||
end
|
||||
end)
|
||||
|
||||
Reference in New Issue
Block a user