Hopefully fix double-rightclick making items disappear

This commit is contained in:
Ekdohibs 2018-03-04 18:40:07 +01:00
parent c78f2e5a8c
commit 6c68227b22

View File

@ -104,6 +104,9 @@ local on_place_breakable = function(itemstack, placer, pointed_thing)
elseif boxes.players_in_boxes[name] then
-- check meta if we can place here
local meta = minetest.get_meta(pos)
if meta:get_string("placed") ~= "" then
return itemstack
end
local placeable = meta:get_string("placeable")
if placeable == "" then
return itemstack
@ -131,6 +134,8 @@ local on_place_breakable = function(itemstack, placer, pointed_thing)
-- preserve metadata
meta = minetest.get_meta(pos)
meta:set_string("placeable", placeable)
-- but set placed to true to avoid fast-rightclick bug
meta:set_string("placed", "true")
return itemstack
else
minetest.log("info", name .. " attempted to place a " .. place .. " outside a box")