summaryrefslogtreecommitdiff
path: root/builtin
diff options
context:
space:
mode:
authorBluebird <bluebird.greycoat@gmail.com>2019-12-18 12:21:24 -0600
committersfan5 <sfan5@live.de>2019-12-18 19:21:24 +0100
commit80af58c8c5a68fc7ff66a730204ffa933e89a305 (patch)
treea1ce729c9a94e2340570a3c010b43f91b5082079 /builtin
parent39a1e6660ecfa5a102b00ca305ebf929821f7214 (diff)
downloadminetest-80af58c8c5a68fc7ff66a730204ffa933e89a305.tar.gz
minetest-80af58c8c5a68fc7ff66a730204ffa933e89a305.tar.bz2
minetest-80af58c8c5a68fc7ff66a730204ffa933e89a305.zip
Make core.item_place_node return position of placed node. (#7713)
Diffstat (limited to 'builtin')
-rw-r--r--builtin/game/item.lua16
1 files changed, 8 insertions, 8 deletions
diff --git a/builtin/game/item.lua b/builtin/game/item.lua
index 00c1912fc..ef47cd66d 100644
--- a/builtin/game/item.lua
+++ b/builtin/game/item.lua
@@ -259,7 +259,7 @@ function core.item_place_node(itemstack, placer, pointed_thing, param2,
prevent_after_place)
local def = itemstack:get_definition()
if def.type ~= "node" or pointed_thing.type ~= "node" then
- return itemstack, false
+ return itemstack, nil
end
local under = pointed_thing.under
@@ -272,7 +272,7 @@ function core.item_place_node(itemstack, placer, pointed_thing, param2,
if not oldnode_under or not oldnode_above then
log("info", playername .. " tried to place"
.. " node in unloaded position " .. core.pos_to_string(above))
- return itemstack, false
+ return itemstack, nil
end
local olddef_under = core.registered_nodes[oldnode_under.name]
@@ -284,7 +284,7 @@ function core.item_place_node(itemstack, placer, pointed_thing, param2,
log("info", playername .. " tried to place"
.. " node in invalid position " .. core.pos_to_string(above)
.. ", replacing " .. oldnode_above.name)
- return itemstack, false
+ return itemstack, nil
end
-- Place above pointed node
@@ -302,7 +302,7 @@ function core.item_place_node(itemstack, placer, pointed_thing, param2,
.. " at protected position "
.. core.pos_to_string(place_to))
core.record_protection_violation(place_to, playername)
- return itemstack
+ return itemstack, nil
end
log("action", playername .. " places node "
@@ -361,7 +361,7 @@ function core.item_place_node(itemstack, placer, pointed_thing, param2,
not builtin_shared.check_attached_node(place_to, newnode) then
log("action", "attached node " .. def.name ..
" can not be placed at " .. core.pos_to_string(place_to))
- return itemstack, false
+ return itemstack, nil
end
-- Add node and update
@@ -395,7 +395,7 @@ function core.item_place_node(itemstack, placer, pointed_thing, param2,
if take_item then
itemstack:take_item()
end
- return itemstack, true
+ return itemstack, place_to
end
-- deprecated, item_place does not call this
@@ -416,7 +416,7 @@ function core.item_place(itemstack, placer, pointed_thing, param2)
local nn = n.name
if core.registered_nodes[nn] and core.registered_nodes[nn].on_rightclick then
return core.registered_nodes[nn].on_rightclick(pointed_thing.under, n,
- placer, itemstack, pointed_thing) or itemstack, false
+ placer, itemstack, pointed_thing) or itemstack, nil
end
end
@@ -424,7 +424,7 @@ function core.item_place(itemstack, placer, pointed_thing, param2)
if itemstack:get_definition().type == "node" then
return core.item_place_node(itemstack, placer, pointed_thing, param2)
end
- return itemstack
+ return itemstack, nil
end
function core.item_secondary_use(itemstack, placer)