mirror of
https://github.com/mt-mods/homedecor_modpack.git
synced 2024-11-15 23:00:35 +01:00
Fixed tables' on_place functions to properly check for on_rightclick
on whatever you try to place on, so that the on_rightclick is executed instead of the table being placed (e.g. it was interfering with doors).
This commit is contained in:
parent
e5c99a3144
commit
c2aa7582fd
28
tables.lua
28
tables.lua
|
@ -61,10 +61,14 @@ for i in ipairs(materials) do
|
||||||
|
|
||||||
on_place = function(itemstack, placer, pointed_thing)
|
on_place = function(itemstack, placer, pointed_thing)
|
||||||
|
|
||||||
local pitch = placer:get_look_pitch()
|
local node = minetest.env: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 above = pointed_thing.above
|
||||||
local under = pointed_thing.under
|
local under = pointed_thing.under
|
||||||
|
local pitch = placer:get_look_pitch()
|
||||||
local node = minetest.env:get_node(above)
|
local node = minetest.env:get_node(above)
|
||||||
|
|
||||||
if node.name ~= "air" then return end
|
if node.name ~= "air" then return end
|
||||||
|
|
||||||
if above.x ~= under.x or above.z ~= under.z then
|
if above.x ~= under.x or above.z ~= under.z then
|
||||||
|
@ -79,6 +83,9 @@ for i in ipairs(materials) do
|
||||||
itemstack:take_item()
|
itemstack:take_item()
|
||||||
end
|
end
|
||||||
return minetest.item_place_node(itemstack, placer, pointed_thing)
|
return minetest.item_place_node(itemstack, placer, pointed_thing)
|
||||||
|
else
|
||||||
|
minetest.registered_nodes[node.name].on_rightclick(pointed_thing.under, node, placer)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -182,12 +189,14 @@ for i in ipairs(materials) do
|
||||||
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 = function(itemstack, placer, pointed_thing)
|
||||||
|
local node = minetest.env:get_node(pointed_thing.under)
|
||||||
|
if not minetest.registered_nodes[node.name] or not minetest.registered_nodes[node.name].on_rightclick then
|
||||||
|
|
||||||
local pitch = placer:get_look_pitch()
|
|
||||||
local above = pointed_thing.above
|
local above = pointed_thing.above
|
||||||
local under = pointed_thing.under
|
local under = pointed_thing.under
|
||||||
|
local pitch = placer:get_look_pitch()
|
||||||
local node = minetest.env:get_node(above)
|
local node = minetest.env:get_node(above)
|
||||||
|
|
||||||
if node.name ~= "air" then return end
|
if node.name ~= "air" then return end
|
||||||
|
|
||||||
if above.x ~= under.x or above.z ~= under.z then
|
if above.x ~= under.x or above.z ~= under.z then
|
||||||
|
@ -202,6 +211,9 @@ for i in ipairs(materials) do
|
||||||
itemstack:take_item()
|
itemstack:take_item()
|
||||||
end
|
end
|
||||||
return minetest.item_place_node(itemstack, placer, pointed_thing)
|
return minetest.item_place_node(itemstack, placer, pointed_thing)
|
||||||
|
else
|
||||||
|
minetest.registered_nodes[node.name].on_rightclick(pointed_thing.under, node, placer)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -304,11 +316,14 @@ for i in ipairs(materials) do
|
||||||
},
|
},
|
||||||
on_place = function(itemstack, placer, pointed_thing)
|
on_place = function(itemstack, placer, pointed_thing)
|
||||||
|
|
||||||
local pitch = placer:get_look_pitch()
|
local node = minetest.env: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 above = pointed_thing.above
|
||||||
local under = pointed_thing.under
|
local under = pointed_thing.under
|
||||||
|
local pitch = placer:get_look_pitch()
|
||||||
local node = minetest.env:get_node(above)
|
local node = minetest.env:get_node(above)
|
||||||
|
|
||||||
if node.name ~= "air" then return end
|
if node.name ~= "air" then return end
|
||||||
|
|
||||||
if above.x ~= under.x or above.z ~= under.z then
|
if above.x ~= under.x or above.z ~= under.z then
|
||||||
|
@ -323,6 +338,9 @@ for i in ipairs(materials) do
|
||||||
itemstack:take_item()
|
itemstack:take_item()
|
||||||
end
|
end
|
||||||
return minetest.item_place_node(itemstack, placer, pointed_thing)
|
return minetest.item_place_node(itemstack, placer, pointed_thing)
|
||||||
|
else
|
||||||
|
minetest.registered_nodes[node.name].on_rightclick(pointed_thing.under, node, placer)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user