controls/readme.md

58 lines
1.1 KiB
Markdown
Raw Normal View History

2020-04-28 08:06:22 +02:00
controls library for minetest
2020-12-16 16:19:06 +01:00
![](https://github.com/mt-mods/controls/workflows/luacheck/badge.svg)
2020-12-16 16:31:09 +01:00
[![ContentDB](https://content.minetest.net/packages/BuckarooBanzay/controls/shields/downloads/)](https://content.minetest.net/packages/BuckarooBanzay/controls/)
2020-12-16 16:19:06 +01:00
2020-12-16 16:28:40 +01:00
# Overview
2020-12-16 16:19:06 +01:00
2020-12-16 16:28:40 +01:00
Utility library for control press/hold/release events
# API
## Supported controls
* jump
* right
* left
* LMB
* RMB
* sneak
* aux1
* down
* up
* zoom
* dig
* place
## callbacks
```lua
controls.register_on_press(function(player, control_name)
-- called on initial key-press
-- control_name: see above
end)
controls.register_on_release(function(player, control_name, time)
-- called on key-release
-- control_name: see above
-- time: seconds the key was pressed
end)
2020-04-28 08:06:22 +02:00
2020-12-16 16:28:40 +01:00
controls.register_on_hold(function(player, control_name, time)
-- called every globalstep if the key is pressed
-- control_name: see above
-- time: seconds the key was pressed
end)
```
# References
used by https://github.com/Arcelmi/minetest-bows.git
2020-04-28 08:06:22 +02:00
Original repo: https://github.com/Arcelmi/minetest-controls
2020-12-16 16:28:40 +01:00
# License
LGPL 2.1 (see `LICENSE` file)