mirror of
https://github.com/appgurueu/modlib.git
synced 2024-11-26 01:03:46 +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
|
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)
|
Loading…
Reference in New Issue
Block a user