mirror of
https://git.minetest.land/VoxeLibre/VoxeLibre.git
synced 2024-11-16 16:11:06 +01:00
Add after_rotate in screwdriver API
This commit is contained in:
parent
988056ad08
commit
b14eb70241
2 changed files with 12 additions and 0 deletions
|
@ -18,3 +18,11 @@ To use it, add the `on_rotate` function to the node definition.
|
||||||
* use `on_rotate = false` to always disallow rotation
|
* use `on_rotate = false` to always disallow rotation
|
||||||
* use `on_rotate = screwdriver.rotate_simple` to allow only face 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)
|
* use `on_rotate = screwdriver.rotate_3way` (MineClone 2 extension) for pillar-like nodes that should only have 3 possible orientations)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
`after_rotate(pos)` (MineClone 2 extension)
|
||||||
|
|
||||||
|
Called after the rotation has been completed
|
||||||
|
|
||||||
|
* `pos`: Position of the node that the screwdriver was used on
|
||||||
|
|
|
@ -157,7 +157,11 @@ screwdriver.handler = function(itemstack, user, pointed_thing, mode, uses)
|
||||||
if should_rotate and new_param2 ~= node.param2 then
|
if should_rotate and new_param2 ~= node.param2 then
|
||||||
node.param2 = new_param2
|
node.param2 = new_param2
|
||||||
minetest.swap_node(pos, node)
|
minetest.swap_node(pos, node)
|
||||||
|
|
||||||
minetest.check_for_falling(pos)
|
minetest.check_for_falling(pos)
|
||||||
|
if ndef.after_rotate then
|
||||||
|
ndef.after_rotate(vector.new(pos))
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
if not (minetest.is_creative_enabled(user:get_player_name())) then
|
if not (minetest.is_creative_enabled(user:get_player_name())) then
|
||||||
|
|
Loading…
Reference in a new issue