From 862e3141d91bf9a2f8a0d11e7faf233a16a3600d Mon Sep 17 00:00:00 2001 From: Wuzzy Date: Sat, 14 Dec 2019 23:50:17 +0100 Subject: [PATCH] Add API documentation for screwdriver mod --- mods/ITEMS/screwdriver/API.md | 20 +++++++++++++++++++ .../screwdriver/{README.txt => README.md} | 8 ++++---- 2 files changed, 24 insertions(+), 4 deletions(-) create mode 100644 mods/ITEMS/screwdriver/API.md rename mods/ITEMS/screwdriver/{README.txt => README.md} (69%) diff --git a/mods/ITEMS/screwdriver/API.md b/mods/ITEMS/screwdriver/API.md new file mode 100644 index 0000000000..03cc6fdd49 --- /dev/null +++ b/mods/ITEMS/screwdriver/API.md @@ -0,0 +1,20 @@ +Screwdriver API +--------------- + +The screwdriver API allows you to control a node's behaviour when a screwdriver is used on it. +NOTE: This API is compatible with Minetest Game 5.1.0, but has some extensions. + +To use it, add the `on_rotate` function to the node definition. + +`on_rotate(pos, node, user, mode, new_param2)` + + * `pos`: Position of the node that the screwdriver is being used on + * `node`: that node + * `user`: The player who used the screwdriver + * `mode`: `screwdriver.ROTATE_FACE` or `screwdriver.ROTATE_AXIS` + * `new_param2` the new value of `param2` that would have been set if `on_rotate` wasn't there + * return value: false to disallow rotation, nil to keep default behaviour, true to allow + it but to indicate that changed have already been made (so the screwdriver will wear out) + * use `on_rotate = false` to always disallow rotation + * use `on_rotate = screwdriver.rotate_simple` to allow only face rotation + * use `on_rotate = screwdriver.rotate_3way` (MineClone 2 extension) for pillar-like nodes that should only have 3 possible orientations) diff --git a/mods/ITEMS/screwdriver/README.txt b/mods/ITEMS/screwdriver/README.md similarity index 69% rename from mods/ITEMS/screwdriver/README.txt rename to mods/ITEMS/screwdriver/README.md index 9d39c58c90..7237c84710 100644 --- a/mods/ITEMS/screwdriver/README.txt +++ b/mods/ITEMS/screwdriver/README.md @@ -1,5 +1,5 @@ -Minetest Game mod: screwdriver -============================== +MineClone 2 mod: screwdriver +============================ See license.txt for license information. License of source code @@ -9,5 +9,5 @@ Various Minetest developers and contributors (LGPL 2.1) License of media (textures) --------------------------- -Created by Gambit (CC BY-SA 3.0): - screwdriver.png +Created by Wuzzy (CC0): +* `screwdriver.png`