Fixed the issue 'Segment Not Found' while resetting data

- Fixed the issue 'Segment Not Found' while resetting data.
This commit is contained in:
Tercio Jose
2023-09-14 11:10:28 -03:00
parent 4d9a0d5a02
commit 443c0af3ab
2 changed files with 15 additions and 4 deletions
+1
View File
@@ -335,6 +335,7 @@
---@field IsLowerInstance fun(instance: instance) : boolean
---@field IsEnabled fun(instance: instance) : boolean
---@field GetId fun(instance: instance) : instanceid
---@field SetSegmentId fun(instance: instance, segment: segmentid) set the segmentId for the instance and nothing else, use 'SetSegment' for a full update
---@field GetSegmentId fun(instance: instance) : segmentid
---@field RefreshCombat fun(instance: instance)
---@field Freeze fun(instance: instance)
+14 -4
View File
@@ -238,10 +238,16 @@ local instanceMixins = {
else
---@type combat
local combatObject = Details:GetCombat(segmentId)
if (combatObject.__destroyed) then
table.remove(Details:GetCombatSegments(), segmentId)
combatObject = combatClass:NovaTabela()
table.insert(Details:GetCombatSegments(), segmentId, combatObject)
if (not combatObject) then
instance:SetSegmentId(DETAILS_SEGMENTID_CURRENT)
instance:RefreshCombat()
return
else
if (combatObject.__destroyed) then
table.remove(Details:GetCombatSegments(), segmentId)
combatObject = combatClass:NovaTabela()
table.insert(Details:GetCombatSegments(), segmentId, combatObject)
end
end
instance.showing = combatObject
end
@@ -403,6 +409,10 @@ local instanceMixins = {
return instance.segmento
end,
SetSegmentId = function(instance, segmentId)
instance.segmento = segmentId
end,
---return the mais attribute id and the sub attribute
---@param instance instance
---@return attributeid