diff options
author | Maciej Kasatkin <mk@realbadangel.pl> | 2012-10-28 20:03:36 +0100 |
---|---|---|
committer | Maciej Kasatkin <mk@realbadangel.pl> | 2012-10-28 20:03:36 +0100 |
commit | 01b21d49af04f9b3251c5edfb759995dc45d5110 (patch) | |
tree | b40c70f82f929b8b1eb0cbb8d79dab4332542291 /chainsaw.lua | |
parent | 9d2979f365aad6963e814fa78b6f37d51d00043c (diff) |
update
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, }) |