From c698e3265b215285d4dd241134fee70762c18b85 Mon Sep 17 00:00:00 2001 From: LoneWolfHT Date: Thu, 9 Jul 2020 17:40:56 -0700 Subject: [PATCH] Fix infinite grapple hook uses --- shooter_hook/init.lua | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/shooter_hook/init.lua b/shooter_hook/init.lua index 28eb31c..3ed2662 100644 --- a/shooter_hook/init.lua +++ b/shooter_hook/init.lua @@ -23,7 +23,12 @@ local function throw_hook(itemstack, user, vel) local yaw = user:get_look_horizontal() if pos and dir and yaw then if not minetest.setting_getbool("creative_mode") then + local before = itemstack:get_wear() itemstack:add_wear(65535 / 100) + + if itemstack:get_wear() < before then + itemstack:set_wear(65535) + end end pos.y = pos.y + 1.5 local obj = minetest.add_entity(pos, "shooter_hook:hook")