Fix rotate_node to return the correct itemstack.

All on_* hooks that return an itemstack are NOT guaranteed to
modify and return the original stack.  We cannot count on the
behavior of the existing builtin definitions not to be overridden
by game/mod logic.
This commit is contained in:
Aaron Suen 2019-10-13 09:32:39 -04:00 committed by Nils Dagsson Moskopp
parent 1e37f540e5
commit 0010957299
Signed by: erle
GPG Key ID: A3BC671C35191080
1 changed files with 1 additions and 2 deletions

View File

@ -428,10 +428,9 @@ if INIT == "game" then
core.rotate_node = function(itemstack, placer, pointed_thing) core.rotate_node = function(itemstack, placer, pointed_thing)
local name = placer and placer:get_player_name() or "" local name = placer and placer:get_player_name() or ""
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, return core.rotate_and_place(itemstack, placer, pointed_thing,
is_creative(name), is_creative(name),
{invert_wall = invert_wall}, true) {invert_wall = invert_wall}, true)
return itemstack
end end
end end