Kill the allied players if they fail the mission. Also fail the mission if the Allies2 player loses all of their buildings.

This commit is contained in:
Scott_NZ
2012-08-14 00:03:23 +12:00
parent 245de3abcb
commit cce12e781f
2 changed files with 14 additions and 2 deletions

View File

@@ -27,7 +27,7 @@ namespace OpenRA.Mods.RA.Missions
{
static readonly string[] objectives =
{
"Destroy the SAM sites. Tanya and Einstein must survive.",
"Hold off the Soviet forces and destroy the SAM sites. Tanya and Einstein must survive.",
"Wait for the helicopter and extract Einstein. Tanya and Einstein must survive."
};
@@ -92,6 +92,10 @@ namespace OpenRA.Mods.RA.Missions
{
reinforcementsTimer.Visible = false;
}
foreach (var actor in world.Actors.Where(a => a.IsInWorld && (a.Owner == allies1 || a.Owner == allies2) && !a.IsDead()))
{
actor.Kill(actor);
}
Game.AddChatLine(Color.Red, "Mission failed", text);
Sound.Play("misnlst1.aud");
}
@@ -129,6 +133,10 @@ namespace OpenRA.Mods.RA.Missions
{
BuildSovietUnits();
}
if (!world.Actors.Any(a => a.IsInWorld && a.HasTrait<Building>() && a.Owner == allies2))
{
MissionFailed("The Allied reinforcements have been defeated.");
}
if (!engineerMiss.Destroyed && engineer == null && AlliesControlMiss())
{
SpawnEngineerAtMiss();
@@ -265,7 +273,7 @@ namespace OpenRA.Mods.RA.Missions
void SpawnEngineerAtMiss()
{
engineer = world.CreateActor(EngineerName, new TypeDictionary {new OwnerInit(allies1), new LocationInit(engineerMiss.Location)});
engineer = world.CreateActor(EngineerName, new TypeDictionary { new OwnerInit(allies1), new LocationInit(engineerMiss.Location) });
engineer.QueueActivity(new Move.Move(engineerMiss.Location + new CVec(5, 0)));
}