2023-12-03 20:44:29 +01:00
|
|
|
controls.register_on_press(function(player, key)
|
2023-12-03 21:15:07 +01:00
|
|
|
local pname = player:get_player_name()
|
|
|
|
minetest.chat_send_player(pname, pname .. " pressed " .. key)
|
2023-12-03 20:44:29 +01:00
|
|
|
end)
|
|
|
|
|
|
|
|
controls.register_on_hold(function(player, key, length)
|
2023-12-03 21:15:07 +01:00
|
|
|
local pname = player:get_player_name()
|
|
|
|
minetest.chat_send_player(pname, pname .. " held " .. key .. " for " .. length .. " seconds")
|
2023-12-03 20:44:29 +01:00
|
|
|
end)
|
|
|
|
|
|
|
|
controls.register_on_release(function(player, key, length)
|
2023-12-03 21:15:07 +01:00
|
|
|
local pname = player:get_player_name()
|
|
|
|
minetest.chat_send_player(pname, pname .. " released " .. key .. " after " .. length .. " seconds")
|
2023-12-03 20:51:55 +01:00
|
|
|
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")
|
2023-12-03 20:44:29 +01:00
|
|
|
end)
|