Fix infinite grapple hook uses

This commit is contained in:
LoneWolfHT 2020-07-09 17:40:56 -07:00
parent d7f6dc7c06
commit c698e3265b

View file

@ -23,7 +23,12 @@ local function throw_hook(itemstack, user, vel)
local yaw = user:get_look_horizontal() local yaw = user:get_look_horizontal()
if pos and dir and yaw then if pos and dir and yaw then
if not minetest.setting_getbool("creative_mode") then if not minetest.setting_getbool("creative_mode") then
local before = itemstack:get_wear()
itemstack:add_wear(65535 / 100) itemstack:add_wear(65535 / 100)
if itemstack:get_wear() < before then
itemstack:set_wear(65535)
end
end end
pos.y = pos.y + 1.5 pos.y = pos.y + 1.5
local obj = minetest.add_entity(pos, "shooter_hook:hook") local obj = minetest.add_entity(pos, "shooter_hook:hook")