Skip to content

Commit 8d27184

Browse files
authored
Merge pull request #251 from cortex-command-community/neutral-capturable-fix
Fix wrong initialization of capture progress for neutral GenericCapturables
2 parents 6fb9aa0 + b12fb31 commit 8d27184

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

Data/Base.rte/Scenes/Objects/Bunkers/BunkerSystems/GenericCapturable/GenericCapturable.lua

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,18 @@ function Create(self)
4646
end
4747
end
4848

49-
self.captureProgress = self:NumberValueExists("captureProgress") and self:GetNumberValue("captureProgress") or 1;
49+
-- If we have a saved value, use that.
50+
if self:NumberValueExists("captureProgress") then
51+
self.captureProgress = self:GetNumberValue("captureProgress")
52+
else
53+
-- Otherwise, initialize properly according to whether we are captured by a real team or not by default.
54+
if self.Team == -1 then
55+
self.captureProgress = 0.0;
56+
else
57+
self.captureProgress = 1.0;
58+
end
59+
end
60+
5061
self.capturingTeam = self:NumberValueExists("capturingTeam") and self:GetNumberValue("capturingTeam") or self.Team;
5162
self.dominantTeam = self:NumberValueExists("dominantTeam") and self:GetNumberValue("dominantTeam") or self.Team;
5263

0 commit comments

Comments
 (0)