fix redeploying failing the secondary objective
code cleanup
This commit is contained in:
@@ -48,21 +48,11 @@ Reinforce = function(units)
|
||||
ReinforceWithLandingCraft(units, lstStart.Location, lstEnd.Location, reinforcementsTarget.Location)
|
||||
end
|
||||
|
||||
triggerAdded = false
|
||||
CheckForBase = function()
|
||||
baseBuildings = Map.ActorsInBox(Map.TopLeft, Map.BottomRight, function(actor)
|
||||
return actor.Type == "fact" or actor.Type == "pyle" or actor.Type == "nuke"
|
||||
end)
|
||||
|
||||
Utils.Do(baseBuildings, function(building)
|
||||
if not triggerAdded and building.Type == "fact" then
|
||||
Trigger.OnRemovedFromWorld(building, function()
|
||||
player.MarkFailedObjective(gdiObjective2)
|
||||
end)
|
||||
triggerAdded = true
|
||||
end
|
||||
end)
|
||||
|
||||
return #baseBuildings >= 3
|
||||
end
|
||||
|
||||
@@ -89,9 +79,8 @@ WorldLoaded = function()
|
||||
Media.PlaySpeechNotification(player, "Lose")
|
||||
end)
|
||||
|
||||
nodObjective = enemy.AddPrimaryObjective("Destroy all GDI troops")
|
||||
gdiObjective1 = player.AddPrimaryObjective("Eliminate all Nod forces in the area")
|
||||
gdiObjective2 = player.AddSecondaryObjective("Establish a beachhead")
|
||||
secureAreaObjective = player.AddPrimaryObjective("Eliminate all Nod forces in the area")
|
||||
beachheadObjective = player.AddSecondaryObjective("Establish a beachhead")
|
||||
|
||||
ReinforceWithLandingCraft(MCVReinforcements, lstStart.Location + CVec.New(2, 0), lstEnd.Location + CVec.New(2, 0), mcvTarget.Location)
|
||||
Reinforce(InfantryReinforcements)
|
||||
@@ -104,20 +93,17 @@ WorldLoaded = function()
|
||||
Trigger.AfterDelay(DateTime.Seconds(60), function() Reinforce(VehicleReinforcements) end)
|
||||
end
|
||||
|
||||
tick = 0
|
||||
baseEstablished = false
|
||||
Tick = function()
|
||||
tick = tick + 1
|
||||
if enemy.HasNoRequiredUnits() then
|
||||
player.MarkCompletedObjective(gdiObjective1)
|
||||
player.MarkCompletedObjective(secureAreaObjective)
|
||||
end
|
||||
|
||||
if tick > DateTime.Seconds(5) and player.HasNoRequiredUnits() then
|
||||
enemy.MarkCompletedObjective(nodObjective)
|
||||
if DateTime.GameTime > DateTime.Seconds(5) and player.HasNoRequiredUnits() then
|
||||
player.MarkFailedObjective(beachheadObjective)
|
||||
player.MarkFailedObjective(secureAreaObjective)
|
||||
end
|
||||
|
||||
if not baseEstablished and tick % DateTime.Seconds(1) == 0 and CheckForBase() then
|
||||
baseEstablished = true
|
||||
player.MarkCompletedObjective(gdiObjective2)
|
||||
if DateTime.GameTime % DateTime.Seconds(1) == 0 and not player.IsObjectiveCompleted(beachheadObjective) and CheckForBase() then
|
||||
player.MarkCompletedObjective(beachheadObjective)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -487,6 +487,16 @@ Rules:
|
||||
GenericVisibility: Enemy, Ally, Neutral
|
||||
GenericStancePrefix: false
|
||||
ShowOwnerRow: false
|
||||
NUKE:
|
||||
-Sellable:
|
||||
Buildable:
|
||||
BuildLimit: 1
|
||||
PYLE:
|
||||
-Sellable:
|
||||
Buildable:
|
||||
BuildLimit: 1
|
||||
FACT:
|
||||
-Sellable:
|
||||
PROC:
|
||||
Buildable:
|
||||
Prerequisites: ~disabled
|
||||
|
||||
Reference in New Issue
Block a user