Time Nick Message 20:15 Adamsky Hi. I'm new to modding and I'm trying to add a sword that breaks after not that many uses. Inside of tool_capabilities, I'm setting punch_attack_uses = 3 but not matter what value I set it to, it doesn't seem to affect the durabilitity of the sword. Also, under groupcaps, I'm setting snappy uses to 3 which does affect its durability when breaking things, but not attacking. Is there something I'm missing? 20:29 Krock Adamsky: https://github.com/minetest/minetest_game/blob/master/mods/default/tools.lua#L381 20:29 Krock the "uses" param defines how often it can be used 20:31 Krock see lua_api.md for documentation 20:33 Adamsky That's what I'm doing. It works when breaking things, like leaves, but it doesn't change how many times I can hit things until it breaks, and punch_attack_uses has no effect (that I can discern). 20:34 Mantar lua_api, under Tool capabilities definition, says: * Punch attack uses (until the tool breaks) 20:34 Mantar so if it's not working that's either a bug in MT or a bug in lua_apil.md 21:17 frostsnow Adamsky: As I recall, 'punch_attack_uses' is a newer attribute, and previously mods added wear themselves by overridding on_...hit(), I think. So the entity you're hitting would need to be refactored to make use of the new attribute. 21:20 frostsnow Ah, 'on_punch()' is what the LUA entities use 21:31 Adamsky As a workaround, should I, say, override on_use to have it add wear there? 21:35 frostsnow I don't think I've tried that, and I'm not sure how it'd apply to tools. I think the mod will set the wear on the item directly so you'd have to somehow detect that and then change it. And beware the tool will insta-break when it hits max wear. 21:56 cheapie Hmm, some change semi-recently seems to have made entity movement with the player attached work a lot better on slow processors. Not sure what the change was, but it's nice to see anyway. 22:14 Adamsky The Creatura mob API seems to add wear to whatever item hit a creature. Is there a way to avoid this so I can control how quickly my weapons wear? 22:42 Adamsky If I'm overriding the on_use function for a tool, how do I call the original on_use before writing my code (i.e. I want a sword to act like a sword normally, but then have something else happen after I attack something with it). 22:43 cheapie You should be able to grab the original on_use out of minetest.registered_ before you override it, then store it somewhere. 22:54 Adamsky That doesn't seem to work, since the original on_use is nil. I need to get the original function that would run instead if on_use is nil.