@@ -153,6 +153,8 @@ function DecisionDay:StartActivity(isNewGame)
153153 bunkerRegionRecaptureWeights [" Main Bunker Air Traffic Control" ] = 8 ;
154154
155155 self .bunkerRegions = {};
156+ self .captureDisplayScreenTemplate = CreateMOSParticle (" Login Screen" , " Missions.rte" );
157+ self .fauxdanDisplayScreenTemplate = CreateMOSParticle (" Fauxdan Screen" , " Missions.rte" );
156158 for _ , bunkerRegionName in ipairs (bunkerRegionNames ) do
157159 self .bunkerRegions [bunkerRegionName ] = {
158160 enabled = false ,
@@ -161,6 +163,7 @@ function DecisionDay:StartActivity(isNewGame)
161163 totalArea = scene :GetArea (bunkerRegionName ),
162164 captureArea = scene :GetArea (bunkerRegionName .. " Capture" ),
163165 captureDisplayArea = scene :GetArea (bunkerRegionName .. " Capture Display" ),
166+ captureDisplayScreens = {},
164167 internalReinforcementsArea = scene :HasArea (bunkerRegionName .. " Internal Reinforcements" ) and scene :GetOptionalArea (bunkerRegionName .. " Internal Reinforcements" ) or nil ,
165168 defenderArea = scene :GetArea (bunkerRegionName .. " Defenders" ),
166169 ownerTeam = self .aiTeam ,
@@ -171,17 +174,14 @@ function DecisionDay:StartActivity(isNewGame)
171174 aiRegionAttackTimer = Timer (90000 / self .difficultyRatio ),
172175 aiRecaptureWeight = bunkerRegionRecaptureWeights [bunkerRegionName ] or 0 ,
173176 fauxdanDisplayArea = scene :HasArea (bunkerRegionName .. " Fauxdan Display" ) and scene :GetOptionalArea (bunkerRegionName .. " Fauxdan Display" ) or nil ,
177+ fauxdanDisplayScreens = {},
174178 shieldedArea = scene :HasArea (bunkerRegionName .. " Shield" ) and scene :GetOptionalArea (bunkerRegionName .. " Shield" ) or nil ,
175179 brainDoor = scene :HasArea (bunkerRegionName .. " Brain Door" ) and scene :GetOptionalArea (bunkerRegionName .. " Brain Door" ) or nil ,
176180 brain = scene :HasArea (bunkerRegionName .. " Shield" ) and scene :GetOptionalArea (bunkerRegionName .. " Brain" ) or nil ,
177181 };
178182 if bunkerRegionName :find (" Vault" ) then
179183 self .bunkerRegions [bunkerRegionName ].incomeMultiplier = bunkerRegionName :find (" Large" ) and 2 or (bunkerRegionName :find (" Medium" ) and 1.5 or 1 );
180184 end
181- if self .bunkerRegions [bunkerRegionName ].fauxdanDisplayArea ~= nil then
182- self .bunkerRegions [bunkerRegionName ].fauxdanDisplayTimer = Timer (250 );
183- self .bunkerRegions [bunkerRegionName ].fauxdanDisplayCurrentFrame = 0 ;
184- end
185185 end
186186
187187 self .controlledBunkerRegionComputerTerrainObjects = {
@@ -879,7 +879,6 @@ function DecisionDay:UpdateCamera()
879879 end
880880 end
881881
882- -- TODO maybe use the camera scroll sounds that come with the game!
883882 if scrollTargetAndSpeed then
884883 for _ , player in pairs (self .humanPlayers ) do
885884 CameraMan :SetScrollTarget (scrollTargetAndSpeed [1 ], scrollTargetAndSpeed [2 ], false , player );
@@ -1079,46 +1078,60 @@ function DecisionDay:UpdateObjectiveArrowsAndRegionVisuals()
10791078
10801079 for bunkerRegionName , bunkerRegionData in pairs (self .bunkerRegions ) do
10811080 if bunkerRegionData .enabled then
1082- if bunkerRegionData .fauxdanDisplayTimer ~= nil and bunkerRegionData .ownerTeam == self .aiTeam and bunkerRegionData .fauxdanDisplayTimer :IsPastSimTimeLimit () then
1083- local numberOfFauxdanDisplayFrames = 20 ;
1084- bunkerRegionData .fauxdanDisplayCurrentFrame = (bunkerRegionData .fauxdanDisplayCurrentFrame + 1 ) % (numberOfFauxdanDisplayFrames + 1 );
1085- bunkerRegionData .fauxdanDisplayTimer :Reset ();
1086- end
1087-
10881081 local currentFauxdanDisplayFrameString ;
10891082 local currentLoginScreenFrameString ;
10901083 for _ , player in pairs (self .humanPlayers ) do
10911084 if math.abs ((bunkerRegionData .totalArea .Center - CameraMan :GetScrollTarget (player )).X ) < FrameMan .PlayerScreenWidth * 0.75 then
10921085 if bunkerRegionData .fauxdanDisplayArea ~= nil and bunkerRegionData .ownerTeam == self .aiTeam and self .currentStage == self .stages .attackBrain then
1093- if currentFauxdanDisplayFrameString == nil then
1094- currentFauxdanDisplayFrameString = " 00" .. tostring (bunkerRegionData .fauxdanDisplayCurrentFrame );
1095- if currentFauxdanDisplayFrameString :len () > 3 then
1096- currentFauxdanDisplayFrameString = string.sub (currentFauxdanDisplayFrameString , currentFauxdanDisplayFrameString :len () - 2 );
1086+ for box in bunkerRegionData .fauxdanDisplayArea .Boxes do
1087+ local boxCenterPos = box .Center ;
1088+ local fauxdanDisplayScreenKey = tostring (boxCenterPos .FlooredX ) .. " ," .. tostring (boxCenterPos .FlooredY );
1089+
1090+ local boxBlockedByCaptureDisplay = false ;
1091+ if bunkerRegionData .captureCount > 0 then
1092+ for captureDisplayBox in bunkerRegionData .captureDisplayArea .Boxes do
1093+ if captureDisplayBox .Center .Floored == boxCenterPos .Floored then
1094+ boxBlockedByCaptureDisplay = true ;
1095+ break ;
1096+ end
1097+ end
1098+ end
1099+
1100+ if not boxBlockedByCaptureDisplay and bunkerRegionData .fauxdanDisplayScreens [fauxdanDisplayScreenKey ] == nil then
1101+ local fauxdanDisplayScreen = self .fauxdanDisplayScreenTemplate :Clone ();
1102+ fauxdanDisplayScreen .Pos = boxCenterPos ;
1103+ MovableMan :AddParticle (fauxdanDisplayScreen );
1104+ bunkerRegionData .fauxdanDisplayScreens [fauxdanDisplayScreenKey ] = fauxdanDisplayScreen ;
1105+ elseif boxBlockedByCaptureDisplay and bunkerRegionData .fauxdanDisplayScreens [fauxdanDisplayScreenKey ] ~= nil then
1106+ bunkerRegionData .fauxdanDisplayScreens [fauxdanDisplayScreenKey ].ToDelete = true ;
1107+ bunkerRegionData .fauxdanDisplayScreens [fauxdanDisplayScreenKey ] = nil ;
10971108 end
1098- currentFauxdanDisplayFrameString = " Missions.rte/Objects/Fauxdan/Fauxdan" .. currentFauxdanDisplayFrameString .. " .png" ;
10991109 end
1100- for box in bunkerRegionData .fauxdanDisplayArea .Boxes do
1101- PrimitiveMan :DrawBitmapPrimitive (player , SceneMan :SnapPosition (box .Center , true ) + Vector (0 , 6 ), currentFauxdanDisplayFrameString , 0 ); -- Note: the Vector(0, 6) is to account for empty space at the bottom of the sprite.
1110+ else
1111+ for _ , fauxdanDisplayScreen in pairs (bunkerRegionData .fauxdanDisplayScreens ) do
1112+ fauxdanDisplayScreen .ToDelete = true ;
11021113 end
1114+ bunkerRegionData .fauxdanDisplayScreens = {};
11031115 end
1116+
11041117 if bunkerRegionData .captureCount > 0 then
1105- if currentLoginScreenFrameString == nil then
1106- local numberOfLoginScreenFrames = 21 ;
1107- currentLoginScreenFrameString = " 00" .. tostring (math.floor ((bunkerRegionData .captureCount / bunkerRegionData .captureLimit ) * numberOfLoginScreenFrames ));
1108- if currentLoginScreenFrameString :len () > 3 then
1109- currentLoginScreenFrameString = string.sub (currentLoginScreenFrameString , currentLoginScreenFrameString :len () - 2 );
1118+ if # bunkerRegionData .captureDisplayScreens == 0 then
1119+ for box in bunkerRegionData .captureDisplayArea .Boxes do
1120+ local captureDisplayScreen = self .captureDisplayScreenTemplate :Clone ();
1121+ captureDisplayScreen .Pos = box .Center ;
1122+ MovableMan :AddParticle (captureDisplayScreen );
1123+ bunkerRegionData .captureDisplayScreens [# bunkerRegionData .captureDisplayScreens + 1 ] = captureDisplayScreen ;
11101124 end
1111- currentLoginScreenFrameString = " Missions.rte/Objects/LoginScreen/LoginScreen" .. currentLoginScreenFrameString .. " .png" ;
11121125 end
1113- for box in bunkerRegionData .captureDisplayArea .Boxes do
1114- PrimitiveMan :DrawBitmapPrimitive (player , SceneMan :SnapPosition (box .Center , true ) + Vector (0 , 6 ), currentLoginScreenFrameString , 0 ); -- Note: the Vector(0, 6) is to account for empty space at the bottom of the sprite.
1126+ for _ , captureDisplayScreen in ipairs (bunkerRegionData .captureDisplayScreens ) do
1127+ captureDisplayScreen .Frame = math.floor ((bunkerRegionData .captureCount / bunkerRegionData .captureLimit ) * (captureDisplayScreen .FrameCount ));
1128+ captureDisplayScreen .Age = 0 ;
11151129 end
1130+ else
1131+ bunkerRegionData .captureDisplayScreens = {};
11161132 end
11171133 end
11181134 end
1119- elseif bunkerRegionData .fauxdanDisplayArea ~= nil then
1120- bunkerRegionData .fauxdanDisplayTimer :Reset ();
1121- bunkerRegionData .fauxdanDisplayCurrentFrame = 0 ;
11221135 end
11231136 end
11241137end
@@ -1178,6 +1191,10 @@ function DecisionDay:UpdateRegionCapturing()
11781191 if bunkerRegionData .captureCount >= bunkerRegionData .captureLimit then
11791192 bunkerRegionData .ownerTeam = capturingTeam ;
11801193 bunkerRegionData .captureCount = 0 ;
1194+
1195+ for _ , captureDisplayScreen in ipairs (bunkerRegionData .captureDisplayScreens ) do
1196+ captureDisplayScreen .Lifetime = 2000 ;
1197+ end
11811198
11821199 local useLeftReplacementComputer = captureBox .Center .X >= bunkerRegionData .totalArea .Center .X ;
11831200 local replacementComputer = self .controlledBunkerRegionComputerTerrainObjects [capturingTeam ][useLeftReplacementComputer and " left" or " right" ]:Clone ();
@@ -1921,8 +1938,6 @@ function DecisionDay:UpdateActivity()
19211938 end
19221939 end
19231940
1924- -- TODO maybe keep humanTeam actors out of shielded area. Or just rely on super doors
1925-
19261941 if self .currentStage == self .stages .attackBrain then
19271942 self :UpdateBrainDefenderSpawning ();
19281943 end
0 commit comments