1
0
mirror of https://github.com/minetest-mods/i3.git synced 2025-07-15 15:00:37 +02:00

Get window info once per second

This commit is contained in:
Jean-Patrick Guerrero
2023-03-08 16:42:15 +01:00
parent d5df9f6f0f
commit b7308b4739
2 changed files with 8 additions and 2 deletions

@ -468,7 +468,8 @@ core.register_on_player_receive_fields(function(player, formname, fields)
end
if tab.fields then
tab.fields(player, data, fields)
local ret = tab.fields(player, data, fields)
if ret == false then return end
end
end

@ -118,7 +118,12 @@ core.register_globalstep(function(dt)
local data = i3.data[name]
if not data then return end
data.window = get_window_info and get_window_info(name) or nil
data.window_timer = (data.window_timer or 0) + dt
if data.window_timer > 1 then
data.window_timer = 0
data.window = get_window_info and get_window_info(name) or nil
end
if data.show_hud ~= nil then
show_hud(player, data)