Adds button press, hold and release events.
Go to file
2023-12-03 16:36:15 -05:00
.github/workflows add biolerplate basic mod setup 2023-12-03 16:36:15 -05:00
.luacheckrc add intial api layout and a test mode 2023-12-03 16:36:15 -05:00
init.lua more sugar 2023-12-03 16:36:15 -05:00
license add biolerplate basic mod setup 2023-12-03 16:36:15 -05:00
mod.conf add mod.conf 2023-12-03 16:36:15 -05:00
readme.md add spartan readme 2023-12-03 16:36:15 -05:00
settingtypes.txt add intial api layout and a test mode 2023-12-03 16:36:15 -05:00
test.lua send test data per player as to not be spam nightmare when testing with multiple players 2023-12-03 16:36:15 -05:00

api

note: supports all keys minetest does

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)