rolling-4

This commit is contained in:
Lars Mueller 2020-02-09 14:58:26 +01:00
parent b25fc33e64
commit 08bb51c1be

@ -72,4 +72,20 @@ minetest.register_globalstep(function(dtime)
end end
delta_times[k]=v delta_times[k]=v
end end
end)
form_listeners = {}
function register_form_listener(formname, func)
local current_listeners = form_listeners[formname] or {}
table.insert(current_listeners, func)
form_listeners[formname] = current_listeners
end
minetest.register_on_player_receive_fields(function(player, formname, fields)
local handlers = form_listeners[formname]
if handlers then
for _, handler in pairs(handlers) do
handler(player, fields)
end
end
end) end)