core.rotate_node: Do not trigger after_place_node (#6900)
This commit is contained in:
parent
a85399a9d6
commit
f2628f1eb4
|
@ -341,7 +341,7 @@ if INIT == "game" then
|
||||||
local dirs2 = {20, 23, 22, 21}
|
local dirs2 = {20, 23, 22, 21}
|
||||||
|
|
||||||
function core.rotate_and_place(itemstack, placer, pointed_thing,
|
function core.rotate_and_place(itemstack, placer, pointed_thing,
|
||||||
infinitestacks, orient_flags)
|
infinitestacks, orient_flags, prevent_after_place)
|
||||||
orient_flags = orient_flags or {}
|
orient_flags = orient_flags or {}
|
||||||
|
|
||||||
local unode = core.get_node_or_nil(pointed_thing.under)
|
local unode = core.get_node_or_nil(pointed_thing.under)
|
||||||
|
@ -394,7 +394,7 @@ if INIT == "game" then
|
||||||
|
|
||||||
local old_itemstack = ItemStack(itemstack)
|
local old_itemstack = ItemStack(itemstack)
|
||||||
local new_itemstack, removed = core.item_place_node(
|
local new_itemstack, removed = core.item_place_node(
|
||||||
itemstack, placer, pointed_thing, param2
|
itemstack, placer, pointed_thing, param2, prevent_after_place
|
||||||
)
|
)
|
||||||
return infinitestacks and old_itemstack or new_itemstack
|
return infinitestacks and old_itemstack or new_itemstack
|
||||||
end
|
end
|
||||||
|
@ -415,7 +415,7 @@ if INIT == "game" then
|
||||||
local invert_wall = placer and placer:get_player_control().sneak or false
|
local invert_wall = placer and placer:get_player_control().sneak or false
|
||||||
core.rotate_and_place(itemstack, placer, pointed_thing,
|
core.rotate_and_place(itemstack, placer, pointed_thing,
|
||||||
is_creative(name),
|
is_creative(name),
|
||||||
{invert_wall = invert_wall})
|
{invert_wall = invert_wall}, true)
|
||||||
return itemstack
|
return itemstack
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -261,7 +261,8 @@ local function make_log(name)
|
||||||
return name ~= "" and core.log or function() end
|
return name ~= "" and core.log or function() end
|
||||||
end
|
end
|
||||||
|
|
||||||
function core.item_place_node(itemstack, placer, pointed_thing, param2)
|
function core.item_place_node(itemstack, placer, pointed_thing, param2,
|
||||||
|
prevent_after_place)
|
||||||
local def = itemstack:get_definition()
|
local def = itemstack:get_definition()
|
||||||
if def.type ~= "node" or pointed_thing.type ~= "node" then
|
if def.type ~= "node" or pointed_thing.type ~= "node" then
|
||||||
return itemstack, false
|
return itemstack, false
|
||||||
|
@ -375,7 +376,7 @@ function core.item_place_node(itemstack, placer, pointed_thing, param2)
|
||||||
local take_item = true
|
local take_item = true
|
||||||
|
|
||||||
-- Run callback
|
-- Run callback
|
||||||
if def.after_place_node then
|
if def.after_place_node and not prevent_after_place then
|
||||||
-- Deepcopy place_to and pointed_thing because callback can modify it
|
-- Deepcopy place_to and pointed_thing because callback can modify it
|
||||||
local place_to_copy = {x=place_to.x, y=place_to.y, z=place_to.z}
|
local place_to_copy = {x=place_to.x, y=place_to.y, z=place_to.z}
|
||||||
local pointed_thing_copy = copy_pointed_thing(pointed_thing)
|
local pointed_thing_copy = copy_pointed_thing(pointed_thing)
|
||||||
|
|
Loading…
Reference in New Issue