diff options
Diffstat (limited to 'chainsaw.lua')
-rw-r--r-- | chainsaw.lua | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/chainsaw.lua b/chainsaw.lua index dc1b409..9f69fd9 100644 --- a/chainsaw.lua +++ b/chainsaw.lua @@ -7,19 +7,18 @@ minetest.register_tool("technic:chainsaw", { on_use = function(itemstack, user, pointed_thing) if pointed_thing.type=="node" then item=itemstack:to_table() - local charge=tonumber((item["wear"])) - if charge ==0 then charge =65535 end - charge=get_RE_item_load(charge,mining_drill_max_charge) + if item["metadata"]=="" or item["metadata"]=="0" then return end --tool not charged + charge=tonumber(item["metadata"]) charge_to_take=600; if charge-charge_to_take>0 then charge_to_take=chainsaw_dig_it(minetest.get_pointed_thing_position(pointed_thing, above),user,charge_to_take) charge=charge-charge_to_take; - charge=set_RE_item_load(charge,mining_drill_max_charge) - item["wear"]=tostring(charge) + set_RE_wear(item,charge,chainsaw_max_charge) + item["metadata"]=tostring(charge) itemstack:replace(item) - end return itemstack end + end end, }) |