mirror of
https://github.com/minetest-mods/3d_armor.git
synced 2024-11-26 06:13:45 +01:00
Fix count when armor is destroyed.
This commit is contained in:
parent
c3a755518e
commit
a6b89e7929
@ -316,6 +316,8 @@ armor.punch = function(self, player, hitter, time_from_last_punch, tool_capabili
|
||||
if not name then
|
||||
return
|
||||
end
|
||||
local set_state
|
||||
local set_count
|
||||
local state = 0
|
||||
local count = 0
|
||||
local recip = true
|
||||
@ -376,11 +378,17 @@ armor.punch = function(self, player, hitter, time_from_last_punch, tool_capabili
|
||||
end
|
||||
if damage == true then
|
||||
self:damage(player, i, stack, use)
|
||||
set_state = self.def[name].state
|
||||
set_count = self.def[name].count
|
||||
end
|
||||
state = state + stack:get_wear()
|
||||
count = count + 1
|
||||
end
|
||||
end
|
||||
if set_count and set_count ~= count then
|
||||
state = set_state or state
|
||||
count = set_count or count
|
||||
end
|
||||
self.def[name].state = state
|
||||
self.def[name].count = count
|
||||
end
|
||||
|
Loading…
Reference in New Issue
Block a user