1
0
Fork 0

Add after_rotate in screwdriver API

This commit is contained in:
Wuzzy 2020-08-19 16:27:56 +02:00
parent 988056ad08
commit b14eb70241
2 changed files with 12 additions and 0 deletions

View File

@ -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 = 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)
`after_rotate(pos)` (MineClone 2 extension)
Called after the rotation has been completed
* `pos`: Position of the node that the screwdriver was used on

View File

@ -157,7 +157,11 @@ screwdriver.handler = function(itemstack, user, pointed_thing, mode, uses)
if should_rotate and new_param2 ~= node.param2 then
node.param2 = new_param2
minetest.swap_node(pos, node)
minetest.check_for_falling(pos)
if ndef.after_rotate then
ndef.after_rotate(vector.new(pos))
end
end
if not (minetest.is_creative_enabled(user:get_player_name())) then