mirror of
https://git.minetest.land/MineClone2/MineClone2.git
synced 2024-12-11 20:23:15 +01:00
Don't destroy metadata if place item in itemframe
parent
1db851b42b
commit
e0cb50a279
@ -78,9 +78,11 @@ end
|
|||||||
local drop_item = function(pos, node, meta)
|
local drop_item = function(pos, node, meta)
|
||||||
if meta:get_string("item") ~= "" then
|
if meta:get_string("item") ~= "" then
|
||||||
if node.name == "itemframes:frame" and not minetest.setting_getbool("creative_mode") then
|
if node.name == "itemframes:frame" and not minetest.setting_getbool("creative_mode") then
|
||||||
minetest.add_item(pos, meta:get_string("item"))
|
local item = ItemStack(minetest.deserialize(meta:get_string("itemdata")))
|
||||||
|
minetest.add_item(pos, item)
|
||||||
end
|
end
|
||||||
meta:set_string("item","")
|
meta:set_string("item","")
|
||||||
|
meta:set_string("itemdata","")
|
||||||
end
|
end
|
||||||
remove_item(pos, node)
|
remove_item(pos, node)
|
||||||
end
|
end
|
||||||
@ -111,7 +113,11 @@ minetest.register_node("itemframes:frame",{
|
|||||||
local meta = minetest.get_meta(pos)
|
local meta = minetest.get_meta(pos)
|
||||||
if clicker:get_player_name() == meta:get_string("owner") then
|
if clicker:get_player_name() == meta:get_string("owner") then
|
||||||
drop_item(pos, node, meta)
|
drop_item(pos, node, meta)
|
||||||
|
-- item holds the itemstring
|
||||||
meta:set_string("item", itemstack:get_name())
|
meta:set_string("item", itemstack:get_name())
|
||||||
|
local itemdata = minetest.serialize(itemstack:to_table())
|
||||||
|
-- itemdata holds the serialized itemstack in table form
|
||||||
|
meta:set_string("itemdata", itemdata)
|
||||||
update_item(pos,node)
|
update_item(pos,node)
|
||||||
if not minetest.setting_getbool("creative_mode") then
|
if not minetest.setting_getbool("creative_mode") then
|
||||||
itemstack:take_item()
|
itemstack:take_item()
|
||||||
|
Loading…
Reference in New Issue
Block a user