1
0
mirror of https://github.com/mt-mods/homedecor_modpack.git synced 2024-12-23 08:20:21 +01:00

use modern protection function in tabletop nodes

This commit is contained in:
Vanessa Ezekowitz 2014-07-20 10:29:12 -04:00
parent df34140a1a
commit fbed3bfab2

View File

@ -51,35 +51,7 @@ for i in ipairs(materials) do
type = "fixed", type = "fixed",
fixed = { -0.5, -0.5, -0.5, 0.5, -0.4375, 0.5 }, fixed = { -0.5, -0.5, -0.5, 0.5, -0.4375, 0.5 },
}, },
on_place = minetest.rotate_node
on_place = function(itemstack, placer, pointed_thing)
local node = minetest.get_node(pointed_thing.under)
if not minetest.registered_nodes[node.name] or not minetest.registered_nodes[node.name].on_rightclick then
local above = pointed_thing.above
local under = pointed_thing.under
local pitch = placer:get_look_pitch()
local node = minetest.get_node(above)
if node.name ~= "air" then return end
if above.x ~= under.x or above.z ~= under.z then
local fdir = minetest.dir_to_facedir(placer:get_look_dir())
minetest.add_node(above, {name = 'homedecor:'..m..'_table_small_square_s', param2 = fdir})
elseif pitch > 0 then
minetest.add_node(above, {name = 'homedecor:'..m..'_table_small_square_t'})
else
minetest.add_node(above, {name = 'homedecor:'..m..'_table_small_square_b'})
end
if not homedecor.expect_infinite_stacks then
itemstack:take_item()
return itemstack
end
else
minetest.registered_nodes[node.name].on_rightclick(pointed_thing.under, node, placer)
end
end
}) })
minetest.register_node('homedecor:'..m..'_table_small_square_t', { minetest.register_node('homedecor:'..m..'_table_small_square_t', {
@ -181,33 +153,7 @@ for i in ipairs(materials) do
type = "fixed", type = "fixed",
fixed = { -0.5, -0.5, -0.5, 0.5, -0.4375, 0.5 }, fixed = { -0.5, -0.5, -0.5, 0.5, -0.4375, 0.5 },
}, },
on_place = function(itemstack, placer, pointed_thing) on_place = minetest.rotate_node
local node = minetest.get_node(pointed_thing.under)
if not minetest.registered_nodes[node.name] or not minetest.registered_nodes[node.name].on_rightclick then
local above = pointed_thing.above
local under = pointed_thing.under
local pitch = placer:get_look_pitch()
local node = minetest.get_node(above)
if node.name ~= "air" then return end
if above.x ~= under.x or above.z ~= under.z then
local fdir = minetest.dir_to_facedir(placer:get_look_dir())
minetest.add_node(above, {name = 'homedecor:'..m..'_table_small_round_s', param2 = fdir})
elseif pitch > 0 then
minetest.add_node(above, {name = 'homedecor:'..m..'_table_small_round_t'})
else
minetest.add_node(above, {name = 'homedecor:'..m..'_table_small_round_b'})
end
if not homedecor.expect_infinite_stacks then
itemstack:take_item()
return itemstack
end
else
minetest.registered_nodes[node.name].on_rightclick(pointed_thing.under, node, placer)
end
end
}) })
minetest.register_node('homedecor:'..m..'_table_small_round_t', { minetest.register_node('homedecor:'..m..'_table_small_round_t', {
@ -307,34 +253,7 @@ for i in ipairs(materials) do
type = "fixed", type = "fixed",
fixed = { -0.5, -0.5, -0.5, 0.5, -0.4375, 0.5 }, fixed = { -0.5, -0.5, -0.5, 0.5, -0.4375, 0.5 },
}, },
on_place = function(itemstack, placer, pointed_thing) on_place = minetest.rotate_node
local node = minetest.get_node(pointed_thing.under)
if not minetest.registered_nodes[node.name] or not minetest.registered_nodes[node.name].on_rightclick then
local above = pointed_thing.above
local under = pointed_thing.under
local pitch = placer:get_look_pitch()
local node = minetest.get_node(above)
if node.name ~= "air" then return end
if above.x ~= under.x or above.z ~= under.z then
local fdir = minetest.dir_to_facedir(placer:get_look_dir())
minetest.add_node(above, {name = 'homedecor:'..m..'_table_large_s', param2 = fdir})
elseif pitch > 0 then
minetest.add_node(above, {name = 'homedecor:'..m..'_table_large_t'})
else
minetest.add_node(above, {name = 'homedecor:'..m..'_table_large_b'})
end
if not homedecor.expect_infinite_stacks then
itemstack:take_item()
return itemstack
end
else
minetest.registered_nodes[node.name].on_rightclick(pointed_thing.under, node, placer)
end
end
}) })
minetest.register_node('homedecor:'..m..'_table_large_t', { minetest.register_node('homedecor:'..m..'_table_large_t', {