1
0
mirror of https://github.com/sys4-fr/server-nalc.git synced 2024-12-25 02:00:37 +01:00

[inventory_icon] Use minetest.after (already-used 1s delay)

This commit is contained in:
Wouters Dorian 2015-07-31 14:58:28 +02:00
parent a6faed9f94
commit f94ecd5fd8

View File

@ -91,10 +91,8 @@ minetest.register_on_leaveplayer(function(player)
inventory_icon.hudids[player:get_player_name()] = nil inventory_icon.hudids[player:get_player_name()] = nil
end) end)
inventory_icon.timer = 0 local function tick()
minetest.register_globalstep(function(dtime) minetest.after(1, tick)
inventory_icon.timer = inventory_icon.timer + dtime
if inventory_icon.timer > 1 then
for playername,hudids in pairs(inventory_icon.hudids) do for playername,hudids in pairs(inventory_icon.hudids) do
local player = minetest.get_player_by_name(playername) local player = minetest.get_player_by_name(playername)
local occupied, size = inventory_icon.get_inventory_state(player:get_inventory(), "main") local occupied, size = inventory_icon.get_inventory_state(player:get_inventory(), "main")
@ -133,6 +131,6 @@ minetest.register_globalstep(function(dtime)
end end
end end
end end
inventory_icon.timer = 0 end
end
end) tick()