mirror of
https://github.com/mt-mods/controls.git
synced 2024-11-08 16:13:46 +01:00
21 lines
992 B
Lua
21 lines
992 B
Lua
controls.register_on_press(function(player, key)
|
|
local pname = player:get_player_name()
|
|
minetest.chat_send_player(pname, pname .. " pressed " .. key)
|
|
end)
|
|
|
|
controls.register_on_hold(function(player, key, length)
|
|
local pname = player:get_player_name()
|
|
minetest.chat_send_player(pname, pname .. " held " .. key .. " for " .. length .. " seconds")
|
|
end)
|
|
|
|
controls.register_on_release(function(player, key, length)
|
|
local pname = player:get_player_name()
|
|
minetest.chat_send_player(pname, pname .. " released " .. key .. " after " .. length .. " seconds")
|
|
end)
|
|
|
|
minetest.register_on_joinplayer(function(player, _)
|
|
local pname = player:get_player_name()
|
|
minetest.chat_send_player(pname, #controls.registered_on_press .. " registered_on_press callbacks")
|
|
minetest.chat_send_player(pname, #controls.registered_on_hold .. " registered_on_hold callbacks")
|
|
minetest.chat_send_player(pname, #controls.registered_on_release .. " registered_on_release callbacks")
|
|
end) |