mirror of
https://github.com/mt-mods/controls.git
synced 2024-11-08 08:03:47 +01:00
send test data per player as to not be spam nightmare when testing with multiple players
This commit is contained in:
parent
86eb7ca604
commit
2cdcadf6d1
9
test.lua
9
test.lua
@ -1,13 +1,16 @@
|
|||||||
controls.register_on_press(function(player, key)
|
controls.register_on_press(function(player, key)
|
||||||
minetest.chat_send_all(player:get_player_name() .. " pressed " .. key)
|
local pname = player:get_player_name()
|
||||||
|
minetest.chat_send_player(pname, pname .. " pressed " .. key)
|
||||||
end)
|
end)
|
||||||
|
|
||||||
controls.register_on_hold(function(player, key, length)
|
controls.register_on_hold(function(player, key, length)
|
||||||
minetest.chat_send_all(player:get_player_name() .. " held " .. key .. " for " .. length .. " seconds")
|
local pname = player:get_player_name()
|
||||||
|
minetest.chat_send_player(pname, pname .. " held " .. key .. " for " .. length .. " seconds")
|
||||||
end)
|
end)
|
||||||
|
|
||||||
controls.register_on_release(function(player, key, length)
|
controls.register_on_release(function(player, key, length)
|
||||||
minetest.chat_send_all(player:get_player_name() .. " released " .. key .. " after " .. length .. " seconds")
|
local pname = player:get_player_name()
|
||||||
|
minetest.chat_send_player(pname, pname .. " released " .. key .. " after " .. length .. " seconds")
|
||||||
end)
|
end)
|
||||||
|
|
||||||
minetest.register_on_joinplayer(function(player, _)
|
minetest.register_on_joinplayer(function(player, _)
|
||||||
|
Loading…
Reference in New Issue
Block a user