Epic/mods/furniture/fences.lua

205 lines
6.4 KiB
Lua

minetest.register_node('furniture:fence_1_a', {
_doc_items_crafting = 'This is crafted in the Woodworking Station.',
description = 'Fence',
drawtype = 'mesh',
mesh = 'furniture_fence_1_a.obj',
tiles = {'furniture_fence.png'},
use_texture_alpha = 'opaque',
paramtype = 'light',
paramtype2 = 'colorfacedir',
palette = 'furniture_stain_palette.png',
selection_box = {
type = 'fixed',
fixed = {-.5, -.5, -.0625, .5, .5, .0625},
},
collision_box = {
type = 'fixed',
fixed = {-.5, -.5, -.0625, .5, .5, .0625},
},
groups = {oddly_breakable_by_hand = 2, choppy=3, stainable=1},
on_rightclick = function(pos, node, clicker)
local name = clicker:get_player_name()
if minetest.is_protected(pos, name) then
minetest.record_protection_violation(pos, name)
else
minetest.set_node(pos, {name='furniture:fence_1_d', param2 = node.param2})
end
end
})
minetest.register_node('furniture:fence_1_b', {
_doc_items_crafting = 'This is crafted in the Woodworking Station.',
description = 'Fence',
drawtype = 'mesh',
mesh = 'furniture_fence_1_b.obj',
tiles = {'furniture_fence.png'},
use_texture_alpha = 'opaque',
paramtype = 'light',
paramtype2 = 'colorfacedir',
palette = 'furniture_stain_palette.png',
selection_box = {
type = 'fixed',
fixed = {
{0.0625, -0.5, -0.0625, 0.5, 0.5, 0.0625},
{-0.0625, -0.5, -0.5, 0.0625, 0.5, 0.0625}
}
},
collision_box = {
type = 'fixed',
fixed = {
{0.0625, -0.5, -0.0625, 0.5, 0.5, 0.0625},
{-0.0625, -0.5, -0.5, 0.0625, 0.5, 0.0625}
}
},
groups = {oddly_breakable_by_hand = 2, choppy=3, stainable=1},
})
minetest.register_node('furniture:fence_1_c', {
_doc_items_crafting = 'This is crafted in the Woodworking Station.',
description = 'Fence',
drawtype = 'mesh',
mesh = 'furniture_fence_1_c.obj',
tiles = {'furniture_fence.png'},
use_texture_alpha = 'opaque',
paramtype = 'light',
paramtype2 = 'colorfacedir',
palette = 'furniture_stain_palette.png',
selection_box = {
type = 'fixed',
fixed = {
{-0.5, -0.5, -0.0625, -0.0625, 0.5, 0.0625},
{-0.0625, -0.5, -0.0625, 0.0625, 0.5, 0.5}
},
},
collision_box = {
type = 'fixed',
fixed = {
{-0.5, -0.5, -0.0625, -0.0625, 0.5, 0.0625},
{-0.0625, -0.5, -0.0625, 0.0625, 0.5, 0.5}
}
},
groups = {oddly_breakable_by_hand = 2, choppy=3, stainable=1},
})
minetest.register_node('furniture:fence_1_d', {
description = 'Gate',
drawtype = 'mesh',
mesh = 'furniture_fence_1_d.obj',
tiles = {'furniture_fence.png'},
use_texture_alpha = 'opaque',
paramtype = 'light',
paramtype2 = 'colorfacedir',
palette = 'furniture_stain_palette.png',
selection_box = {
type = 'fixed',
fixed = {
{0.375, -0.5, -0.0625, 0.5, 0.5, 0.0625},
{-0.5, -0.5, -0.0625, -0.375, 0.5, 0.0625},
{-0.375, -0.5, -0.0625, -0.25, 0.375, 0.75}
}
},
collision_box = {
type = 'fixed',
fixed = {
{0.375, -0.5, -0.0625, 0.5, 0.5, 0.0625},
{-0.5, -0.5, -0.0625, -0.375, 0.5, 0.0625},
{-0.375, -0.5, -0.0625, -0.25, 0.375, 0.75}
}
},
groups = {oddly_breakable_by_hand = 2, choppy=3, stainable=1, not_in_creative_inventory=1},
on_rightclick = function(pos, node, clicker)
local name = clicker:get_player_name()
if minetest.is_protected(pos, name) then
minetest.record_protection_violation(pos, name)
else
minetest.set_node(pos, {name='furniture:fence_1_a', param2 = node.param2})
end
end,
})
minetest.register_node('furniture:fence_1_e', {
description = 'Double Fence',
drawtype = 'mesh',
mesh = 'furniture_fence_1_e.obj',
tiles = {'furniture_fence.png'},
use_texture_alpha = 'opaque',
paramtype = 'light',
paramtype2 = 'colorfacedir',
palette = 'furniture_stain_palette.png',
selection_box = {
type = 'fixed',
fixed = {
{1.375, -0.5, -0.0625, 1.5, 0.5, 0.0625},
{-0.5, -0.5, -0.0625, -0.375, 0.5, 0.0625},
{-0.375, -0.5, -0.0625, 1.375, 0.375, 0.0625}
}
},
collision_box = {
type = 'fixed',
fixed = {
{1.375, -0.5, -0.0625, 1.5, 0.5, 0.0625},
{-0.5, -0.5, -0.0625, -0.375, 0.5, 0.0625},
{-0.375, -0.5, -0.0625, 1.375, 0.375, 0.0625}
}
},
groups = {oddly_breakable_by_hand = 2, choppy=3, stainable=1},
after_place_node = function(pos, placer, itemstack)
if not epic.space_to_side(pos) then
minetest.remove_node(pos)
return itemstack
end
end,
after_dig_node = function(pos, oldnode, oldmetadata, digger)
epic.remove_side_node(pos, oldnode)
end,
on_rightclick = function(pos, node, clicker)
local name = clicker:get_player_name()
if minetest.is_protected(pos, name) then
minetest.record_protection_violation(pos, name)
else
minetest.set_node(pos, {name='furniture:fence_1_f', param2 = node.param2})
end
end,
})
minetest.register_node('furniture:fence_1_f', {
description = 'Double Gate',
drawtype = 'mesh',
mesh = 'furniture_fence_1_f.obj',
tiles = {'furniture_fence.png'},
use_texture_alpha = 'opaque',
paramtype = 'light',
paramtype2 = 'colorfacedir',
palette = 'furniture_stain_palette.png',
selection_box = {
type = 'fixed',
fixed = {
{1.375, -0.5, -0.0625, 1.5, 0.5, 0.0625},
{-0.5, -0.5, -0.0625, -0.375, 0.5, 0.0625},
{-0.375, -0.5, -0.0625, -0.25, 0.375, 0.75},
{1.375, -0.5, 0.0625, 1.25, 0.375, 0.75}
}
},
collision_box = {
type = 'fixed',
fixed = {
{1.375, -0.5, -0.0625, 1.5, 0.5, 0.0625},
{-0.5, -0.5, -0.0625, -0.375, 0.5, 0.0625},
{-0.375, -0.5, -0.0625, -0.25, 0.375, 0.75},
{1.375, -0.5, 0.0625, 1.25, 0.375, 0.75}
}
},
groups = {oddly_breakable_by_hand = 2, choppy=3, stainable=1, not_in_creative_inventory=1},
on_rightclick = function(pos, node, clicker)
local name = clicker:get_player_name()
if minetest.is_protected(pos, name) then
minetest.record_protection_violation(pos, name)
else
minetest.set_node(pos, {name='furniture:fence_1_e', param2 = node.param2})
end
end,
after_dig_node = function(pos, oldnode, oldmetadata, digger)
epic.remove_side_node(pos, oldnode)
end,
})