Replace abused Map.ActorsInBox calls by Map.ActorsInWorld in all ra missions
This commit is contained in:
@@ -145,11 +145,12 @@ InitTriggers = function()
|
|||||||
end)
|
end)
|
||||||
|
|
||||||
Trigger.OnKilled(ExplosiveBarrel, function()
|
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
|
-- We need the first bridge which is returned
|
||||||
bridge[1].Kill()
|
local bridge = Utils.Where(Map.ActorsInWorld, function(actor) return actor.Type == "bridge1" end)[1]
|
||||||
|
|
||||||
|
if not bridge.IsDead then
|
||||||
|
bridge.Kill()
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
|
|
||||||
@@ -237,7 +238,7 @@ InitTriggers = function()
|
|||||||
end)
|
end)
|
||||||
|
|
||||||
Trigger.AfterDelay(0, function()
|
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()
|
Trigger.OnAllKilled(bridges, function()
|
||||||
player.MarkCompletedObjective(KillBridges)
|
player.MarkCompletedObjective(KillBridges)
|
||||||
|
|||||||
@@ -348,7 +348,7 @@ InitTriggers = function()
|
|||||||
end)
|
end)
|
||||||
|
|
||||||
Trigger.AfterDelay(0, function()
|
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]
|
ExplodingBridge = bridges[1]
|
||||||
|
|
||||||
Trigger.OnAllKilled(bridges, function()
|
Trigger.OnAllKilled(bridges, function()
|
||||||
|
|||||||
@@ -105,9 +105,9 @@ ProtectHarvester = function(unit)
|
|||||||
end
|
end
|
||||||
|
|
||||||
InitAIUnits = function()
|
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)
|
Utils.Do(buildings, function(actor)
|
||||||
Trigger.OnDamaged(actor, function(building)
|
Trigger.OnDamaged(actor, function(building)
|
||||||
if building.Owner == ussr and building.Health < building.MaxHealth * 3/4 then
|
if building.Owner == ussr and building.Health < building.MaxHealth * 3/4 then
|
||||||
@@ -255,7 +255,7 @@ ProduceAircraft = function()
|
|||||||
Trigger.OnIdle(units[1], function()
|
Trigger.OnIdle(units[1], function()
|
||||||
if not target or target.IsDead or (not target.IsInWorld) then
|
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
|
if #enemies > 0 then
|
||||||
target = Utils.Random(enemies)
|
target = Utils.Random(enemies)
|
||||||
units[1].Attack(target)
|
units[1].Attack(target)
|
||||||
|
|||||||
@@ -168,9 +168,7 @@ SuperTankDomeInfiltrated = function()
|
|||||||
end
|
end
|
||||||
|
|
||||||
SuperTanksDestruction = function()
|
SuperTanksDestruction = function()
|
||||||
local badGuys = Map.ActorsInBox(Map.TopLeft, Map.BottomRight,
|
local badGuys = Utils.Where(Map.ActorsInWorld, function(self) return self.Owner == badguy and self.HasProperty("Health") end)
|
||||||
function(self) return self.Owner == badguy and self.HasProperty("Health") end)
|
|
||||||
|
|
||||||
Utils.Do(badGuys, function(unit)
|
Utils.Do(badGuys, function(unit)
|
||||||
unit.Kill()
|
unit.Kill()
|
||||||
end)
|
end)
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ WorldLoaded = function()
|
|||||||
end)
|
end)
|
||||||
|
|
||||||
Trigger.AfterDelay(0, function()
|
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)
|
Utils.Do(buildings, function(actor)
|
||||||
Trigger.OnDamaged(actor, function(building, attacker)
|
Trigger.OnDamaged(actor, function(building, attacker)
|
||||||
if building.Owner == germany and building.Health < building.MaxHealth * 0.8 then
|
if building.Owner == germany and building.Health < building.MaxHealth * 0.8 then
|
||||||
|
|||||||
@@ -128,7 +128,7 @@ WorldLoaded = function()
|
|||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
Trigger.AfterDelay(0, function()
|
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)
|
Utils.Do(buildings, function(actor)
|
||||||
Trigger.OnDamaged(actor, function(building, attacker)
|
Trigger.OnDamaged(actor, function(building, attacker)
|
||||||
if building.Owner == enemy and building.Health < building.MaxHealth * 0.8 then
|
if building.Owner == enemy and building.Health < building.MaxHealth * 0.8 then
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
IdleHunt = function(unit) if not unit.IsDead then Trigger.OnIdle(unit, unit.Hunt) end end
|
IdleHunt = function(unit) if not unit.IsDead then Trigger.OnIdle(unit, unit.Hunt) end end
|
||||||
|
|
||||||
IdlingUnits = function()
|
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)
|
return actor.HasProperty("Hunt") and (actor.Owner == GoodGuy or actor.Owner == Greece) end)
|
||||||
|
|
||||||
Utils.Do(lazyUnits, function(unit)
|
Utils.Do(lazyUnits, function(unit)
|
||||||
@@ -12,7 +12,8 @@ IdlingUnits = function()
|
|||||||
end)
|
end)
|
||||||
end
|
end
|
||||||
|
|
||||||
BaseBuildings = {
|
BaseBuildings =
|
||||||
|
{
|
||||||
{ type = "powr", pos = CVec.New(3, -2), cost = 300 },
|
{ type = "powr", pos = CVec.New(3, -2), cost = 300 },
|
||||||
{ type = "tent", pos = CVec.New(0, 4), cost = 400 },
|
{ type = "tent", pos = CVec.New(0, 4), cost = 400 },
|
||||||
{ type = "hbox", pos = CVec.New(3, 6), cost = 600 },
|
{ type = "hbox", pos = CVec.New(3, 6), cost = 600 },
|
||||||
|
|||||||
@@ -15,11 +15,7 @@ CheckForCYard = function()
|
|||||||
end
|
end
|
||||||
|
|
||||||
CheckForSPen = function()
|
CheckForSPen = function()
|
||||||
SPens = Map.ActorsInBox(Map.TopLeft, Map.BottomRight, function(actor)
|
return Utils.Any(Map.ActorsInWorld, function(actor) return actor.Type == "spen" end)
|
||||||
return actor.Type == "spen"
|
|
||||||
end)
|
|
||||||
|
|
||||||
return #SPens >=1
|
|
||||||
end
|
end
|
||||||
|
|
||||||
RunInitialActivities = function()
|
RunInitialActivities = function()
|
||||||
@@ -36,7 +32,7 @@ RunInitialActivities = function()
|
|||||||
IdlingUnits()
|
IdlingUnits()
|
||||||
Media.PlaySpeechNotification(player, "ReinforcementsArrived")
|
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)
|
Utils.Do(buildings, function(actor)
|
||||||
Trigger.OnDamaged(actor, function(building)
|
Trigger.OnDamaged(actor, function(building)
|
||||||
if building.Owner == Greece and building.Health < building.MaxHealth * 3/4 then
|
if building.Owner == Greece and building.Health < building.MaxHealth * 3/4 then
|
||||||
|
|||||||
@@ -382,7 +382,7 @@ SetupSoviets = function()
|
|||||||
end)
|
end)
|
||||||
|
|
||||||
Trigger.AfterDelay(0, function()
|
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)
|
Utils.Do(buildings, function(actor)
|
||||||
Trigger.OnDamaged(actor, function(building)
|
Trigger.OnDamaged(actor, function(building)
|
||||||
if building.Owner == soviets and building.Health < building.MaxHealth * DamageModifier then
|
if building.Owner == soviets and building.Health < building.MaxHealth * DamageModifier then
|
||||||
|
|||||||
@@ -378,7 +378,7 @@ SetupSoviets = function()
|
|||||||
end)
|
end)
|
||||||
|
|
||||||
Trigger.AfterDelay(0, function()
|
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)
|
Utils.Do(buildings, function(actor)
|
||||||
Trigger.OnDamaged(actor, function(building)
|
Trigger.OnDamaged(actor, function(building)
|
||||||
if building.Owner == soviets and building.Health < building.MaxHealth * 3/4 then
|
if building.Owner == soviets and building.Health < building.MaxHealth * 3/4 then
|
||||||
|
|||||||
Reference in New Issue
Block a user