Cristiano Magro
2024-08-27 c1b07c858705ecff5d33abe99a17577fc609cbf3
fix deprecated

minetest 5.9
1 files modified
20 ■■■■■ changed files
technic/tools/xno_pick.lua 20 ●●●●● patch | view | raw | blame | history
technic/tools/xno_pick.lua
@@ -125,18 +125,20 @@
    end
    --check tool charge
    local meta = minetest.deserialize(itemstack:get_metadata())
    if not meta or not meta.charge or
      meta.charge < xnopick_charge_per_node
    local meta = technic.get_stack_meta(itemstack)
    local charge = meta:get_int("technic:charge")
    if not meta or not charge or
      charge < xnopick_charge_per_node
    then
      minetest.sound_play("technic_prospector_miss", {pos = pos, gain = 1.0, max_hear_distance = 10})
      return
    end
    --check node protection
    if minetest.is_protected(pos, user:get_player_name()) then
      minetest.record_protection_violation(pos, user:get_player_name())
    local name = user:get_player_name()
    if minetest.is_protected(pos, name) then
      minetest.record_protection_violation(pos, name)
      return
    end
@@ -151,12 +153,12 @@
    -- Send current charge to digging function so that the
    -- chainsaw will stop after digging a number of nodes
    meta.charge = collect_block_node(user, pos, meta.charge)
    charge = collect_block_node(user, pos, charge)
    minetest.sound_play("technic_laser_mk3", {pos = pos, gain = 1.0, max_hear_distance = 10})
    
    if not technic.creative_mode then
      technic.set_RE_wear(itemstack, meta.charge, xnopick_max_charge)
      itemstack:set_metadata(minetest.serialize(meta))
      technic.set_RE_wear(itemstack, charge, xnopick_max_charge)
      meta:set_int("technic:charge", charge)
    end
    return itemstack