diff --git a/OpenRA.Mods.RA/Missions/Allies04Script.cs b/OpenRA.Mods.RA/Missions/Allies04Script.cs index 6249efa8c9..8131cbcb1c 100644 --- a/OpenRA.Mods.RA/Missions/Allies04Script.cs +++ b/OpenRA.Mods.RA/Missions/Allies04Script.cs @@ -92,6 +92,11 @@ namespace OpenRA.Mods.RA.Missions Actor bridge; bool attackingBridge; + bool attackingTown = true; + Actor townTopLeft; + Actor townBottomRight; + IEnumerable townAttackers; + void MissionFailed(string text) { MissionUtils.CoopMissionFailed(world, text, allies1, allies2); @@ -144,6 +149,26 @@ namespace OpenRA.Mods.RA.Missions } } + if (attackingTown) + { + Game.Debug(townAttackers.Count().ToString()); + foreach (var attacker in townAttackers.Where(a => a.IsIdle && !a.IsDead() && a.IsInWorld)) + { + Game.Debug("foo " + attacker); + var enemies = world.Actors.Where(u => u.Owner == neutral + && ((u.HasTrait() && !u.HasTrait()) || u.HasTrait()) && u.IsInWorld && !u.IsDead()); + + var enemy = enemies.OrderBy(u => (self.CenterLocation - u.CenterLocation).LengthSquared).FirstOrDefault(); + if (enemy != null) + attacker.QueueActivity(new AttackMove.AttackMoveActivity(attacker, new Attack(Target.FromActor(enemy), 3))); + else + { + attackingTown = false; + break; + } + } + } + foreach (var patrol in patrols) patrol.DoPatrol(); @@ -159,7 +184,6 @@ namespace OpenRA.Mods.RA.Missions } else if (lab.Destroyed) MissionFailed("The Soviet research laboratory was destroyed."); - else if (!world.Actors.Any(a => (a.Owner == allies1 || a.Owner == allies2) && !a.IsDead() && (a.HasTrait() && !a.HasTrait()) || a.HasTrait())) { @@ -426,6 +450,12 @@ namespace OpenRA.Mods.RA.Missions .OrderBy(a => (a.Location - bridgeAttackPoint.Location).LengthSquared) .FirstOrDefault(); + townTopLeft = actors["TownTopLeft"]; + townBottomRight = actors["TownBottomRight"]; + Game.Debug(world.FindAliveCombatantActorsInBox(townTopLeft.CenterLocation, townBottomRight.CenterLocation).JoinWith(",")); + townAttackers = world.FindAliveCombatantActorsInBox(townTopLeft.CenterLocation, townBottomRight.CenterLocation) + .Where(a => a.Owner == soviets && a.HasTrait() && a.HasTrait()).ToArray(); + OnObjectivesUpdated(false); SetupSubStances(); diff --git a/mods/ra/maps/allies-04/map.yaml b/mods/ra/maps/allies-04/map.yaml index 037444c22d..543de2083c 100644 --- a/mods/ra/maps/allies-04/map.yaml +++ b/mods/ra/maps/allies-04/map.yaml @@ -479,9 +479,9 @@ Actors: Actor12: sam Location: 34,27 Owner: Soviets - Actor143: e1 - Location: 61,98 - Owner: Soviets + Actor297: v08 + Location: 68,95 + Owner: Neutral Actor142: fenc Location: 91,16 Owner: Soviets @@ -941,8 +941,8 @@ Actors: PatrolPoint22: waypoint Location: 92,49 Owner: Neutral - Actor297: v08 - Location: 72,78 + Actor515: wood + Location: 66,100 Owner: Neutral Actor298: t01 Location: 90,61 @@ -1088,8 +1088,8 @@ Actors: Actor347: v17 Location: 61,97 Owner: Neutral - Actor348: v03 - Location: 60,95 + Actor348: v06 + Location: 60,96 Owner: Neutral Actor349: v14 Location: 66,83 @@ -1166,8 +1166,8 @@ Actors: Actor373: tc03 Location: 94,100 Owner: Neutral - Actor374: v07 - Location: 76,77 + Actor374: wood + Location: 67,100 Owner: Neutral Actor375: e1 Location: 89,47 @@ -1730,6 +1730,60 @@ Actors: PatrolPoint34: waypoint Location: 92,70 Owner: Neutral + Actor516: wood + Location: 65,100 + Owner: Neutral + Actor143: v11 + Location: 72,95 + Owner: Neutral + Actor517: wood + Location: 64,100 + Owner: Neutral + Actor518: wood + Location: 63,100 + Owner: Neutral + Actor519: wood + Location: 63,99 + Owner: Neutral + Actor520: wood + Location: 63,98 + Owner: Neutral + Actor521: v18 + Location: 59,96 + Owner: Neutral + Actor522: e4 + Location: 70,97 + Owner: Soviets + Actor523: e4 + Location: 70,91 + Owner: Soviets + Actor524: e4 + Location: 70,82 + Owner: Soviets + Actor525: e1 + Location: 70,87 + Owner: Soviets + Actor526: e1 + Location: 70,93 + Owner: Soviets + Actor528: e2 + Location: 74,87 + Owner: Soviets + Actor527: e2 + Location: 73,97 + Owner: Soviets + TownBottomLeft: waypoint + Location: 53,98 + Owner: Neutral + TownBottomRight: waypoint + Location: 75,98 + Owner: Neutral + TownTopRight: waypoint + Location: 75,80 + Owner: Neutral + TownTopLeft: waypoint + Location: 53,80 + Owner: Neutral Smudges: