Convert Allies-02 to make use of TimeLimit API
This commit is contained in:
committed by
abcdefg30
parent
26d712728a
commit
f11b7393ef
@@ -22,41 +22,16 @@ SovietBase = { SovietConyard, SovietRefinery, SovietPower1, SovietPower2, Soviet
|
||||
IdlingUnits = { }
|
||||
|
||||
if Map.LobbyOption("difficulty") == "easy" then
|
||||
TimerTicks = DateTime.Minutes(10)
|
||||
Announcements =
|
||||
{
|
||||
{ speech = "TenMinutesRemaining", delay = DateTime.Seconds(3) },
|
||||
{ speech = "WarningFiveMinutesRemaining", delay = DateTime.Minutes(5) },
|
||||
{ speech = "WarningFourMinutesRemaining", delay = DateTime.Minutes(6) },
|
||||
{ speech = "WarningThreeMinutesRemaining", delay = DateTime.Minutes(7) },
|
||||
{ speech = "WarningTwoMinutesRemaining", delay = DateTime.Minutes(8) },
|
||||
{ speech = "WarningOneMinuteRemaining", delay = DateTime.Minutes(9) }
|
||||
}
|
||||
DateTime.TimeLimit = DateTime.Minutes(10) + DateTime.Seconds(3)
|
||||
|
||||
elseif Map.LobbyOption("difficulty") == "normal" then
|
||||
TimerTicks = DateTime.Minutes(5)
|
||||
Announcements =
|
||||
{
|
||||
{ speech = "WarningFiveMinutesRemaining", delay = DateTime.Seconds(3) },
|
||||
{ speech = "WarningFourMinutesRemaining", delay = DateTime.Minutes(1) },
|
||||
{ speech = "WarningThreeMinutesRemaining", delay = DateTime.Minutes(2) },
|
||||
{ speech = "WarningTwoMinutesRemaining", delay = DateTime.Minutes(3) },
|
||||
{ speech = "WarningOneMinuteRemaining", delay = DateTime.Minutes(4) }
|
||||
}
|
||||
|
||||
DateTime.TimeLimit = DateTime.Minutes(5) + DateTime.Seconds(3)
|
||||
InfantryTypes = { "e1", "e1", "e1", "e2", "e2", "e1" }
|
||||
InfantryDelay = DateTime.Seconds(18)
|
||||
AttackGroupSize = 5
|
||||
|
||||
elseif Map.LobbyOption("difficulty") == "hard" then
|
||||
TimerTicks = DateTime.Minutes(3)
|
||||
Announcements =
|
||||
{
|
||||
{ speech = "WarningThreeMinutesRemaining", delay = DateTime.Seconds(3) },
|
||||
{ speech = "WarningTwoMinutesRemaining", delay = DateTime.Minutes(1) },
|
||||
{ speech = "WarningOneMinuteRemaining", delay = DateTime.Minutes(2) },
|
||||
}
|
||||
|
||||
DateTime.TimeLimit = DateTime.Minutes(3) + DateTime.Seconds(3)
|
||||
InfantryTypes = { "e1", "e1", "e1", "e2", "e2", "e1" }
|
||||
InfantryDelay = DateTime.Seconds(10)
|
||||
VehicleTypes = { "ftrk" }
|
||||
@@ -64,8 +39,7 @@ elseif Map.LobbyOption("difficulty") == "hard" then
|
||||
AttackGroupSize = 7
|
||||
|
||||
else
|
||||
TimerTicks = DateTime.Minutes(1)
|
||||
Announcements = { { speech = "WarningOneMinuteRemaining", delay = DateTime.Seconds(3) } }
|
||||
DateTime.TimeLimit = DateTime.Minutes(1) + DateTime.Seconds(3)
|
||||
ConstructionVehicleReinforcements = { "jeep" }
|
||||
|
||||
InfantryTypes = { "e1", "e1", "e1", "e2", "e2", "dog", "dog" }
|
||||
@@ -174,7 +148,6 @@ SendAttack = function()
|
||||
end)
|
||||
end
|
||||
|
||||
ticked = TimerTicks
|
||||
Tick = function()
|
||||
ussr.Resources = ussr.Resources - (0.01 * ussr.ResourceCapacity / 25)
|
||||
|
||||
@@ -185,18 +158,10 @@ Tick = function()
|
||||
if player.HasNoRequiredUnits() then
|
||||
ussr.MarkCompletedObjective(ussrObj)
|
||||
end
|
||||
|
||||
if ticked > 0 then
|
||||
UserInterface.SetMissionText("The convoy arrives in " .. Utils.FormatTime(ticked), TimerColor)
|
||||
ticked = ticked - 1
|
||||
elseif ticked == 0 then
|
||||
FinishTimer()
|
||||
SendTrucks()
|
||||
ticked = ticked - 1
|
||||
end
|
||||
end
|
||||
|
||||
FinishTimer = function()
|
||||
DateTime.TimeLimit = 0
|
||||
for i = 0, 5, 1 do
|
||||
local c = TimerColor
|
||||
if i % 2 == 0 then
|
||||
@@ -213,7 +178,8 @@ SendTrucks = function()
|
||||
if not ConvoyOnSite then
|
||||
ConvoyOnSite = true
|
||||
|
||||
ticked = 0
|
||||
DateTime.TimeLimit = 0
|
||||
UserInterface.SetMissionText("")
|
||||
ConvoyObjective = player.AddPrimaryObjective("Escort the convoy.")
|
||||
|
||||
Media.PlaySpeechNotification(player, "ConvoyApproaching")
|
||||
@@ -247,16 +213,6 @@ ConvoyCasualites = function()
|
||||
end
|
||||
end
|
||||
|
||||
ConvoyTimerAnnouncements = function()
|
||||
for i = #Announcements, 1, -1 do
|
||||
Trigger.AfterDelay(Announcements[i].delay, function()
|
||||
if not ConvoyOnSite then
|
||||
Media.PlaySpeechNotification(player, Announcements[i].speech)
|
||||
end
|
||||
end)
|
||||
end
|
||||
end
|
||||
|
||||
WorldLoaded = function()
|
||||
player = Player.GetPlayer("Greece")
|
||||
england = Player.GetPlayer("England")
|
||||
@@ -291,8 +247,11 @@ WorldLoaded = function()
|
||||
Trigger.AfterDelay(DateTime.Seconds(5), SendJeepReinforcements)
|
||||
Trigger.AfterDelay(DateTime.Seconds(10), SendJeepReinforcements)
|
||||
|
||||
Trigger.OnTimerExpired(function()
|
||||
FinishTimer()
|
||||
SendTrucks()
|
||||
end)
|
||||
|
||||
Camera.Position = ReinforcementsEntryPoint.CenterPosition
|
||||
TimerColor = player.Color
|
||||
|
||||
ConvoyTimerAnnouncements()
|
||||
end
|
||||
|
||||
@@ -23,6 +23,11 @@ World:
|
||||
hard: Hard
|
||||
tough: Real tough guy
|
||||
Default: easy
|
||||
TimeLimitManager:
|
||||
CountdownLabel: MISSION_TEXT
|
||||
CountdownText: The convoy will arrive in {0}
|
||||
Notification: {0} minute{1} remaining
|
||||
SkipTimerExpiredNotification: True
|
||||
|
||||
APWR:
|
||||
Buildable:
|
||||
|
||||
Reference in New Issue
Block a user