Page 1 of 1

Tool wear not working

PostPosted: Fri Mar 13, 2015 20:35
by stu
Something seems to broken with the tool wear.
In version 0.4.9 the following code behaves as expected, you use the stick 30 or so times and it wears out and disappears. This is not the case with the current dev version and has broken at least one of my mods.

Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
Code: Select all
minetest.register_tool("testtool:stick", {
   description = "Test Stick",
   inventory_image = "default_stick.png",
   on_use = function(itemstack, user, pointed_thing)
      itemstack:add_wear(2000)
      return itemstack
   end,
})


Another thing I noticed when testing under 0.4.9 was just how much better it performs on my hardware...
Well I guess that's progress for ya :/

Re: Tool wear not working

PostPosted: Fri Mar 13, 2015 20:39
by Krock
What's exactly happening on 0.4.12 with those codes?
Does it take damage?

I have a chainsaw and it works as expected: https://github.com/SmallJoker/special/b ... aw.lua#L18

Re: Tool wear not working

PostPosted: Fri Mar 13, 2015 20:59
by poet.nohit
Might be related to the Food/Bucket glitch we've had since March 4th.

viewtopic.php?f=6&t=11418
https://github.com/minetest/minetest/issues/2449

Re: Tool wear not working

PostPosted: Fri Mar 13, 2015 21:02
by stu
Krock wrote:What's exactly happening on 0.4.12 with those codes?
Does it take damage?

I have a chainsaw and it works as expected: https://github.com/SmallJoker/special/b ... aw.lua#L18

What happens for me, is that the item does not visibly take wear until I log out and back in again. The problem manifests itself slightly differently in my shooter mod and was recently reported by another user. I tested and confirmed this, once again the same mod works fine under 0.4.9.

I guess the only other explanation would be a problem with my installation of current-dev (compiled about 1hr ago) and the previous one about 1-2 weeks old.

Could someone please test the snippet I posted above? Simply save it as init.lua in a mod directory named 'testtool' then grab it from the creative inventory and use it ;-)