Update objective code for Einstein helicopter, avoid race condition with checking if allies2 has been killed
This commit is contained in:
@@ -55,9 +55,9 @@ namespace OpenRA.Mods.RA.Missions
|
|||||||
Sound.Play("bleep6.aud");
|
Sound.Play("bleep6.aud");
|
||||||
}
|
}
|
||||||
|
|
||||||
void DisplayHint(string objective)
|
void DisplayHint(string hint)
|
||||||
{
|
{
|
||||||
Game.AddChatLine(Color.Yellow, "Hint", objective);
|
Game.AddChatLine(Color.Yellow, "Hint", hint);
|
||||||
Sound.Play("bleep6.aud");
|
Sound.Play("bleep6.aud");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -163,7 +163,7 @@ namespace OpenRA.Mods.RA.Missions
|
|||||||
MissionFailed("Einstein was killed.");
|
MissionFailed("Einstein was killed.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (MissionUtils.HasFlag(currentObjectives, Allies01Objectives.WaitForHelicopter))
|
if (MissionUtils.HasFlag(currentObjectives, Allies01Objectives.WaitForHelicopter))
|
||||||
{
|
{
|
||||||
if (world.FrameNumber >= currentAttackWaveFrameNumber + 600)
|
if (world.FrameNumber >= currentAttackWaveFrameNumber + 600)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -32,16 +32,21 @@ namespace OpenRA.Mods.RA.Missions
|
|||||||
enum Allies02Objectives
|
enum Allies02Objectives
|
||||||
{
|
{
|
||||||
None = 0,
|
None = 0,
|
||||||
DestroySamSites = 1,
|
FindEinstein = 1,
|
||||||
WaitForHelicopter = 2
|
DestroySamSites = 2,
|
||||||
|
WaitForHelicopter = 4
|
||||||
}
|
}
|
||||||
|
|
||||||
IEnumerable<string> GetObjectiveText()
|
IEnumerable<string> GetObjectiveText()
|
||||||
{
|
{
|
||||||
var objectives = new List<string>();
|
var objectives = new List<string>();
|
||||||
|
if (MissionUtils.HasFlag(currentObjectives, Allies02Objectives.FindEinstein))
|
||||||
|
{
|
||||||
|
objectives.Add("Find Einstein's crashed helicopter. Tanya must survive.");
|
||||||
|
}
|
||||||
if (MissionUtils.HasFlag(currentObjectives, Allies02Objectives.DestroySamSites))
|
if (MissionUtils.HasFlag(currentObjectives, Allies02Objectives.DestroySamSites))
|
||||||
{
|
{
|
||||||
objectives.Add("Hold off the Soviet forces and destroy the SAM sites. Tanya and Einstein must survive.");
|
objectives.Add("Destroy the SAM sites. Tanya must survive.");
|
||||||
}
|
}
|
||||||
if (MissionUtils.HasFlag(currentObjectives, Allies02Objectives.WaitForHelicopter))
|
if (MissionUtils.HasFlag(currentObjectives, Allies02Objectives.WaitForHelicopter))
|
||||||
{
|
{
|
||||||
@@ -50,7 +55,7 @@ namespace OpenRA.Mods.RA.Missions
|
|||||||
return objectives;
|
return objectives;
|
||||||
}
|
}
|
||||||
|
|
||||||
Allies02Objectives currentObjectives = Allies02Objectives.DestroySamSites;
|
Allies02Objectives currentObjectives = Allies02Objectives.FindEinstein | Allies02Objectives.DestroySamSites;
|
||||||
|
|
||||||
void DisplayObjective(string objective)
|
void DisplayObjective(string objective)
|
||||||
{
|
{
|
||||||
@@ -58,9 +63,9 @@ namespace OpenRA.Mods.RA.Missions
|
|||||||
Sound.Play("bleep6.aud");
|
Sound.Play("bleep6.aud");
|
||||||
}
|
}
|
||||||
|
|
||||||
void DisplayHint(string objective)
|
void DisplayHint(string hint)
|
||||||
{
|
{
|
||||||
Game.AddChatLine(Color.Yellow, "Hint", objective);
|
Game.AddChatLine(Color.Yellow, "Hint", hint);
|
||||||
Sound.Play("bleep6.aud");
|
Sound.Play("bleep6.aud");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -126,6 +131,8 @@ namespace OpenRA.Mods.RA.Missions
|
|||||||
static readonly string[] Flamers = { "e4", "e4", "e4", "e4", "e4" };
|
static readonly string[] Flamers = { "e4", "e4", "e4", "e4", "e4" };
|
||||||
const string ApcName = "apc";
|
const string ApcName = "apc";
|
||||||
|
|
||||||
|
const int HintPowerTicks = 1500 * 6;
|
||||||
|
|
||||||
const string ChinookName = "tran";
|
const string ChinookName = "tran";
|
||||||
const string SignalFlareName = "flare";
|
const string SignalFlareName = "flare";
|
||||||
|
|
||||||
@@ -186,6 +193,10 @@ namespace OpenRA.Mods.RA.Missions
|
|||||||
InitializeSovietFactories();
|
InitializeSovietFactories();
|
||||||
StartReinforcementsTimer();
|
StartReinforcementsTimer();
|
||||||
}
|
}
|
||||||
|
if (world.FrameNumber == HintPowerTicks)
|
||||||
|
{
|
||||||
|
DisplayHint("Destroy the Soviet power stations to stop enemy attacks.");
|
||||||
|
}
|
||||||
reinforcementsTimer.Tick();
|
reinforcementsTimer.Tick();
|
||||||
if (world.FrameNumber == ParatroopersTicks)
|
if (world.FrameNumber == ParatroopersTicks)
|
||||||
{
|
{
|
||||||
@@ -205,10 +216,15 @@ namespace OpenRA.Mods.RA.Missions
|
|||||||
BuildSovietUnits();
|
BuildSovietUnits();
|
||||||
ManageSovietUnits();
|
ManageSovietUnits();
|
||||||
}
|
}
|
||||||
if (AlliesNearTown())
|
if (MissionUtils.HasFlag(currentObjectives, Allies02Objectives.FindEinstein))
|
||||||
{
|
{
|
||||||
TransferTownUnitsToAllies();
|
if (AlliesNearTown())
|
||||||
SovietsAttackTown();
|
{
|
||||||
|
currentObjectives = MissionUtils.RemoveFlag(currentObjectives, Allies02Objectives.FindEinstein);
|
||||||
|
DisplayObjectives();
|
||||||
|
TransferTownUnitsToAllies();
|
||||||
|
SovietsAttackTown();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (MissionUtils.HasFlag(currentObjectives, Allies02Objectives.DestroySamSites))
|
if (MissionUtils.HasFlag(currentObjectives, Allies02Objectives.DestroySamSites))
|
||||||
{
|
{
|
||||||
@@ -222,7 +238,7 @@ namespace OpenRA.Mods.RA.Missions
|
|||||||
ExtractEinsteinAtLZ();
|
ExtractEinsteinAtLZ();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (MissionUtils.HasFlag(currentObjectives, Allies02Objectives.WaitForHelicopter) && einsteinChinook != null)
|
if (MissionUtils.HasFlag(currentObjectives, Allies02Objectives.WaitForHelicopter) && einsteinChinook != null)
|
||||||
{
|
{
|
||||||
if (einsteinChinook.Destroyed)
|
if (einsteinChinook.Destroyed)
|
||||||
{
|
{
|
||||||
@@ -241,10 +257,13 @@ namespace OpenRA.Mods.RA.Missions
|
|||||||
{
|
{
|
||||||
MissionFailed("Einstein was killed.");
|
MissionFailed("Einstein was killed.");
|
||||||
}
|
}
|
||||||
else if (!world.FindAliveCombatantActorsInCircle(allies2BasePoint.CenterLocation, 20).Any(a => a.HasTrait<Building>() && !a.HasTrait<Wall>() && a.Owner == allies2))
|
world.AddFrameEndTask(w =>
|
||||||
{
|
{
|
||||||
MissionFailed("The Allied reinforcements have been defeated.");
|
if (!world.FindAliveCombatantActorsInCircle(allies2BasePoint.CenterLocation, 20).Any(a => a.HasTrait<Building>() && !a.HasTrait<Wall>() && a.Owner == allies2))
|
||||||
}
|
{
|
||||||
|
MissionFailed("The Allied reinforcements have been defeated.");
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
void AddSovietCashIfRequired()
|
void AddSovietCashIfRequired()
|
||||||
|
|||||||
Reference in New Issue
Block a user