Merge remote-tracking branch 'scott/bleed'
Conflicts: OpenRA.Mods.RA/Missions/Allies01Script.cs
This commit is contained in:
@@ -23,7 +23,7 @@ namespace OpenRA.Mods.RA.Missions
|
||||
|
||||
public class Allies01Script : IWorldLoaded, ITick
|
||||
{
|
||||
private string[] objectives =
|
||||
private static readonly string[] objectives =
|
||||
{
|
||||
"Find Einstein.",
|
||||
"Wait for the helicopter and extract Einstein."
|
||||
@@ -55,14 +55,16 @@ namespace OpenRA.Mods.RA.Missions
|
||||
private static readonly string[] ships = { "ca", "ca", "ca", "ca" };
|
||||
|
||||
private static readonly string[] attackWave = { "e1", "e1", "e1", "e1", "e2", "e2", "e2", "e2", "dog" };
|
||||
private int currentAttackWaveFrameNumber = -600;
|
||||
private static readonly string[] lastAttackWaveAddition = { "3tnk", "e1", "e1", "e1", "e1", "e2", "e2", "e2", "e2" };
|
||||
private int currentAttackWaveFrameNumber;
|
||||
private int currentAttackWave;
|
||||
private const int einsteinChinookArrivesAtAttackWave = 5;
|
||||
|
||||
private const int labRange = 5;
|
||||
private const string einsteinName = "c1";
|
||||
private const string einsteinName = "einstein";
|
||||
private const string tanyaName = "e7";
|
||||
private const string chinookName = "tran";
|
||||
private const string signalFlareName = "flare";
|
||||
|
||||
private void NextObjective()
|
||||
{
|
||||
@@ -72,6 +74,7 @@ namespace OpenRA.Mods.RA.Missions
|
||||
private void DisplayObjective()
|
||||
{
|
||||
Game.AddChatLine(Color.LimeGreen, "Objective", objectives[currentObjective]);
|
||||
Sound.Play("bleep6.aud", 5);
|
||||
}
|
||||
|
||||
private void MissionFailed(Actor self, string text)
|
||||
@@ -82,11 +85,8 @@ namespace OpenRA.Mods.RA.Missions
|
||||
}
|
||||
allies.WinState = WinState.Lost;
|
||||
Game.AddChatLine(Color.Red, "Mission failed", text);
|
||||
foreach (var actor in self.World.Actors.Where(a => a.Owner == allies))
|
||||
{
|
||||
actor.Kill(actor);
|
||||
}
|
||||
self.World.LocalShroud.Disabled = true;
|
||||
Sound.Play("misnlst1.aud", 5);
|
||||
}
|
||||
|
||||
private void MissionAccomplished(Actor self, string text)
|
||||
@@ -98,6 +98,7 @@ namespace OpenRA.Mods.RA.Missions
|
||||
allies.WinState = WinState.Won;
|
||||
Game.AddChatLine(Color.Blue, "Mission accomplished", text);
|
||||
self.World.LocalShroud.Disabled = true;
|
||||
Sound.Play("misnwon1.aud", 5);
|
||||
}
|
||||
|
||||
public void Tick(Actor self)
|
||||
@@ -126,11 +127,14 @@ namespace OpenRA.Mods.RA.Missions
|
||||
{
|
||||
if (AlliesControlLab(self))
|
||||
{
|
||||
SpawnSignalFlare(self);
|
||||
Sound.Play("flaren1.aud", 5);
|
||||
SpawnEinsteinAtLab(self); // spawn Einstein once the area is clear
|
||||
Sound.Play("einok1.aud"); // "Incredible!" - Einstein
|
||||
SendShips(self);
|
||||
NextObjective();
|
||||
DisplayObjective();
|
||||
currentAttackWaveFrameNumber = self.World.FrameNumber;
|
||||
}
|
||||
if (lab.Destroyed)
|
||||
{
|
||||
@@ -141,25 +145,23 @@ namespace OpenRA.Mods.RA.Missions
|
||||
{
|
||||
if (self.World.FrameNumber >= currentAttackWaveFrameNumber + 600)
|
||||
{
|
||||
Sound.Play("enmyapp1.aud", 5);
|
||||
SendAttackWave(self, attackWave);
|
||||
currentAttackWave++;
|
||||
currentAttackWaveFrameNumber = self.World.FrameNumber;
|
||||
if (currentAttackWave >= einsteinChinookArrivesAtAttackWave)
|
||||
{
|
||||
SendAttackWave(self, lastAttackWaveAddition);
|
||||
}
|
||||
if (currentAttackWave == einsteinChinookArrivesAtAttackWave)
|
||||
{
|
||||
FlyToExtractionLZ(self);
|
||||
FlyEinsteinFromExtractionLZ(self);
|
||||
}
|
||||
}
|
||||
if (einsteinChinook != null)
|
||||
{
|
||||
if (einsteinChinook.Trait<Cargo>().Passengers.Contains(einstein))
|
||||
{
|
||||
FlyEinsteinFromExtractionLZ();
|
||||
}
|
||||
if (!self.World.Map.IsInMap(einsteinChinook.Location) && !einstein.IsInWorld)
|
||||
if (einsteinChinook != null && !self.World.Map.IsInMap(einsteinChinook.Location) && !einstein.IsInWorld)
|
||||
{
|
||||
MissionAccomplished(self, "Einstein was rescued.");
|
||||
}
|
||||
}
|
||||
if (einstein.Destroyed)
|
||||
{
|
||||
MissionFailed(self, "Einstein was killed.");
|
||||
@@ -171,14 +173,18 @@ namespace OpenRA.Mods.RA.Missions
|
||||
}
|
||||
}
|
||||
|
||||
private void SpawnSignalFlare(Actor self)
|
||||
{
|
||||
self.World.CreateActor(signalFlareName, new TypeDictionary { new OwnerInit(allies), new LocationInit(extractionLZ.Location) });
|
||||
}
|
||||
|
||||
private void SendAttackWave(Actor self, IEnumerable<string> wave)
|
||||
{
|
||||
foreach (var unit in wave)
|
||||
{
|
||||
var spawnActor = self.World.SharedRandom.Next(2) == 0 ? attackEntryPoint1 : attackEntryPoint2;
|
||||
var targetActor = self.World.SharedRandom.Next(2) == 0 ? einstein : tanya;
|
||||
var actor = self.World.CreateActor(unit, new TypeDictionary { new OwnerInit(soviets), new LocationInit(spawnActor.Location) });
|
||||
actor.QueueActivity(new Attack(Target.FromActor(targetActor), 2));
|
||||
actor.QueueActivity(new AttackMove.AttackMoveActivity(actor, new Attack(Target.FromActor(einstein), 3))); // better way of doing this?
|
||||
}
|
||||
}
|
||||
|
||||
@@ -191,7 +197,7 @@ namespace OpenRA.Mods.RA.Missions
|
||||
private bool AlliesControlLab(Actor self)
|
||||
{
|
||||
var units = UnitsNearActor(self, lab, labRange);
|
||||
return units.Count() >= 1 && units.All(a => a.Owner == allies);
|
||||
return units.Any() && units.All(a => a.Owner == allies);
|
||||
}
|
||||
|
||||
private void SpawnEinsteinAtLab(Actor self)
|
||||
@@ -209,19 +215,16 @@ namespace OpenRA.Mods.RA.Missions
|
||||
}
|
||||
}
|
||||
|
||||
private void FlyEinsteinFromExtractionLZ()
|
||||
{
|
||||
einsteinChinook.QueueActivity(new Wait(150));
|
||||
einsteinChinook.QueueActivity(new HeliFly(chinookExitPoint.CenterLocation));
|
||||
einsteinChinook.QueueActivity(new RemoveSelf());
|
||||
}
|
||||
|
||||
private void FlyToExtractionLZ(Actor self)
|
||||
private void FlyEinsteinFromExtractionLZ(Actor self)
|
||||
{
|
||||
einsteinChinook = self.World.CreateActor(chinookName, new TypeDictionary { new OwnerInit(allies), new LocationInit(extractionLZEntryPoint.Location) });
|
||||
einsteinChinook.QueueActivity(new HeliFly(extractionLZ.CenterLocation));
|
||||
einsteinChinook.QueueActivity(new Turn(0));
|
||||
einsteinChinook.QueueActivity(new HeliLand(true));
|
||||
einsteinChinook.QueueActivity(new WaitFor(() => einsteinChinook.Trait<Cargo>().Passengers.Contains(einstein)));
|
||||
einsteinChinook.QueueActivity(new Wait(150));
|
||||
einsteinChinook.QueueActivity(new HeliFly(chinookExitPoint.CenterLocation));
|
||||
einsteinChinook.QueueActivity(new RemoveSelf());
|
||||
}
|
||||
|
||||
private void FlyTanyaToInsertionLZ(Actor self)
|
||||
|
||||
Binary file not shown.
@@ -305,6 +305,27 @@ C2:
|
||||
ProximityCaptor:
|
||||
Types:CivilianInfantry
|
||||
|
||||
EINSTEIN:
|
||||
Inherits: ^Infantry
|
||||
Selectable:
|
||||
Voice: EinsteinVoice
|
||||
Bounds: 12,17,0,-9
|
||||
Valued:
|
||||
Cost: 10
|
||||
Tooltip:
|
||||
Name: Prof. Einstein
|
||||
Health:
|
||||
HP: 25
|
||||
Mobile:
|
||||
Speed: 5
|
||||
RevealsShroud:
|
||||
Range: 2
|
||||
-AutoTarget:
|
||||
AttackMove:
|
||||
JustMove: true
|
||||
ProximityCaptor:
|
||||
Types:CivilianInfantry
|
||||
|
||||
SHOK:
|
||||
Inherits: ^Infantry
|
||||
Buildable:
|
||||
|
||||
@@ -1877,6 +1877,45 @@ c2:
|
||||
Length: 6
|
||||
Facings: 8
|
||||
|
||||
einstein:
|
||||
stand:
|
||||
Start: 0
|
||||
Facings: 8
|
||||
panic-run:
|
||||
Start: 8
|
||||
Length: 6
|
||||
Facings: 8
|
||||
panic-stand:
|
||||
Start: 8
|
||||
Length: 6
|
||||
Facings: 8
|
||||
run:
|
||||
Start: 56
|
||||
Length: 6
|
||||
Facings: 8
|
||||
die1:
|
||||
Start: 115
|
||||
Length: 8
|
||||
die2:
|
||||
Start: 123
|
||||
Length: 8
|
||||
die3:
|
||||
Start: 135
|
||||
Length: 12
|
||||
die4:
|
||||
Start: 147
|
||||
Length: 17
|
||||
die5:
|
||||
Start: 123
|
||||
Length: 8
|
||||
die6: electro
|
||||
Start: 0
|
||||
Length: *
|
||||
die-crushed: corpse1
|
||||
Start: 0
|
||||
Length: 6
|
||||
Tick: 1600
|
||||
|
||||
parabomb:
|
||||
open:
|
||||
Start: 0
|
||||
|
||||
Reference in New Issue
Block a user