diff --git a/mods/ra/maps/allies-03a/allies03a.lua b/mods/ra/maps/allies-03a/allies03a.lua index b4603ad71a..6bbfe58b0c 100644 --- a/mods/ra/maps/allies-03a/allies03a.lua +++ b/mods/ra/maps/allies-03a/allies03a.lua @@ -145,11 +145,12 @@ InitTriggers = function() end) Trigger.OnKilled(ExplosiveBarrel, function() - local bridge = Map.ActorsInBox(USSRReinforcementsCameraWaypoint.CenterPosition, USSRReinforcementsEntryWaypoint.CenterPosition, - function(self) return self.Type == "bridge1" end) - if not bridge[1].IsDead then - bridge[1].Kill() + -- We need the first bridge which is returned + local bridge = Utils.Where(Map.ActorsInWorld, function(actor) return actor.Type == "bridge1" end)[1] + + if not bridge.IsDead then + bridge.Kill() end end) @@ -237,7 +238,7 @@ InitTriggers = function() end) Trigger.AfterDelay(0, function() - local bridges = Map.ActorsInBox(Map.TopLeft, Map.BottomRight, function(self) return self.Type == "bridge1" end) + local bridges = Utils.Where(Map.ActorsInWorld, function(actor) return actor.Type == "bridge1" end) Trigger.OnAllKilled(bridges, function() player.MarkCompletedObjective(KillBridges) diff --git a/mods/ra/maps/allies-03b/allies03b.lua b/mods/ra/maps/allies-03b/allies03b.lua index 65650f60c2..53d1396dee 100644 --- a/mods/ra/maps/allies-03b/allies03b.lua +++ b/mods/ra/maps/allies-03b/allies03b.lua @@ -348,7 +348,7 @@ InitTriggers = function() end) Trigger.AfterDelay(0, function() - local bridges = Map.ActorsInBox(Map.TopLeft, Map.BottomRight, function(self) return self.Type == "bridge1" or self.Type == "bridge2" end) + local bridges = Utils.Where(Map.ActorsInWorld, function(actor) return actor.Type == "bridge1" or actor.Type == "bridge2" end) ExplodingBridge = bridges[1] Trigger.OnAllKilled(bridges, function() diff --git a/mods/ra/maps/allies-05a/allies05a-AI.lua b/mods/ra/maps/allies-05a/allies05a-AI.lua index 8f71aa4e02..2244404ed0 100644 --- a/mods/ra/maps/allies-05a/allies05a-AI.lua +++ b/mods/ra/maps/allies-05a/allies05a-AI.lua @@ -105,9 +105,9 @@ ProtectHarvester = function(unit) end InitAIUnits = function() - IdlingUnits = Map.ActorsInBox(MainBaseTopLeft.CenterPosition, Map.BottomRight, function(self) return self.Owner == ussr and self.HasProperty("Hunt") end) + IdlingUnits = Utils.Where(Map.ActorsInWorld, function(self) return self.Owner == ussr and self.HasProperty("Hunt") and self.Location.Y > MainBaseTopLeft.Location.Y end) - local buildings = Map.ActorsInBox(MainBaseTopLeft.CenterPosition, Map.BottomRight, function(self) return self.Owner == ussr and self.HasProperty("StartBuildingRepairs") end) + local buildings = Utils.Where(Map.ActorsInWorld, function(self) return self.Owner == ussr and self.HasProperty("StartBuildingRepairs") end) Utils.Do(buildings, function(actor) Trigger.OnDamaged(actor, function(building) if building.Owner == ussr and building.Health < building.MaxHealth * 3/4 then @@ -255,7 +255,7 @@ ProduceAircraft = function() Trigger.OnIdle(units[1], function() if not target or target.IsDead or (not target.IsInWorld) then - local enemies = Map.ActorsInBox(Map.TopLeft, Map.BottomRight, function(self) return self.Owner == greece and self.HasProperty("Health") end) + local enemies = Utils.Where(Map.ActorsInWorld, function(self) return self.Owner == greece and self.HasProperty("Health") end) if #enemies > 0 then target = Utils.Random(enemies) units[1].Attack(target) diff --git a/mods/ra/maps/monster-tank-madness/monster-tank-madness.lua b/mods/ra/maps/monster-tank-madness/monster-tank-madness.lua index 74fd14a786..298b9cf814 100644 --- a/mods/ra/maps/monster-tank-madness/monster-tank-madness.lua +++ b/mods/ra/maps/monster-tank-madness/monster-tank-madness.lua @@ -168,9 +168,7 @@ SuperTankDomeInfiltrated = function() end SuperTanksDestruction = function() - local badGuys = Map.ActorsInBox(Map.TopLeft, Map.BottomRight, - function(self) return self.Owner == badguy and self.HasProperty("Health") end) - + local badGuys = Utils.Where(Map.ActorsInWorld, function(self) return self.Owner == badguy and self.HasProperty("Health") end) Utils.Do(badGuys, function(unit) unit.Kill() end) diff --git a/mods/ra/maps/soviet-02a/soviet02a.lua b/mods/ra/maps/soviet-02a/soviet02a.lua index 01e5b9d2a7..a4a01694a9 100644 --- a/mods/ra/maps/soviet-02a/soviet02a.lua +++ b/mods/ra/maps/soviet-02a/soviet02a.lua @@ -36,7 +36,7 @@ WorldLoaded = function() end) Trigger.AfterDelay(0, function() - local buildings = Map.ActorsInBox(Map.TopLeft, Map.BottomRight, function(self) return self.Owner == germany and self.HasProperty("StartBuildingRepairs") end) + local buildings = Utils.Where(Map.ActorsInWorld, function(self) return self.Owner == germany and self.HasProperty("StartBuildingRepairs") end) Utils.Do(buildings, function(actor) Trigger.OnDamaged(actor, function(building, attacker) if building.Owner == germany and building.Health < building.MaxHealth * 0.8 then diff --git a/mods/ra/maps/soviet-02b/soviet02b.lua b/mods/ra/maps/soviet-02b/soviet02b.lua index ef93fa84ba..2e4a101c98 100644 --- a/mods/ra/maps/soviet-02b/soviet02b.lua +++ b/mods/ra/maps/soviet-02b/soviet02b.lua @@ -128,7 +128,7 @@ WorldLoaded = function() end end) Trigger.AfterDelay(0, function() - local buildings = Map.ActorsInBox(Map.TopLeft, Map.BottomRight, function(self) return self.Owner == enemy and self.HasProperty("StartBuildingRepairs") end) + local buildings = Utils.Where(Map.ActorsInWorld, function(self) return self.Owner == enemy and self.HasProperty("StartBuildingRepairs") end) Utils.Do(buildings, function(actor) Trigger.OnDamaged(actor, function(building, attacker) if building.Owner == enemy and building.Health < building.MaxHealth * 0.8 then diff --git a/mods/ra/maps/soviet-05/soviet05-AI.lua b/mods/ra/maps/soviet-05/soviet05-AI.lua index f41f3cc86e..dcc617b496 100644 --- a/mods/ra/maps/soviet-05/soviet05-AI.lua +++ b/mods/ra/maps/soviet-05/soviet05-AI.lua @@ -1,7 +1,7 @@ IdleHunt = function(unit) if not unit.IsDead then Trigger.OnIdle(unit, unit.Hunt) end end IdlingUnits = function() - local lazyUnits = Map.ActorsInBox(NWIdlePoint.CenterPosition, Map.BottomRight, function(actor) + local lazyUnits = Utils.Where(Map.ActorsInWorld, function(actor) return actor.HasProperty("Hunt") and (actor.Owner == GoodGuy or actor.Owner == Greece) end) Utils.Do(lazyUnits, function(unit) @@ -12,7 +12,8 @@ IdlingUnits = function() end) end -BaseBuildings = { +BaseBuildings = +{ { type = "powr", pos = CVec.New(3, -2), cost = 300 }, { type = "tent", pos = CVec.New(0, 4), cost = 400 }, { type = "hbox", pos = CVec.New(3, 6), cost = 600 }, diff --git a/mods/ra/maps/soviet-05/soviet05.lua b/mods/ra/maps/soviet-05/soviet05.lua index a0a6533d86..5f5acb14ee 100644 --- a/mods/ra/maps/soviet-05/soviet05.lua +++ b/mods/ra/maps/soviet-05/soviet05.lua @@ -15,11 +15,7 @@ CheckForCYard = function() end CheckForSPen = function() - SPens = Map.ActorsInBox(Map.TopLeft, Map.BottomRight, function(actor) - return actor.Type == "spen" - end) - - return #SPens >=1 + return Utils.Any(Map.ActorsInWorld, function(actor) return actor.Type == "spen" end) end RunInitialActivities = function() @@ -36,7 +32,7 @@ RunInitialActivities = function() IdlingUnits() Media.PlaySpeechNotification(player, "ReinforcementsArrived") - local buildings = Map.ActorsInBox(NWIdlePoint.CenterPosition, Map.BottomRight, function(self) return self.Owner == Greece and self.HasProperty("StartBuildingRepairs") end) + local buildings = Utils.Where(Map.ActorsInWorld, function(self) return self.Owner == Greece and self.HasProperty("StartBuildingRepairs") end) Utils.Do(buildings, function(actor) Trigger.OnDamaged(actor, function(building) if building.Owner == Greece and building.Health < building.MaxHealth * 3/4 then diff --git a/mods/ra/maps/survival01/survival01.lua b/mods/ra/maps/survival01/survival01.lua index 9c4cf41b0f..104dce037d 100644 --- a/mods/ra/maps/survival01/survival01.lua +++ b/mods/ra/maps/survival01/survival01.lua @@ -382,7 +382,7 @@ SetupSoviets = function() end) Trigger.AfterDelay(0, function() - local buildings = Map.ActorsInBox(Map.TopLeft, Map.BottomRight, function(self) return self.Owner == soviets and self.HasProperty("StartBuildingRepairs") end) + local buildings = Utils.Where(Map.ActorsInWorld, function(self) return self.Owner == soviets and self.HasProperty("StartBuildingRepairs") end) Utils.Do(buildings, function(actor) Trigger.OnDamaged(actor, function(building) if building.Owner == soviets and building.Health < building.MaxHealth * DamageModifier then diff --git a/mods/ra/maps/survival02/survival02.lua b/mods/ra/maps/survival02/survival02.lua index 87bcfb7431..df5413c30d 100644 --- a/mods/ra/maps/survival02/survival02.lua +++ b/mods/ra/maps/survival02/survival02.lua @@ -378,7 +378,7 @@ SetupSoviets = function() end) Trigger.AfterDelay(0, function() - local buildings = Map.ActorsInBox(Map.TopLeft, Map.BottomRight, function(self) return self.Owner == soviets and self.HasProperty("StartBuildingRepairs") end) + local buildings = Utils.Where(Map.ActorsInWorld, function(self) return self.Owner == soviets and self.HasProperty("StartBuildingRepairs") end) Utils.Do(buildings, function(actor) Trigger.OnDamaged(actor, function(building) if building.Owner == soviets and building.Health < building.MaxHealth * 3/4 then