Add free_rotation
parent
a3dcc457bb
commit
827fe97f4c
2
API.md
2
API.md
|
@ -44,6 +44,8 @@ This also registers two crafting recipes of this shape
|
|||
Default: 1st texture of the original block.
|
||||
* `no_craft`: Optional. If `true`, no crafting recipes are registered.
|
||||
Default: `false`
|
||||
* `free_rotation`: Optional: If `true`, rotation by screwdriver is unrestricted.
|
||||
Default: Rotation is restricted to 3 axes
|
||||
|
||||
### Return value
|
||||
|
||||
|
|
13
init.lua
13
init.lua
|
@ -37,7 +37,7 @@ end
|
|||
|
||||
-- Shifted blocks
|
||||
|
||||
shifted_blocks.register_shifted_block = function(itemstring, original_block, description, side_texture, help, block_texture, no_craft)
|
||||
shifted_blocks.register_shifted_block = function(itemstring, original_block, description, side_texture, help, block_texture, no_craft, free_rotation)
|
||||
local stone = side_texture or minetest.registered_nodes[original_block].tiles[1]
|
||||
local normal = block_texture or minetest.registered_nodes[original_block].tiles[1]
|
||||
|
||||
|
@ -52,13 +52,20 @@ shifted_blocks.register_shifted_block = function(itemstring, original_block, des
|
|||
help = nil
|
||||
end
|
||||
|
||||
local rotate = on_rotate
|
||||
local place_param2 = 0
|
||||
if free_rotation then
|
||||
rotate = nil
|
||||
place_param2 = nil
|
||||
end
|
||||
|
||||
minetest.register_node(itemstring, {
|
||||
description = description,
|
||||
_doc_items_longdesc = help,
|
||||
on_rotate = on_rotate,
|
||||
on_rotate = rotate,
|
||||
paramtype2 = "facedir",
|
||||
-- TODO: Place node according to view direction (restrict param2 to 0 or 3)
|
||||
place_param2 = 0,
|
||||
place_param2 = place_param2,
|
||||
tiles = {combine, combine, stone, stone, combine.."^[transformFX", combine},
|
||||
is_ground_content = false,
|
||||
groups = minetest.registered_nodes[original_block].groups,
|
||||
|
|
Loading…
Reference in New Issue