Node Touch Action
Pass in a node name and a function, and every time a player touches that node, the function happens
Pass in a node name and a function, and every time a player touches that node, your custom function executes. This mod is heavilly based on the cactus_damage mod by VMan_2002
Example:
When adding gameplay, one thing that comes in handy is performing an action when a player touches a node. For example making a player take hitpoint damage when touching a cactus. In my Hero Mines game I needed a light to break when a player touched it, and for the player to take damage when touching magma nodes. You can see the magma example below.
Usage:
Add the node_touch_action to the depends statement in your mod.conf file:
depends = default, node_touch_action
After you register your node create a function to be executed when the node is touched:
local function magmaTouchAction(player)
player:set_hp(player:get_hp() - 1, "magma")
end
Then Register the action to occur when node is touched. The first parameter is the node name, the second parameter is the function that happens when the node is touched.
registerNodeTouchAction("hero_mines:magma", magmaTouchAction) Links
- Source: https://github.com/Neuromancer56/node_touch_action
- Forum: https://forum.luanti.org/viewtopic.php?t=30322
- Issues: https://github.com/Neuromancer56/node_touch_action/issues
- Website: https://forum.minetest.net/viewtopic.php?t=30322
- Original ContentDB page: content.luanti.org/packages/Neuromancer/node_touch_action/
License
MIT
Development state
ACTIVELY_DEVELOPED
| Version | Date | Min engine | Size | Download |
|---|---|---|---|---|
| 2024-05-12 | 2024-05-12 02:24:17 | 717 KB | Download |