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