mirror of
https://github.com/minetest-mods/3d_armor.git
synced 2024-11-26 14:23: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
|
if not name then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
local set_state
|
||||||
|
local set_count
|
||||||
local state = 0
|
local state = 0
|
||||||
local count = 0
|
local count = 0
|
||||||
local recip = true
|
local recip = true
|
||||||
@ -376,11 +378,17 @@ armor.punch = function(self, player, hitter, time_from_last_punch, tool_capabili
|
|||||||
end
|
end
|
||||||
if damage == true then
|
if damage == true then
|
||||||
self:damage(player, i, stack, use)
|
self:damage(player, i, stack, use)
|
||||||
|
set_state = self.def[name].state
|
||||||
|
set_count = self.def[name].count
|
||||||
end
|
end
|
||||||
state = state + stack:get_wear()
|
state = state + stack:get_wear()
|
||||||
count = count + 1
|
count = count + 1
|
||||||
end
|
end
|
||||||
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].state = state
|
||||||
self.def[name].count = count
|
self.def[name].count = count
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user