forked from minetest/minetest_game
Replace deprecated get_metadata()
calls (#3142)
This commit is contained in:
parent
9cb57ae5f2
commit
88ecab34d9
|
@ -163,12 +163,12 @@ function default.chest.register_chest(prefixed_name, d)
|
||||||
local itemstack = player:get_wielded_item()
|
local itemstack = player:get_wielded_item()
|
||||||
local key_meta = itemstack:get_meta()
|
local key_meta = itemstack:get_meta()
|
||||||
|
|
||||||
if itemstack:get_metadata() == "" then
|
if itemstack:get_meta():get_string("") == "" then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
if key_meta:get_string("secret") == "" then
|
if key_meta:get_string("secret") == "" then
|
||||||
key_meta:set_string("secret", minetest.parse_json(itemstack:get_metadata()).secret)
|
key_meta:set_string("secret", minetest.parse_json(itemstack:get_meta():get_string("")).secret)
|
||||||
itemstack:set_metadata("")
|
itemstack:set_metadata("")
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -57,7 +57,7 @@ local function book_on_use(itemstack, user)
|
||||||
local page, page_max, lines, string = 1, 1, {}, ""
|
local page, page_max, lines, string = 1, 1, {}, ""
|
||||||
|
|
||||||
-- Backwards compatibility
|
-- Backwards compatibility
|
||||||
local old_data = minetest.deserialize(itemstack:get_metadata())
|
local old_data = minetest.deserialize(itemstack:get_meta():get_string(""))
|
||||||
if old_data then
|
if old_data then
|
||||||
meta:from_table({ fields = old_data })
|
meta:from_table({ fields = old_data })
|
||||||
end
|
end
|
||||||
|
|
|
@ -803,7 +803,7 @@ function default.can_interact_with_node(player, pos)
|
||||||
local key_meta = item:get_meta()
|
local key_meta = item:get_meta()
|
||||||
|
|
||||||
if key_meta:get_string("secret") == "" then
|
if key_meta:get_string("secret") == "" then
|
||||||
local key_oldmeta = item:get_metadata()
|
local key_oldmeta = item:get_meta():get_string("")
|
||||||
if key_oldmeta == "" or not minetest.parse_json(key_oldmeta) then
|
if key_oldmeta == "" or not minetest.parse_json(key_oldmeta) then
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue
Block a user