72 lines
1.7 KiB
Lua
72 lines
1.7 KiB
Lua
|
|
local function rotate_on_rightclick(pos, node, player, itemstack, pointed_thing)
|
|
local node_name = minetest.get_node(pos).name
|
|
local rot = (node_name:sub(#node_name,#node_name) + 1 ) % 4
|
|
node.name = node_name:sub(1,-2) .. rot
|
|
minetest.swap_node(pos, node)
|
|
end
|
|
|
|
local rotations={0,1,2,3}
|
|
|
|
for _,v in pairs(rotations) do
|
|
|
|
local tile = {"yl_decals_crack_01.png^[transform"..v}
|
|
|
|
minetest.register_node("yl_decals:crack_01_"..v, {
|
|
description = "Crack Double",
|
|
paramtype = "light",
|
|
sunlight_propagates = true,
|
|
paramtype2 = "wallmounted",
|
|
drawtype = "signlike",
|
|
tiles = tile,
|
|
walkable = false,
|
|
pointable = true,
|
|
diggable = false,
|
|
buildable_to = true,
|
|
on_rightclick = rotate_on_rightclick,
|
|
groups = {not_in_creative_inventory = 1},
|
|
})
|
|
|
|
end
|
|
|
|
for _,v in pairs(rotations) do
|
|
|
|
local tile = {"yl_decals_crack_02.png^[transform"..v}
|
|
|
|
minetest.register_node("yl_decals:crack_02_"..v, {
|
|
description = "Crack Double",
|
|
paramtype = "light",
|
|
sunlight_propagates = true,
|
|
paramtype2 = "wallmounted",
|
|
drawtype = "signlike",
|
|
tiles = tile,
|
|
walkable = false,
|
|
pointable = true,
|
|
diggable = false,
|
|
buildable_to = true,
|
|
on_rightclick = rotate_on_rightclick,
|
|
groups = {not_in_creative_inventory = 1},
|
|
})
|
|
|
|
end
|
|
|
|
for _,v in pairs(rotations) do
|
|
|
|
local tile = {"yl_decals_crack_03.png^[transform"..v}
|
|
|
|
minetest.register_node("yl_decals:crack_03_"..v, {
|
|
description = "Crack Double",
|
|
paramtype = "light",
|
|
sunlight_propagates = true,
|
|
paramtype2 = "wallmounted",
|
|
drawtype = "signlike",
|
|
tiles = tile,
|
|
walkable = false,
|
|
pointable = true,
|
|
diggable = false,
|
|
buildable_to = true,
|
|
on_rightclick = rotate_on_rightclick,
|
|
groups = {not_in_creative_inventory = 1},
|
|
})
|
|
|
|
end |