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
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]
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
.. " 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 "
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
if take_item then
itemstack:take_item()
end
- return itemstack, true
+ return itemstack, place_to
end
-- deprecated, item_place does not call this
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
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)
* `param2` overrides `facedir` and wallmounted `param2`
* `prevent_after_place`: if set to `true`, `after_place_node` is not called
for the newly placed node to prevent a callback and placement loop
- * returns `itemstack, success`
+ * returns `itemstack, position`
+ * `position`: the location the node was placed to. `nil` if nothing was placed.
* `minetest.item_place_object(itemstack, placer, pointed_thing)`
* Place item as-is
* returns the leftover itemstack
* Calls `on_rightclick` of `pointed_thing.under` if defined instead
* **Note**: is not called when wielded item overrides `on_place`
* `param2` overrides facedir and wallmounted `param2`
- * returns `itemstack, success`
+ * returns `itemstack, position`
+ * `position`: the location the node was placed to. `nil` if nothing was placed.
* `minetest.item_drop(itemstack, dropper, pos)`
* Drop the item
* returns the leftover itemstack