mirror of
https://github.com/mt-mods/controls.git
synced 2024-11-28 01:23:43 +01:00
Adds button press, hold and release events.
.github/workflows | ||
.luacheckrc | ||
init.lua | ||
license | ||
mod.conf | ||
readme.md | ||
settingtypes.txt | ||
test.lua |
api
controls.register_on_press(function(player, key)
-- called on key down
-- @player: player object
-- @key: key pressed
end)
controls.register_on_hold(function(player, key, length)
-- called while key is held
-- @player: player object
-- @key: key pressed
-- @length: length of time key was held in seconds
end)
controls.register_on_release(function(player, key, length)
-- called on key up
-- @player: player object
-- @key: key pressed
-- @length: length of time key was held in seconds
end)
keys
supports all the keys minetest does
special keys:
@_drop: called when a player drops an item (note: only supported in register_on_press api method)