Tool wear not working

User avatar
stu
Member
 
Posts: 737
Joined: Sat Feb 02, 2013 02:51
GitHub: stujones11

Tool wear not working

by stu » Fri Mar 13, 2015 20:35

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 :/
 

User avatar
Krock
Member
 
Posts: 3598
Joined: Thu Oct 03, 2013 07:48
GitHub: SmallJoker

Re: Tool wear not working

by Krock » Fri Mar 13, 2015 20:39

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
Newest Win32 builds - Find a mod - All my mods
ALL YOUR DONATION ARE BELONG TO PARAMAT (Please support him and Minetest)
New DuckDuckGo !bang: !mtmod <keyword here>
 

poet.nohit
Member
 
Posts: 55
Joined: Fri Mar 06, 2015 00:50
GitHub: poet-nohit

Re: Tool wear not working

by poet.nohit » Fri Mar 13, 2015 20:59

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
 

User avatar
stu
Member
 
Posts: 737
Joined: Sat Feb 02, 2013 02:51
GitHub: stujones11

Re: Tool wear not working

by stu » Fri Mar 13, 2015 21:02

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 ;-)
 


Return to Minetest Problems

Who is online

Users browsing this forum: No registered users and 38 guests

cron