Use global objective initialisation.
This commit is contained in:
committed by
abcdefg30
parent
d42edfc0b9
commit
b9bfbfd5ac
@@ -170,34 +170,14 @@ InitPlayers = function()
|
||||
ussr.Cash = 10000
|
||||
end
|
||||
|
||||
InitObjectives = function()
|
||||
Trigger.OnObjectiveAdded(player, function(p, id)
|
||||
Media.DisplayMessage(p.GetObjectiveDescription(id), "New " .. string.lower(p.GetObjectiveType(id)) .. " objective")
|
||||
end)
|
||||
AddObjectives = function()
|
||||
InitObjectives(player)
|
||||
|
||||
KillBridges = player.AddObjective("Destroy all bridges.")
|
||||
TanyaSurvive = player.AddObjective("Tanya must survive.")
|
||||
FindAllies = player.AddObjective("Find our lost tanks.", "Secondary", false)
|
||||
FreePrisoners = player.AddObjective("Free all Allied soldiers and keep them alive.", "Secondary", false)
|
||||
ussr.AddObjective("Bridges must not be destroyed.")
|
||||
|
||||
Trigger.OnObjectiveCompleted(player, function(p, id)
|
||||
Media.DisplayMessage(p.GetObjectiveDescription(id), "Objective completed")
|
||||
end)
|
||||
Trigger.OnObjectiveFailed(player, function(p, id)
|
||||
Media.DisplayMessage(p.GetObjectiveDescription(id), "Objective failed")
|
||||
end)
|
||||
|
||||
Trigger.OnPlayerLost(player, function()
|
||||
Trigger.AfterDelay(DateTime.Seconds(1), function()
|
||||
Media.PlaySpeechNotification(player, "Lose")
|
||||
end)
|
||||
end)
|
||||
Trigger.OnPlayerWon(player, function()
|
||||
Trigger.AfterDelay(DateTime.Seconds(1), function()
|
||||
Media.PlaySpeechNotification(player, "Win")
|
||||
end)
|
||||
end)
|
||||
end
|
||||
|
||||
InitTriggers = function()
|
||||
@@ -381,7 +361,7 @@ WorldLoaded = function()
|
||||
|
||||
InitPlayers()
|
||||
|
||||
InitObjectives()
|
||||
AddObjectives()
|
||||
InitTriggers()
|
||||
SetupAlliedUnits()
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user