11package.loaded .Constants = nil ;
22require (" Constants" );
3+ require (" Scripts/Shared/Activity_SpeedrunHelper" )
34
45function DecisionDayDeployBrainPieSliceActivation (pieMenuOwner , pieMenu , pieSlice )
56 ActivityMan :GetActivity ():SaveNumber (" DeployBrain" , pieMenuOwner :GetController ().Player + 1 );
@@ -398,6 +399,8 @@ function DecisionDay:OnSave()
398399end
399400
400401function DecisionDay :StartNewGame ()
402+ self .speedrunData = ActivitySpeedrunHelper .Setup (self , self .DoSpeedrunMode );
403+
401404 self :SetTeamFunds (0 , self .humanTeam );
402405 self .BuyMenuEnabled = false ;
403406
@@ -787,6 +790,11 @@ function DecisionDay:DoGameOverCheck()
787790 self .messageTimer :Reset ();
788791 end
789792 end
793+
794+ if self .speedrunData and self .WinnerTeam == self .humanTeam then
795+ self .messageTimer :SetSimTimeLimitMS (10000 );
796+ ActivitySpeedrunHelper .CompleteSpeedrun (self .speedrunData );
797+ end
790798
791799 if self .WinnerTeam ~= Activity .NOTEAM and self .messageTimer :IsPastSimTimeLimit () then
792800 if self .WinnerTeam == self .humanTeam then
@@ -800,6 +808,48 @@ function DecisionDay:DoGameOverCheck()
800808 end
801809end
802810
811+ function DecisionDay :DoSpeedrunMode ()
812+ self .Difficulty = Activity .MAXDIFFICULTY ;
813+ self .difficultyRatio = 2 ;
814+ for _ , bunkerRegionData in pairs (self .bunkerRegions ) do
815+ bunkerRegionData .captureLimit = 600 * self .difficultyRatio ;
816+ bunkerRegionData .aiRegionDefenseTimer :SetSimTimeLimitMS (60000 / self .difficultyRatio );
817+ bunkerRegionData .aiRegionDefenseTimer .ElapsedSimTimeMS = 60000 / self .difficultyRatio ;
818+ bunkerRegionData .aiRegionAttackTimer :SetSimTimeLimitMS (90000 / self .difficultyRatio );
819+ end
820+
821+ self .aiData .externalSpawnTimer :SetSimTimeLimitMS (120000 / self .difficultyRatio );
822+ self .aiData .internalReinforcementsTimer :SetSimTimeLimitMS (100000 / self .difficultyRatio );
823+ self .aiData .internalReinforcementLimit = 12 * self .difficultyRatio ;
824+ self .aiData .bunkerRegionDefenseRange = math.max (500 , math.min (750 * self .difficultyRatio , 1000 ));
825+ self .aiData .attackerLimit = 10 * self .difficultyRatio ;
826+ self .aiData .attackersPerSpawn = 4 * self .difficultyRatio ;
827+
828+ self .aiData .brainDefenderSpawnTimer :SetSimTimeLimitMS (10000 / self .difficultyRatio );
829+ self .aiData .brainDefenderReplenishTimer :SetSimTimeLimitMS (30000 / self .difficultyRatio );
830+ self .aiData .brainDefendersTotal = 20 * self .difficultyRatio ;
831+ self .aiData .brainDefendersRemaining = self .aiData .brainDefendersTotal ;
832+
833+ self :SetTeamFunds (0 , self .humanTeam );
834+
835+ self :SetTeamTech (self .humanTeam , " -All-" );
836+ self .humanTeamTech = PresetMan :GetModuleID (self :GetTeamTech (self .humanTeam ));
837+ self :SetTeamTech (self .aiTeam , " -All-" );
838+ self .aiTeamTech = PresetMan :GetModuleID (self :GetTeamTech (self .aiTeam ));
839+
840+ AudioMan :PlayMusic (" Base.rte/Music/dBSoundworks/bossfight.ogg" , - 1 , - 1 );
841+
842+ self .messageTimer :SetSimTimeLimitMS (1 );
843+
844+ self .currentStage = self .stages .attackFrontBunker ;
845+
846+ self .aiData .internalReinforcementsEnabled = true ;
847+ self .internalReinforcementsData [self .bunkerIds .frontBunker ].enabled = true ;
848+
849+ self .bunkerRegions [" Front Bunker Operations" ].enabled = true ;
850+ self .bunkerRegions [" Front Bunker Small Vault" ].enabled = true ;
851+ end
852+
803853function DecisionDay :UpdateCurrentStage ()
804854 local previousStage = self .currentStage ;
805855
@@ -939,6 +989,10 @@ function DecisionDay:UpdateCamera()
939989 CameraMan :SetScrollTarget (Vector (adjustedCameraMinimumX , CameraMan :GetScrollTarget (player ).Y ), 0.25 , false , 0 );
940990 end
941991 end
992+
993+ if self .speedrunData and ActivitySpeedrunHelper .SpeedrunActive (self .speedrunData ) then
994+ return ;
995+ end
942996
943997 local slowScroll = 0.0125 ;
944998 local mediumScroll = 0.05 ;
@@ -1050,6 +1104,12 @@ function DecisionDay:UpdateCamera()
10501104end
10511105
10521106function DecisionDay :UpdateMessages ()
1107+ if self .speedrunData and ActivitySpeedrunHelper .SpeedrunActive (self .speedrunData ) then
1108+ FrameMan :ClearScreenText (Activity .PLAYER_1 );
1109+ FrameMan :SetScreenText (ActivitySpeedrunHelper .GetSpeedrunDuration (self .speedrunData ), Activity .PLAYER_1 , 0 , 1 , ActivitySpeedrunHelper .SpeedrunCompleted (self .speedrunData ));
1110+ return ;
1111+ end
1112+
10531113 if self .messageTimer :IsPastSimTimeLimit () then
10541114 if self .currentMessageNumber < self .numberOfMessagesForStage then
10551115 self .currentMessageNumber = self .currentMessageNumber + 1 ;
@@ -2064,6 +2124,14 @@ function DecisionDay:UpdateActivity()
20642124 if self .WinnerTeam ~= Activity .NOTEAM then
20652125 return ;
20662126 end
2127+
2128+ if self .speedrunData and not ActivitySpeedrunHelper .SpeedrunActive (self .speedrunData ) then
2129+ if self .currentStage == self .stages .followInitialDropShip then
2130+ ActivitySpeedrunHelper .CheckForSpeedrun (self .speedrunData );
2131+ else
2132+ self .speedrunData = nil ;
2133+ end
2134+ end
20672135
20682136 if self .currentStage < self .stages .frontBunkerCaptured then
20692137 self :SpawnAndUpdateInitialDropShips ();
0 commit comments