Merge pull request #11065 from abcdefg30/luaMapActors
Add a lua method for querying all actors that are currently InWorld
This commit is contained in:
@@ -21,10 +21,13 @@ namespace OpenRA.Mods.Common.Scripting
|
|||||||
public class MapGlobal : ScriptGlobal
|
public class MapGlobal : ScriptGlobal
|
||||||
{
|
{
|
||||||
readonly SpawnMapActors sma;
|
readonly SpawnMapActors sma;
|
||||||
|
readonly World world;
|
||||||
|
|
||||||
public MapGlobal(ScriptContext context)
|
public MapGlobal(ScriptContext context)
|
||||||
: base(context)
|
: base(context)
|
||||||
{
|
{
|
||||||
sma = context.World.WorldActor.Trait<SpawnMapActors>();
|
sma = context.World.WorldActor.Trait<SpawnMapActors>();
|
||||||
|
world = context.World;
|
||||||
|
|
||||||
// Register map actors as globals (yuck!)
|
// Register map actors as globals (yuck!)
|
||||||
foreach (var kv in sma.Actors)
|
foreach (var kv in sma.Actors)
|
||||||
@@ -133,5 +136,8 @@ namespace OpenRA.Mods.Common.Scripting
|
|||||||
{
|
{
|
||||||
return Context.World.ActorsHavingTrait<ScriptTags>(t => t.HasTag(tag)).ToArray();
|
return Context.World.ActorsHavingTrait<ScriptTags>(t => t.HasTag(tag)).ToArray();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Desc("Returns a table of all the actors that are currently on the map/in the world.")]
|
||||||
|
public Actor[] ActorsInWorld { get { return world.Actors.ToArray(); } }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,6 +9,7 @@
|
|||||||
*/
|
*/
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
using System.Collections;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using Eluant;
|
using Eluant;
|
||||||
using OpenRA.Scripting;
|
using OpenRA.Scripting;
|
||||||
@@ -54,6 +55,20 @@ namespace OpenRA.Mods.Common.Scripting
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Desc("Returns the original collection filtered with the func.")]
|
||||||
|
public LuaTable Where(LuaValue[] collection, LuaFunction func)
|
||||||
|
{
|
||||||
|
var t = Context.CreateTable();
|
||||||
|
|
||||||
|
foreach (var c in collection)
|
||||||
|
using (var ret = func.Call(c))
|
||||||
|
using (var result = ret.FirstOrDefault())
|
||||||
|
if (result != null && result.ToBoolean())
|
||||||
|
t.Add(t.Count + 1, c);
|
||||||
|
|
||||||
|
return t;
|
||||||
|
}
|
||||||
|
|
||||||
[Desc("Returns the first n values from a collection.")]
|
[Desc("Returns the first n values from a collection.")]
|
||||||
public LuaValue[] Take(int n, LuaValue[] source)
|
public LuaValue[] Take(int n, LuaValue[] source)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ getActors = function(owner, units)
|
|||||||
local maxUnits = 0
|
local maxUnits = 0
|
||||||
local actors = { }
|
local actors = { }
|
||||||
for type, count in pairs(units) do
|
for type, count in pairs(units) do
|
||||||
local globalActors = Map.ActorsInBox(Map.TopLeft, Map.BottomRight, function(actor)
|
local globalActors = Utils.Where(Map.ActorsInWorld, function(actor)
|
||||||
return actor.Owner == owner and actor.Type == type and not actor.IsDead
|
return actor.Owner == owner and actor.Type == type and not actor.IsDead
|
||||||
end)
|
end)
|
||||||
if #globalActors < count then
|
if #globalActors < count then
|
||||||
@@ -234,7 +234,7 @@ Tick = function()
|
|||||||
end
|
end
|
||||||
|
|
||||||
checkProduction = function(player)
|
checkProduction = function(player)
|
||||||
local Units = Map.ActorsInBox(Map.TopLeft, Map.BottomRight, function(actor)
|
local Units = Utils.Where(Map.ActorsInWorld, function(actor)
|
||||||
return actor.Owner == player and actor.Type == UnitToRebuild
|
return actor.Owner == player and actor.Type == UnitToRebuild
|
||||||
end)
|
end)
|
||||||
|
|
||||||
@@ -251,7 +251,7 @@ checkProduction = function(player)
|
|||||||
end
|
end
|
||||||
|
|
||||||
getStartUnits = function()
|
getStartUnits = function()
|
||||||
local Units = Map.ActorsInBox(Map.TopLeft, Map.BottomRight, function(actor)
|
local Units = Utils.Where(Map.ActorsInWorld, function(actor)
|
||||||
return actor.Owner == enemy
|
return actor.Owner == enemy
|
||||||
end)
|
end)
|
||||||
Utils.Do(Units, function(unit)
|
Utils.Do(Units, function(unit)
|
||||||
|
|||||||
@@ -180,7 +180,7 @@ getActors = function(owner, units)
|
|||||||
local maxUnits = 0
|
local maxUnits = 0
|
||||||
local actors = { }
|
local actors = { }
|
||||||
for type, count in pairs(units) do
|
for type, count in pairs(units) do
|
||||||
local globalActors = Map.ActorsInBox(Map.TopLeft, Map.BottomRight, function(actor)
|
local globalActors = Utils.Where(Map.ActorsInWorld, function(actor)
|
||||||
return actor.Owner == owner and actor.Type == type and not actor.IsDead
|
return actor.Owner == owner and actor.Type == type and not actor.IsDead
|
||||||
end)
|
end)
|
||||||
if #globalActors < count then
|
if #globalActors < count then
|
||||||
@@ -196,7 +196,7 @@ getActors = function(owner, units)
|
|||||||
end
|
end
|
||||||
|
|
||||||
checkProduction = function(player)
|
checkProduction = function(player)
|
||||||
local Units = Map.ActorsInBox(Map.TopLeft, Map.BottomRight, function(actor)
|
local Units = Utils.Where(Map.ActorsInWorld, function(actor)
|
||||||
return actor.Owner == player and actor.Type == UnitToRebuild
|
return actor.Owner == player and actor.Type == UnitToRebuild
|
||||||
end)
|
end)
|
||||||
|
|
||||||
@@ -213,7 +213,7 @@ checkProduction = function(player)
|
|||||||
end
|
end
|
||||||
|
|
||||||
getStartUnits = function()
|
getStartUnits = function()
|
||||||
local Units = Map.ActorsInBox(Map.TopLeft, Map.BottomRight, function(actor)
|
local Units = Utils.Where(Map.ActorsInWorld, function(actor)
|
||||||
return actor.Owner == enemy
|
return actor.Owner == enemy
|
||||||
end)
|
end)
|
||||||
Utils.Do(Units, function(unit)
|
Utils.Do(Units, function(unit)
|
||||||
|
|||||||
@@ -275,7 +275,7 @@ CheckForSams = function(player)
|
|||||||
end
|
end
|
||||||
|
|
||||||
checkProduction = function(player)
|
checkProduction = function(player)
|
||||||
local Units = Map.ActorsInBox(Map.TopLeft, Map.BottomRight, function(actor)
|
local Units = Utils.Where(Map.ActorsInWorld, function(actor)
|
||||||
return actor.Owner == enemy
|
return actor.Owner == enemy
|
||||||
end)
|
end)
|
||||||
|
|
||||||
@@ -304,7 +304,7 @@ checkProduction = function(player)
|
|||||||
end
|
end
|
||||||
|
|
||||||
getStartUnits = function()
|
getStartUnits = function()
|
||||||
local Units = Map.ActorsInBox(Map.TopLeft, Map.BottomRight, function(actor)
|
local Units = Utils.Where(Map.ActorsInWorld, function(actor)
|
||||||
return actor.Owner == enemy and ( actor.Type == 'e2' or actor.Type == 'e1' or actor.Type == 'jeep' or actor.Type == 'mtnk')
|
return actor.Owner == enemy and ( actor.Type == 'e2' or actor.Type == 'e1' or actor.Type == 'jeep' or actor.Type == 'mtnk')
|
||||||
end)
|
end)
|
||||||
Utils.Do(Units, function(unit)
|
Utils.Do(Units, function(unit)
|
||||||
|
|||||||
@@ -88,9 +88,7 @@ WorldLoaded = function()
|
|||||||
InitObjectives()
|
InitObjectives()
|
||||||
|
|
||||||
Trigger.OnRemovedFromWorld(AtreidesConyard, function()
|
Trigger.OnRemovedFromWorld(AtreidesConyard, function()
|
||||||
local refs = Map.ActorsInBox(Map.TopLeft, Map.BottomRight, function(actor)
|
local refs = Utils.Where(Map.ActorsInWorld, function(actor) return actor.Type == "refinery" end)
|
||||||
return actor.Type == "refinery"
|
|
||||||
end)
|
|
||||||
|
|
||||||
if #refs == 0 then
|
if #refs == 0 then
|
||||||
harkonnen.MarkCompletedObjective(KillAtreides)
|
harkonnen.MarkCompletedObjective(KillAtreides)
|
||||||
|
|||||||
@@ -88,9 +88,7 @@ WorldLoaded = function()
|
|||||||
InitObjectives()
|
InitObjectives()
|
||||||
|
|
||||||
Trigger.OnRemovedFromWorld(AtreidesConyard, function()
|
Trigger.OnRemovedFromWorld(AtreidesConyard, function()
|
||||||
local refs = Map.ActorsInBox(Map.TopLeft, Map.BottomRight, function(actor)
|
local refs = Utils.Where(Map.ActorsInWorld, function(actor) return actor.Type == "refinery" end)
|
||||||
return actor.Type == "refinery"
|
|
||||||
end)
|
|
||||||
|
|
||||||
if #refs == 0 then
|
if #refs == 0 then
|
||||||
harkonnen.MarkCompletedObjective(KillAtreides)
|
harkonnen.MarkCompletedObjective(KillAtreides)
|
||||||
|
|||||||
@@ -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)
|
||||||
|
|||||||
@@ -226,11 +226,6 @@ ActivatePatrols = function()
|
|||||||
GroupPatrol(PatrolA, PatrolAPath, DateTime.Seconds(7))
|
GroupPatrol(PatrolA, PatrolAPath, DateTime.Seconds(7))
|
||||||
GroupPatrol(PatrolB, PatrolBPath, DateTime.Seconds(6))
|
GroupPatrol(PatrolB, PatrolBPath, DateTime.Seconds(6))
|
||||||
end)
|
end)
|
||||||
|
|
||||||
local units = Map.ActorsInBox(Map.TopLeft, Map.BottomRight, function(self) return self.Owner == soviets and self.HasProperty("AutoTarget") end)
|
|
||||||
Utils.Do(units, function(unit)
|
|
||||||
unit.Stance = "Defend"
|
|
||||||
end)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
InitTriggers = function()
|
InitTriggers = function()
|
||||||
|
|||||||
@@ -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
|
||||||
|
|||||||
@@ -581,9 +581,6 @@ Actors:
|
|||||||
ReinfRoadPoint: waypoint
|
ReinfRoadPoint: waypoint
|
||||||
Location: 52,42
|
Location: 52,42
|
||||||
Owner: Neutral
|
Owner: Neutral
|
||||||
NWIdlePoint: waypoint
|
|
||||||
Location: 38,42
|
|
||||||
Owner: Neutral
|
|
||||||
EIslandPoint: waypoint
|
EIslandPoint: waypoint
|
||||||
Location: 51,58
|
Location: 51,58
|
||||||
Owner: Neutral
|
Owner: Neutral
|
||||||
|
|||||||
@@ -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
|
||||||
@@ -386,11 +386,6 @@ SetupSoviets = function()
|
|||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
end)
|
end)
|
||||||
|
|
||||||
local units = Map.ActorsInBox(Map.TopLeft, Map.BottomRight, function(self) return self.Owner == soviets and self.HasProperty("AutoTarget") end)
|
|
||||||
Utils.Do(units, function(unit)
|
|
||||||
unit.Stance = "Defend"
|
|
||||||
end)
|
|
||||||
end)
|
end)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user