summaryrefslogtreecommitdiff
path: root/screwdriver.lua
diff options
context:
space:
mode:
authorMaciej Kasatkin <mk@realbadangel.pl>2012-09-12 01:29:42 +0200
committerMaciej Kasatkin <mk@realbadangel.pl>2012-09-12 01:29:42 +0200
commitd041c13ad822e30f7f9b9ed0624511968ce47e04 (patch)
tree585b53c92d23b30b18d437a57f62c615e761b986 /screwdriver.lua
parent0e58a6f0149e42ba5fc797ad5b85b2874e21541f (diff)
Screwdriver fix
Diffstat (limited to 'screwdriver.lua')
-rw-r--r--screwdriver.lua14
1 files changed, 8 insertions, 6 deletions
diff --git a/screwdriver.lua b/screwdriver.lua
index c8aaa7b..aebef80 100644
--- a/screwdriver.lua
+++ b/screwdriver.lua
@@ -21,12 +21,14 @@
minetest.env:set_node(pos,node)
meta = minetest.env:get_meta(pos)
meta:from_table(meta0)
- -- appropriatly set the wear of the screwdriver
- -- m = itemstack:get_wear()
- -- if m == 0 then m = 65535 end
- -- m = m-6554
- -- return {wear=m}
- end,
+ local item=itemstack:to_table()
+ local item_wear=tonumber((item["wear"]))
+ item_wear=item_wear+819
+ if item_wear>65535 then itemstack:clear() return itemstack end
+ item["wear"]=tostring(item_wear)
+ itemstack:replace(item)
+ return itemstack
+ end,
})
minetest.register_craft({