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:
parent
754fb12442
commit
45fd1d9c0f
7
api.lua
7
api.lua
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user