mirror of
https://github.com/appgurueu/modlib.git
synced 2024-11-22 07:13:45 +01:00
rolling-4
This commit is contained in:
parent
b25fc33e64
commit
08bb51c1be
16
minetest.lua
16
minetest.lua
@ -72,4 +72,20 @@ minetest.register_globalstep(function(dtime)
|
||||
end
|
||||
delta_times[k]=v
|
||||
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)
|
Loading…
Reference in New Issue
Block a user