Merge pull request #9417 from clemty/topleft
Reduce use of Map.Topleft and Map.Bottomright
This commit is contained in:
@@ -2,6 +2,7 @@ MCVReinforcements = { "mcv" }
|
|||||||
InfantryReinforcements = { "e1", "e1", "e1" }
|
InfantryReinforcements = { "e1", "e1", "e1" }
|
||||||
VehicleReinforcements = { "jeep" }
|
VehicleReinforcements = { "jeep" }
|
||||||
NodPatrol = { "e1", "e1" }
|
NodPatrol = { "e1", "e1" }
|
||||||
|
GDIBaseBuildings = { "pyle", "fact", "nuke" }
|
||||||
|
|
||||||
SendNodPatrol = function()
|
SendNodPatrol = function()
|
||||||
Reinforcements.Reinforce(enemy, NodPatrol, { nod0.Location, nod1.Location }, 15, function(soldier)
|
Reinforcements.Reinforce(enemy, NodPatrol, { nod0.Location, nod1.Location }, 15, function(soldier)
|
||||||
@@ -48,12 +49,16 @@ Reinforce = function(units)
|
|||||||
ReinforceWithLandingCraft(units, lstStart.Location, lstEnd.Location, reinforcementsTarget.Location)
|
ReinforceWithLandingCraft(units, lstStart.Location, lstEnd.Location, reinforcementsTarget.Location)
|
||||||
end
|
end
|
||||||
|
|
||||||
CheckForBase = function()
|
CheckForBase = function(player)
|
||||||
baseBuildings = Map.ActorsInBox(Map.TopLeft, Map.BottomRight, function(actor)
|
local buildings = 0
|
||||||
return actor.Type == "fact" or actor.Type == "pyle" or actor.Type == "nuke"
|
|
||||||
|
Utils.Do(GDIBaseBuildings, function(name)
|
||||||
|
if #player.GetActorsByType(name) > 0 then
|
||||||
|
buildings = buildings + 1
|
||||||
|
end
|
||||||
end)
|
end)
|
||||||
|
|
||||||
return #baseBuildings >= 3
|
return buildings == #GDIBaseBuildings
|
||||||
end
|
end
|
||||||
|
|
||||||
WorldLoaded = function()
|
WorldLoaded = function()
|
||||||
@@ -102,7 +107,7 @@ Tick = function()
|
|||||||
player.MarkFailedObjective(secureAreaObjective)
|
player.MarkFailedObjective(secureAreaObjective)
|
||||||
end
|
end
|
||||||
|
|
||||||
if DateTime.GameTime % DateTime.Seconds(1) == 0 and not player.IsObjectiveCompleted(beachheadObjective) and CheckForBase() then
|
if DateTime.GameTime % DateTime.Seconds(1) == 0 and not player.IsObjectiveCompleted(beachheadObjective) and CheckForBase(player) then
|
||||||
player.MarkCompletedObjective(beachheadObjective)
|
player.MarkCompletedObjective(beachheadObjective)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -53,23 +53,16 @@ OnAnyDamaged = function(actors, func)
|
|||||||
end)
|
end)
|
||||||
end
|
end
|
||||||
|
|
||||||
CheckForBase = function(player, buildings)
|
CheckForBase = function(player)
|
||||||
local checked = { }
|
local buildings = 0
|
||||||
local baseBuildings = Map.ActorsInBox(Map.TopLeft, Map.BottomRight, function(actor)
|
|
||||||
if actor.Owner ~= Nod or Utils.Any(checked, function(bldng) return bldng.Type == actor.Type end) then
|
|
||||||
return false
|
|
||||||
end
|
|
||||||
|
|
||||||
local found = false
|
Utils.Do(NodBaseBuildings, function(name)
|
||||||
for i = 1, #buildings, 1 do
|
if #player.GetActorsByType(name) > 0 then
|
||||||
if actor.Type == buildings[i] then
|
buildings = buildings + 1
|
||||||
found = true
|
|
||||||
checked[#checked + 1] = actor
|
|
||||||
end
|
end
|
||||||
end
|
|
||||||
return found
|
|
||||||
end)
|
end)
|
||||||
return #baseBuildings >= 3
|
|
||||||
|
return buildings == #NodBaseBuildings
|
||||||
end
|
end
|
||||||
|
|
||||||
DfndTriggerFunction = function()
|
DfndTriggerFunction = function()
|
||||||
@@ -231,7 +224,7 @@ Tick = function()
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
if DateTime.GameTime % DateTime.Seconds(1) == 0 and not Nod.IsObjectiveCompleted(NodObjective1) and CheckForBase(Nod, NodBaseBuildings) then
|
if DateTime.GameTime % DateTime.Seconds(1) == 0 and not Nod.IsObjectiveCompleted(NodObjective1) and CheckForBase(Nod) then
|
||||||
Nod.MarkCompletedObjective(NodObjective1)
|
Nod.MarkCompletedObjective(NodObjective1)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -149,7 +149,7 @@ Tick = function()
|
|||||||
Nod.MarkCompletedObjective(NodObjective2)
|
Nod.MarkCompletedObjective(NodObjective2)
|
||||||
end
|
end
|
||||||
|
|
||||||
if DateTime.GameTime % DateTime.Seconds(1) == 0 and not Nod.IsObjectiveCompleted(NodObjective1) and CheckForBase(Nod, NodBaseBuildings) then
|
if DateTime.GameTime % DateTime.Seconds(1) == 0 and not Nod.IsObjectiveCompleted(NodObjective1) and CheckForBase(Nod) then
|
||||||
Nod.MarkCompletedObjective(NodObjective1)
|
Nod.MarkCompletedObjective(NodObjective1)
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -158,23 +158,16 @@ Tick = function()
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
CheckForBase = function(player, buildings)
|
CheckForBase = function(player)
|
||||||
local checked = { }
|
local buildings = 0
|
||||||
local baseBuildings = Map.ActorsInBox(Map.TopLeft, Map.BottomRight, function(actor)
|
|
||||||
if actor.Owner ~= Nod or Utils.Any(checked, function(bldng) return bldng.Type == actor.Type end) then
|
|
||||||
return false
|
|
||||||
end
|
|
||||||
|
|
||||||
local found = false
|
Utils.Do(NodBaseBuildings, function(name)
|
||||||
for i = 1, #buildings, 1 do
|
if #player.GetActorsByType(name) > 0 then
|
||||||
if actor.Type == buildings[i] then
|
buildings = buildings + 1
|
||||||
found = true
|
|
||||||
checked[#checked + 1] = actor
|
|
||||||
end
|
end
|
||||||
end
|
|
||||||
return found
|
|
||||||
end)
|
end)
|
||||||
return #baseBuildings >= 3
|
|
||||||
|
return buildings == #NodBaseBuildings
|
||||||
end
|
end
|
||||||
|
|
||||||
OnAnyDamaged = function(actors, func)
|
OnAnyDamaged = function(actors, func)
|
||||||
|
|||||||
@@ -270,10 +270,8 @@ IdleHunt = function(unit)
|
|||||||
end
|
end
|
||||||
|
|
||||||
CheckForSams = function(player)
|
CheckForSams = function(player)
|
||||||
local baseBuildings = Map.ActorsInBox(Map.TopLeft, Map.BottomRight, function(actor)
|
local sams = Nod.GetActorsByType("sam")
|
||||||
return actor.Owner == Nod and actor.Type == 'sam' end)
|
return #sams >= 3
|
||||||
|
|
||||||
return #baseBuildings >= 3
|
|
||||||
end
|
end
|
||||||
|
|
||||||
checkProduction = function(player)
|
checkProduction = function(player)
|
||||||
|
|||||||
@@ -245,7 +245,7 @@ InitTriggers = function()
|
|||||||
player.MarkCompletedObjective(FreePrisoners)
|
player.MarkCompletedObjective(FreePrisoners)
|
||||||
end)
|
end)
|
||||||
|
|
||||||
local oilPumps = Map.ActorsInBox(Map.TopLeft, Map.BottomRight, function(self) return self.Type == "v19" end)
|
local oilPumps = ussr.GetActorsByType("v19")
|
||||||
|
|
||||||
Trigger.OnAllKilled(oilPumps, function()
|
Trigger.OnAllKilled(oilPumps, function()
|
||||||
player.MarkCompletedObjective(KillUSSR)
|
player.MarkCompletedObjective(KillUSSR)
|
||||||
|
|||||||
@@ -439,16 +439,16 @@ Actors:
|
|||||||
Owner: USSR
|
Owner: USSR
|
||||||
Actor127: v19
|
Actor127: v19
|
||||||
Location: 70,56
|
Location: 70,56
|
||||||
Owner: Neutral
|
Owner: USSR
|
||||||
Actor128: v19
|
Actor128: v19
|
||||||
Location: 70,54
|
Location: 70,54
|
||||||
Owner: Neutral
|
Owner: USSR
|
||||||
Actor129: v19
|
Actor129: v19
|
||||||
Location: 72,54
|
Location: 72,54
|
||||||
Owner: Neutral
|
Owner: USSR
|
||||||
Actor130: v19
|
Actor130: v19
|
||||||
Location: 74,54
|
Location: 74,54
|
||||||
Owner: Neutral
|
Owner: USSR
|
||||||
Actor131: brl3
|
Actor131: brl3
|
||||||
Location: 84,65
|
Location: 84,65
|
||||||
Owner: USSR
|
Owner: USSR
|
||||||
@@ -457,7 +457,7 @@ Actors:
|
|||||||
Owner: USSR
|
Owner: USSR
|
||||||
Actor133: v19
|
Actor133: v19
|
||||||
Location: 83,65
|
Location: 83,65
|
||||||
Owner: Neutral
|
Owner: USSR
|
||||||
Actor134: barl
|
Actor134: barl
|
||||||
Location: 78,70
|
Location: 78,70
|
||||||
Owner: USSR
|
Owner: USSR
|
||||||
@@ -487,16 +487,16 @@ Actors:
|
|||||||
Owner: USSR
|
Owner: USSR
|
||||||
Actor142: v19
|
Actor142: v19
|
||||||
Location: 87,66
|
Location: 87,66
|
||||||
Owner: Neutral
|
Owner: USSR
|
||||||
Actor143: v19
|
Actor143: v19
|
||||||
Location: 85,68
|
Location: 85,68
|
||||||
Owner: Neutral
|
Owner: USSR
|
||||||
Actor144: v19
|
Actor144: v19
|
||||||
Location: 82,66
|
Location: 82,66
|
||||||
Owner: Neutral
|
Owner: USSR
|
||||||
Actor145: v19
|
Actor145: v19
|
||||||
Location: 85,63
|
Location: 85,63
|
||||||
Owner: Neutral
|
Owner: USSR
|
||||||
Actor146: v04
|
Actor146: v04
|
||||||
Location: 54,52
|
Location: 54,52
|
||||||
Owner: Neutral
|
Owner: Neutral
|
||||||
@@ -523,10 +523,10 @@ Actors:
|
|||||||
Owner: USSR
|
Owner: USSR
|
||||||
Actor154: v19
|
Actor154: v19
|
||||||
Location: 59,61
|
Location: 59,61
|
||||||
Owner: Neutral
|
Owner: USSR
|
||||||
Actor155: v19
|
Actor155: v19
|
||||||
Location: 57,61
|
Location: 57,61
|
||||||
Owner: Neutral
|
Owner: USSR
|
||||||
Actor156: brl3
|
Actor156: brl3
|
||||||
Location: 58,61
|
Location: 58,61
|
||||||
Owner: USSR
|
Owner: USSR
|
||||||
@@ -559,7 +559,7 @@ Actors:
|
|||||||
Owner: USSR
|
Owner: USSR
|
||||||
Actor170: v19
|
Actor170: v19
|
||||||
Location: 54,68
|
Location: 54,68
|
||||||
Owner: Neutral
|
Owner: USSR
|
||||||
Actor179: brl3
|
Actor179: brl3
|
||||||
Location: 77,66
|
Location: 77,66
|
||||||
Owner: USSR
|
Owner: USSR
|
||||||
@@ -631,7 +631,7 @@ Actors:
|
|||||||
Owner: USSR
|
Owner: USSR
|
||||||
Actor202: v19
|
Actor202: v19
|
||||||
Location: 101,48
|
Location: 101,48
|
||||||
Owner: Neutral
|
Owner: USSR
|
||||||
Actor203: brl3
|
Actor203: brl3
|
||||||
Location: 96,50
|
Location: 96,50
|
||||||
Owner: USSR
|
Owner: USSR
|
||||||
@@ -652,13 +652,13 @@ Actors:
|
|||||||
Owner: USSR
|
Owner: USSR
|
||||||
Actor209: v19
|
Actor209: v19
|
||||||
Location: 102,67
|
Location: 102,67
|
||||||
Owner: Neutral
|
Owner: USSR
|
||||||
Actor210: v19
|
Actor210: v19
|
||||||
Location: 101,69
|
Location: 101,69
|
||||||
Owner: Neutral
|
Owner: USSR
|
||||||
Actor211: v19
|
Actor211: v19
|
||||||
Location: 100,71
|
Location: 100,71
|
||||||
Owner: Neutral
|
Owner: USSR
|
||||||
Actor212: brl3
|
Actor212: brl3
|
||||||
Location: 102,66
|
Location: 102,66
|
||||||
Owner: USSR
|
Owner: USSR
|
||||||
@@ -718,7 +718,7 @@ Actors:
|
|||||||
Owner: USSR
|
Owner: USSR
|
||||||
Actor232: v19
|
Actor232: v19
|
||||||
Location: 91,68
|
Location: 91,68
|
||||||
Owner: Neutral
|
Owner: USSR
|
||||||
Actor233: brl3
|
Actor233: brl3
|
||||||
Location: 91,69
|
Location: 91,69
|
||||||
Owner: USSR
|
Owner: USSR
|
||||||
@@ -727,13 +727,13 @@ Actors:
|
|||||||
Owner: USSR
|
Owner: USSR
|
||||||
Actor234: v19
|
Actor234: v19
|
||||||
Location: 84,51
|
Location: 84,51
|
||||||
Owner: Neutral
|
Owner: USSR
|
||||||
Actor235: v19
|
Actor235: v19
|
||||||
Location: 87,51
|
Location: 87,51
|
||||||
Owner: Neutral
|
Owner: USSR
|
||||||
Actor236: v19
|
Actor236: v19
|
||||||
Location: 86,52
|
Location: 86,52
|
||||||
Owner: Neutral
|
Owner: USSR
|
||||||
Actor237: brl3
|
Actor237: brl3
|
||||||
Location: 84,52
|
Location: 84,52
|
||||||
Owner: USSR
|
Owner: USSR
|
||||||
|
|||||||
Reference in New Issue
Block a user