forked from nalc/homedecor_modpack
use modern protection function in tabletop nodes
This commit is contained in:
parent
df34140a1a
commit
fbed3bfab2
@ -51,35 +51,7 @@ for i in ipairs(materials) do
|
||||
type = "fixed",
|
||||
fixed = { -0.5, -0.5, -0.5, 0.5, -0.4375, 0.5 },
|
||||
},
|
||||
|
||||
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
|
||||
on_place = minetest.rotate_node
|
||||
})
|
||||
|
||||
minetest.register_node('homedecor:'..m..'_table_small_square_t', {
|
||||
@ -181,33 +153,7 @@ for i in ipairs(materials) do
|
||||
type = "fixed",
|
||||
fixed = { -0.5, -0.5, -0.5, 0.5, -0.4375, 0.5 },
|
||||
},
|
||||
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_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
|
||||
on_place = minetest.rotate_node
|
||||
})
|
||||
|
||||
minetest.register_node('homedecor:'..m..'_table_small_round_t', {
|
||||
@ -307,34 +253,7 @@ for i in ipairs(materials) do
|
||||
type = "fixed",
|
||||
fixed = { -0.5, -0.5, -0.5, 0.5, -0.4375, 0.5 },
|
||||
},
|
||||
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_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
|
||||
on_place = minetest.rotate_node
|
||||
})
|
||||
|
||||
minetest.register_node('homedecor:'..m..'_table_large_t', {
|
||||
|
Loading…
Reference in New Issue
Block a user