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 = { }
|
IdlingUnits = { }
|
||||||
|
|
||||||
if Map.LobbyOption("difficulty") == "easy" then
|
if Map.LobbyOption("difficulty") == "easy" then
|
||||||
TimerTicks = DateTime.Minutes(10)
|
DateTime.TimeLimit = DateTime.Minutes(10) + DateTime.Seconds(3)
|
||||||
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) }
|
|
||||||
}
|
|
||||||
|
|
||||||
elseif Map.LobbyOption("difficulty") == "normal" then
|
elseif Map.LobbyOption("difficulty") == "normal" then
|
||||||
TimerTicks = DateTime.Minutes(5)
|
DateTime.TimeLimit = DateTime.Minutes(5) + DateTime.Seconds(3)
|
||||||
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) }
|
|
||||||
}
|
|
||||||
|
|
||||||
InfantryTypes = { "e1", "e1", "e1", "e2", "e2", "e1" }
|
InfantryTypes = { "e1", "e1", "e1", "e2", "e2", "e1" }
|
||||||
InfantryDelay = DateTime.Seconds(18)
|
InfantryDelay = DateTime.Seconds(18)
|
||||||
AttackGroupSize = 5
|
AttackGroupSize = 5
|
||||||
|
|
||||||
elseif Map.LobbyOption("difficulty") == "hard" then
|
elseif Map.LobbyOption("difficulty") == "hard" then
|
||||||
TimerTicks = DateTime.Minutes(3)
|
DateTime.TimeLimit = DateTime.Minutes(3) + DateTime.Seconds(3)
|
||||||
Announcements =
|
|
||||||
{
|
|
||||||
{ speech = "WarningThreeMinutesRemaining", delay = DateTime.Seconds(3) },
|
|
||||||
{ speech = "WarningTwoMinutesRemaining", delay = DateTime.Minutes(1) },
|
|
||||||
{ speech = "WarningOneMinuteRemaining", delay = DateTime.Minutes(2) },
|
|
||||||
}
|
|
||||||
|
|
||||||
InfantryTypes = { "e1", "e1", "e1", "e2", "e2", "e1" }
|
InfantryTypes = { "e1", "e1", "e1", "e2", "e2", "e1" }
|
||||||
InfantryDelay = DateTime.Seconds(10)
|
InfantryDelay = DateTime.Seconds(10)
|
||||||
VehicleTypes = { "ftrk" }
|
VehicleTypes = { "ftrk" }
|
||||||
@@ -64,8 +39,7 @@ elseif Map.LobbyOption("difficulty") == "hard" then
|
|||||||
AttackGroupSize = 7
|
AttackGroupSize = 7
|
||||||
|
|
||||||
else
|
else
|
||||||
TimerTicks = DateTime.Minutes(1)
|
DateTime.TimeLimit = DateTime.Minutes(1) + DateTime.Seconds(3)
|
||||||
Announcements = { { speech = "WarningOneMinuteRemaining", delay = DateTime.Seconds(3) } }
|
|
||||||
ConstructionVehicleReinforcements = { "jeep" }
|
ConstructionVehicleReinforcements = { "jeep" }
|
||||||
|
|
||||||
InfantryTypes = { "e1", "e1", "e1", "e2", "e2", "dog", "dog" }
|
InfantryTypes = { "e1", "e1", "e1", "e2", "e2", "dog", "dog" }
|
||||||
@@ -174,7 +148,6 @@ SendAttack = function()
|
|||||||
end)
|
end)
|
||||||
end
|
end
|
||||||
|
|
||||||
ticked = TimerTicks
|
|
||||||
Tick = function()
|
Tick = function()
|
||||||
ussr.Resources = ussr.Resources - (0.01 * ussr.ResourceCapacity / 25)
|
ussr.Resources = ussr.Resources - (0.01 * ussr.ResourceCapacity / 25)
|
||||||
|
|
||||||
@@ -185,18 +158,10 @@ Tick = function()
|
|||||||
if player.HasNoRequiredUnits() then
|
if player.HasNoRequiredUnits() then
|
||||||
ussr.MarkCompletedObjective(ussrObj)
|
ussr.MarkCompletedObjective(ussrObj)
|
||||||
end
|
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
|
end
|
||||||
|
|
||||||
FinishTimer = function()
|
FinishTimer = function()
|
||||||
|
DateTime.TimeLimit = 0
|
||||||
for i = 0, 5, 1 do
|
for i = 0, 5, 1 do
|
||||||
local c = TimerColor
|
local c = TimerColor
|
||||||
if i % 2 == 0 then
|
if i % 2 == 0 then
|
||||||
@@ -213,7 +178,8 @@ SendTrucks = function()
|
|||||||
if not ConvoyOnSite then
|
if not ConvoyOnSite then
|
||||||
ConvoyOnSite = true
|
ConvoyOnSite = true
|
||||||
|
|
||||||
ticked = 0
|
DateTime.TimeLimit = 0
|
||||||
|
UserInterface.SetMissionText("")
|
||||||
ConvoyObjective = player.AddPrimaryObjective("Escort the convoy.")
|
ConvoyObjective = player.AddPrimaryObjective("Escort the convoy.")
|
||||||
|
|
||||||
Media.PlaySpeechNotification(player, "ConvoyApproaching")
|
Media.PlaySpeechNotification(player, "ConvoyApproaching")
|
||||||
@@ -247,16 +213,6 @@ ConvoyCasualites = function()
|
|||||||
end
|
end
|
||||||
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()
|
WorldLoaded = function()
|
||||||
player = Player.GetPlayer("Greece")
|
player = Player.GetPlayer("Greece")
|
||||||
england = Player.GetPlayer("England")
|
england = Player.GetPlayer("England")
|
||||||
@@ -291,8 +247,11 @@ WorldLoaded = function()
|
|||||||
Trigger.AfterDelay(DateTime.Seconds(5), SendJeepReinforcements)
|
Trigger.AfterDelay(DateTime.Seconds(5), SendJeepReinforcements)
|
||||||
Trigger.AfterDelay(DateTime.Seconds(10), SendJeepReinforcements)
|
Trigger.AfterDelay(DateTime.Seconds(10), SendJeepReinforcements)
|
||||||
|
|
||||||
|
Trigger.OnTimerExpired(function()
|
||||||
|
FinishTimer()
|
||||||
|
SendTrucks()
|
||||||
|
end)
|
||||||
|
|
||||||
Camera.Position = ReinforcementsEntryPoint.CenterPosition
|
Camera.Position = ReinforcementsEntryPoint.CenterPosition
|
||||||
TimerColor = player.Color
|
TimerColor = player.Color
|
||||||
|
|
||||||
ConvoyTimerAnnouncements()
|
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -23,6 +23,11 @@ World:
|
|||||||
hard: Hard
|
hard: Hard
|
||||||
tough: Real tough guy
|
tough: Real tough guy
|
||||||
Default: easy
|
Default: easy
|
||||||
|
TimeLimitManager:
|
||||||
|
CountdownLabel: MISSION_TEXT
|
||||||
|
CountdownText: The convoy will arrive in {0}
|
||||||
|
Notification: {0} minute{1} remaining
|
||||||
|
SkipTimerExpiredNotification: True
|
||||||
|
|
||||||
APWR:
|
APWR:
|
||||||
Buildable:
|
Buildable:
|
||||||
|
|||||||
Reference in New Issue
Block a user