Fix burst fire weapons being destroyed when out of ammo

I copied the code for normal firing wear, it won't add wear past the maximum now.
This commit is contained in:
Elkien3 2019-03-15 08:35:33 -05:00
parent 754fb12442
commit 45fd1d9c0f

View File

@ -151,7 +151,12 @@ local function burst_fire(stack, player)
end
-- Manually add wear to stack, as functions can't return
-- values from within minetest.after
stack:add_wear(def.unit_wear * burst)
local wear = stack:get_wear()
wear = wear + def.unit_wear*3
if wear > max_wear then
wear = max_wear
end
stack:set_wear(wear)
return stack
end