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" }
|
||||
VehicleReinforcements = { "jeep" }
|
||||
NodPatrol = { "e1", "e1" }
|
||||
GDIBaseBuildings = { "pyle", "fact", "nuke" }
|
||||
|
||||
SendNodPatrol = function()
|
||||
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)
|
||||
end
|
||||
|
||||
CheckForBase = function()
|
||||
baseBuildings = Map.ActorsInBox(Map.TopLeft, Map.BottomRight, function(actor)
|
||||
return actor.Type == "fact" or actor.Type == "pyle" or actor.Type == "nuke"
|
||||
CheckForBase = function(player)
|
||||
local buildings = 0
|
||||
|
||||
Utils.Do(GDIBaseBuildings, function(name)
|
||||
if #player.GetActorsByType(name) > 0 then
|
||||
buildings = buildings + 1
|
||||
end
|
||||
end)
|
||||
|
||||
return #baseBuildings >= 3
|
||||
return buildings == #GDIBaseBuildings
|
||||
end
|
||||
|
||||
WorldLoaded = function()
|
||||
@@ -102,7 +107,7 @@ Tick = function()
|
||||
player.MarkFailedObjective(secureAreaObjective)
|
||||
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)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -53,23 +53,16 @@ OnAnyDamaged = function(actors, func)
|
||||
end)
|
||||
end
|
||||
|
||||
CheckForBase = function(player, buildings)
|
||||
local checked = { }
|
||||
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
|
||||
CheckForBase = function(player)
|
||||
local buildings = 0
|
||||
|
||||
local found = false
|
||||
for i = 1, #buildings, 1 do
|
||||
if actor.Type == buildings[i] then
|
||||
found = true
|
||||
checked[#checked + 1] = actor
|
||||
end
|
||||
Utils.Do(NodBaseBuildings, function(name)
|
||||
if #player.GetActorsByType(name) > 0 then
|
||||
buildings = buildings + 1
|
||||
end
|
||||
return found
|
||||
end)
|
||||
return #baseBuildings >= 3
|
||||
|
||||
return buildings == #NodBaseBuildings
|
||||
end
|
||||
|
||||
DfndTriggerFunction = function()
|
||||
@@ -231,7 +224,7 @@ Tick = function()
|
||||
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)
|
||||
end
|
||||
|
||||
|
||||
@@ -149,7 +149,7 @@ Tick = function()
|
||||
Nod.MarkCompletedObjective(NodObjective2)
|
||||
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)
|
||||
end
|
||||
|
||||
@@ -158,23 +158,16 @@ Tick = function()
|
||||
end
|
||||
end
|
||||
|
||||
CheckForBase = function(player, buildings)
|
||||
local checked = { }
|
||||
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
|
||||
CheckForBase = function(player)
|
||||
local buildings = 0
|
||||
|
||||
local found = false
|
||||
for i = 1, #buildings, 1 do
|
||||
if actor.Type == buildings[i] then
|
||||
found = true
|
||||
checked[#checked + 1] = actor
|
||||
end
|
||||
Utils.Do(NodBaseBuildings, function(name)
|
||||
if #player.GetActorsByType(name) > 0 then
|
||||
buildings = buildings + 1
|
||||
end
|
||||
return found
|
||||
end)
|
||||
return #baseBuildings >= 3
|
||||
|
||||
return buildings == #NodBaseBuildings
|
||||
end
|
||||
|
||||
OnAnyDamaged = function(actors, func)
|
||||
|
||||
@@ -270,10 +270,8 @@ IdleHunt = function(unit)
|
||||
end
|
||||
|
||||
CheckForSams = function(player)
|
||||
local baseBuildings = Map.ActorsInBox(Map.TopLeft, Map.BottomRight, function(actor)
|
||||
return actor.Owner == Nod and actor.Type == 'sam' end)
|
||||
|
||||
return #baseBuildings >= 3
|
||||
local sams = Nod.GetActorsByType("sam")
|
||||
return #sams >= 3
|
||||
end
|
||||
|
||||
checkProduction = function(player)
|
||||
|
||||
@@ -245,7 +245,7 @@ InitTriggers = function()
|
||||
player.MarkCompletedObjective(FreePrisoners)
|
||||
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()
|
||||
player.MarkCompletedObjective(KillUSSR)
|
||||
|
||||
@@ -439,16 +439,16 @@ Actors:
|
||||
Owner: USSR
|
||||
Actor127: v19
|
||||
Location: 70,56
|
||||
Owner: Neutral
|
||||
Owner: USSR
|
||||
Actor128: v19
|
||||
Location: 70,54
|
||||
Owner: Neutral
|
||||
Owner: USSR
|
||||
Actor129: v19
|
||||
Location: 72,54
|
||||
Owner: Neutral
|
||||
Owner: USSR
|
||||
Actor130: v19
|
||||
Location: 74,54
|
||||
Owner: Neutral
|
||||
Owner: USSR
|
||||
Actor131: brl3
|
||||
Location: 84,65
|
||||
Owner: USSR
|
||||
@@ -457,7 +457,7 @@ Actors:
|
||||
Owner: USSR
|
||||
Actor133: v19
|
||||
Location: 83,65
|
||||
Owner: Neutral
|
||||
Owner: USSR
|
||||
Actor134: barl
|
||||
Location: 78,70
|
||||
Owner: USSR
|
||||
@@ -487,16 +487,16 @@ Actors:
|
||||
Owner: USSR
|
||||
Actor142: v19
|
||||
Location: 87,66
|
||||
Owner: Neutral
|
||||
Owner: USSR
|
||||
Actor143: v19
|
||||
Location: 85,68
|
||||
Owner: Neutral
|
||||
Owner: USSR
|
||||
Actor144: v19
|
||||
Location: 82,66
|
||||
Owner: Neutral
|
||||
Owner: USSR
|
||||
Actor145: v19
|
||||
Location: 85,63
|
||||
Owner: Neutral
|
||||
Owner: USSR
|
||||
Actor146: v04
|
||||
Location: 54,52
|
||||
Owner: Neutral
|
||||
@@ -523,10 +523,10 @@ Actors:
|
||||
Owner: USSR
|
||||
Actor154: v19
|
||||
Location: 59,61
|
||||
Owner: Neutral
|
||||
Owner: USSR
|
||||
Actor155: v19
|
||||
Location: 57,61
|
||||
Owner: Neutral
|
||||
Owner: USSR
|
||||
Actor156: brl3
|
||||
Location: 58,61
|
||||
Owner: USSR
|
||||
@@ -559,7 +559,7 @@ Actors:
|
||||
Owner: USSR
|
||||
Actor170: v19
|
||||
Location: 54,68
|
||||
Owner: Neutral
|
||||
Owner: USSR
|
||||
Actor179: brl3
|
||||
Location: 77,66
|
||||
Owner: USSR
|
||||
@@ -631,7 +631,7 @@ Actors:
|
||||
Owner: USSR
|
||||
Actor202: v19
|
||||
Location: 101,48
|
||||
Owner: Neutral
|
||||
Owner: USSR
|
||||
Actor203: brl3
|
||||
Location: 96,50
|
||||
Owner: USSR
|
||||
@@ -652,13 +652,13 @@ Actors:
|
||||
Owner: USSR
|
||||
Actor209: v19
|
||||
Location: 102,67
|
||||
Owner: Neutral
|
||||
Owner: USSR
|
||||
Actor210: v19
|
||||
Location: 101,69
|
||||
Owner: Neutral
|
||||
Owner: USSR
|
||||
Actor211: v19
|
||||
Location: 100,71
|
||||
Owner: Neutral
|
||||
Owner: USSR
|
||||
Actor212: brl3
|
||||
Location: 102,66
|
||||
Owner: USSR
|
||||
@@ -718,7 +718,7 @@ Actors:
|
||||
Owner: USSR
|
||||
Actor232: v19
|
||||
Location: 91,68
|
||||
Owner: Neutral
|
||||
Owner: USSR
|
||||
Actor233: brl3
|
||||
Location: 91,69
|
||||
Owner: USSR
|
||||
@@ -727,13 +727,13 @@ Actors:
|
||||
Owner: USSR
|
||||
Actor234: v19
|
||||
Location: 84,51
|
||||
Owner: Neutral
|
||||
Owner: USSR
|
||||
Actor235: v19
|
||||
Location: 87,51
|
||||
Owner: Neutral
|
||||
Owner: USSR
|
||||
Actor236: v19
|
||||
Location: 86,52
|
||||
Owner: Neutral
|
||||
Owner: USSR
|
||||
Actor237: brl3
|
||||
Location: 84,52
|
||||
Owner: USSR
|
||||
|
||||
Reference in New Issue
Block a user