Use TimeLimitManager in mission Allies10a

This commit is contained in:
Oliver Brakmann
2021-08-29 12:17:57 +02:00
committed by abcdefg30
parent be4466115d
commit 7f3130c7a6
2 changed files with 11 additions and 38 deletions

View File

@@ -15,10 +15,8 @@ NorthHarassFootprint = { CPos.New(24, 75), CPos.New(25, 75), CPos.New(26, 75), C
NorthHarassTeam = { "e2", "e2", "e2", "3tnk" } NorthHarassTeam = { "e2", "e2", "e2", "3tnk" }
MissileSilos = { MissileSilo1, MissileSilo2, MissileSilo3, MissileSilo4 } MissileSilos = { MissileSilo1, MissileSilo2, MissileSilo3, MissileSilo4 }
StartTimer = false
TimerColor = Player.GetPlayer("USSR").Color TimerColor = Player.GetPlayer("USSR").Color
TimerTicks = DateTime.Minutes(59) + DateTime.Seconds(42) TimerTicks = DateTime.Minutes(59) + DateTime.Seconds(42)
ticked = TimerTicks
MissionStart = function() MissionStart = function()
Utils.Do(USSR.GetGroundAttackers(), function(unit) Utils.Do(USSR.GetGroundAttackers(), function(unit)
@@ -60,6 +58,12 @@ MissionTriggers = function()
end end
end) end)
Trigger.OnTimerExpired(function()
DateTime.TimeLimit = 0
Trigger.AfterDelay(1, function() UserInterface.SetMissionText("We're too late!", USSR.Color) end)
USSR.MarkCompletedObjective(HoldOut)
end)
Trigger.OnKilled(BridgeBarrel, function() Trigger.OnKilled(BridgeBarrel, function()
local bridge = Utils.Where(Map.ActorsInWorld, function(actor) return actor.Type == "bridge1" end)[1] local bridge = Utils.Where(Map.ActorsInWorld, function(actor) return actor.Type == "bridge1" end)[1]
if not bridge.IsDead then if not bridge.IsDead then
@@ -123,34 +127,9 @@ LaunchMissiles = function()
Trigger.AfterDelay(DateTime.Seconds(9), function() Trigger.AfterDelay(DateTime.Seconds(9), function()
CaptureFCom = Greece.AddObjective("Capture the enemy Command Center. Hurry!") CaptureFCom = Greece.AddObjective("Capture the enemy Command Center. Hurry!")
StartTimer = true DateTime.TimeLimit = TimerTicks
Media.PlaySpeechNotification(Greece, "TimerStarted") Media.PlaySpeechNotification(Greece, "TimerStarted")
Greece.MarkCompletedObjective(ApproachBase) Greece.MarkCompletedObjective(ApproachBase)
Trigger.AfterDelay(DateTime.Minutes(30), function()
Media.PlaySpeechNotification(Greece, "ThirtyMinutesRemaining")
end)
Trigger.AfterDelay(DateTime.Minutes(40), function()
Media.PlaySpeechNotification(Greece, "TwentyMinutesRemaining")
end)
Trigger.AfterDelay(DateTime.Minutes(50), function()
Media.PlaySpeechNotification(Greece, "TenMinutesRemaining")
end)
Trigger.AfterDelay(DateTime.Minutes(55), function()
Media.PlaySpeechNotification(Greece, "WarningFiveMinutesRemaining")
end)
Trigger.AfterDelay(DateTime.Minutes(56), function()
Media.PlaySpeechNotification(Greece, "WarningFourMinutesRemaining")
end)
Trigger.AfterDelay(DateTime.Minutes(57), function()
Media.PlaySpeechNotification(Greece, "WarningThreeMinutesRemaining")
end)
Trigger.AfterDelay(DateTime.Minutes(58), function()
Media.PlaySpeechNotification(Greece, "WarningTwoMinutesRemaining")
end)
Trigger.AfterDelay(DateTime.Minutes(59), function()
Media.PlaySpeechNotification(Greece, "WarningOneMinuteRemaining")
end)
end) end)
Trigger.OnCapture(CommandCenter, function() Trigger.OnCapture(CommandCenter, function()
@@ -171,16 +150,6 @@ Tick = function()
USSR.Cash = 50000 USSR.Cash = 50000
BadGuy.Cash = 50000 BadGuy.Cash = 50000
if StartTimer then
if ticked > 0 then
UserInterface.SetMissionText("Missiles reach their targets in " .. Utils.FormatTime(ticked), TimerColor)
ticked = ticked - 1
elseif ticked == 0 then
UserInterface.SetMissionText("We're too late!", USSR.Color)
USSR.MarkCompletedObjective(HoldOut)
end
end
if Greece.HasNoRequiredUnits() then if Greece.HasNoRequiredUnits() then
USSR.MarkCompletedObjective(HoldOut) USSR.MarkCompletedObjective(HoldOut)
end end

View File

@@ -14,6 +14,10 @@ World:
normal: Normal normal: Normal
hard: Hard hard: Hard
Default: normal Default: normal
TimeLimitManager:
SkipTimerExpiredNotification: true
CountdownLabel: MISSION_TEXT
CountdownText: Missiles reach their targets in {0}
Player: Player:
PlayerResources: PlayerResources: