Avoid deprecated item metadata accessors (#630)

This commit is contained in:
Jude Melton-Houghton 2022-12-15 12:43:08 -05:00 committed by GitHub
parent 60240ba268
commit edcdc6817e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 4 deletions

View File

@ -65,8 +65,7 @@ describe("FPGA rotation", function()
end)
end)
-- mineunit does not support deprecated ItemStack:get_metadata()
pending("FPGA programmer", function()
describe("FPGA programmer", function()
local pos2 = {x = 10, y = 0, z = 0}
before_each(function()

View File

@ -23,7 +23,7 @@ minetest.register_tool("mesecons_fpga:programmer", {
minetest.sound_play("mesecons_fpga_fail", { pos = placer:get_pos(), gain = 0.1, max_hear_distance = 4 }, true)
return itemstack
end
itemstack:set_metadata(meta:get_string("instr"))
itemstack:get_meta():set_string("", meta:get_string("instr"))
minetest.chat_send_player(placer:get_player_name(), "FPGA gate configuration was successfully copied!")
minetest.sound_play("mesecons_fpga_copy", { pos = placer:get_pos(), gain = 0.1, max_hear_distance = 4 }, true)
@ -44,7 +44,7 @@ minetest.register_tool("mesecons_fpga:programmer", {
return itemstack
end
local imeta = itemstack:get_metadata()
local imeta = itemstack:get_meta():get_string("")
if imeta == "" then
minetest.chat_send_player(player_name, "Use shift+right-click to copy a gate configuration first.")
minetest.sound_play("mesecons_fpga_fail", { pos = user:get_pos(), gain = 0.1, max_hear_distance = 4 }, true)