Begin building basic Allies 02 framework
This commit is contained in:
@@ -57,13 +57,13 @@ namespace OpenRA.Mods.RA.Missions
|
|||||||
static readonly string[] lastAttackWaveAddition = { "3tnk", "e1", "e1", "e1", "e1", "e2", "e2", "e2", "e2" };
|
static readonly string[] lastAttackWaveAddition = { "3tnk", "e1", "e1", "e1", "e1", "e2", "e2", "e2", "e2" };
|
||||||
int currentAttackWaveFrameNumber;
|
int currentAttackWaveFrameNumber;
|
||||||
int currentAttackWave;
|
int currentAttackWave;
|
||||||
const int einsteinChinookArrivesAtAttackWave = 5;
|
const int EinsteinChinookAttackWave = 5;
|
||||||
|
|
||||||
const int labRange = 5;
|
const int LabClearRange = 5;
|
||||||
const string einsteinName = "einstein";
|
const string EinsteinName = "einstein";
|
||||||
const string tanyaName = "e7";
|
const string TanyaName = "e7";
|
||||||
const string chinookName = "tran";
|
const string ChinookName = "tran";
|
||||||
const string signalFlareName = "flare";
|
const string SignalFlareName = "flare";
|
||||||
|
|
||||||
void DisplayObjective()
|
void DisplayObjective()
|
||||||
{
|
{
|
||||||
@@ -79,7 +79,6 @@ namespace OpenRA.Mods.RA.Missions
|
|||||||
}
|
}
|
||||||
allies.WinState = WinState.Lost;
|
allies.WinState = WinState.Lost;
|
||||||
Game.AddChatLine(Color.Red, "Mission failed", text);
|
Game.AddChatLine(Color.Red, "Mission failed", text);
|
||||||
self.World.LocalShroud.Disabled = true;
|
|
||||||
Sound.Play("misnlst1.aud", 5);
|
Sound.Play("misnlst1.aud", 5);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -91,7 +90,6 @@ namespace OpenRA.Mods.RA.Missions
|
|||||||
}
|
}
|
||||||
allies.WinState = WinState.Won;
|
allies.WinState = WinState.Won;
|
||||||
Game.AddChatLine(Color.Blue, "Mission accomplished", text);
|
Game.AddChatLine(Color.Blue, "Mission accomplished", text);
|
||||||
self.World.LocalShroud.Disabled = true;
|
|
||||||
Sound.Play("misnwon1.aud", 5);
|
Sound.Play("misnwon1.aud", 5);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -144,11 +142,11 @@ namespace OpenRA.Mods.RA.Missions
|
|||||||
SendAttackWave(self, attackWave);
|
SendAttackWave(self, attackWave);
|
||||||
currentAttackWave++;
|
currentAttackWave++;
|
||||||
currentAttackWaveFrameNumber = self.World.FrameNumber;
|
currentAttackWaveFrameNumber = self.World.FrameNumber;
|
||||||
if (currentAttackWave >= einsteinChinookArrivesAtAttackWave)
|
if (currentAttackWave >= EinsteinChinookAttackWave)
|
||||||
{
|
{
|
||||||
SendAttackWave(self, lastAttackWaveAddition);
|
SendAttackWave(self, lastAttackWaveAddition);
|
||||||
}
|
}
|
||||||
if (currentAttackWave == einsteinChinookArrivesAtAttackWave)
|
if (currentAttackWave == EinsteinChinookAttackWave)
|
||||||
{
|
{
|
||||||
FlyEinsteinFromExtractionLZ(self);
|
FlyEinsteinFromExtractionLZ(self);
|
||||||
}
|
}
|
||||||
@@ -178,7 +176,7 @@ namespace OpenRA.Mods.RA.Missions
|
|||||||
|
|
||||||
void SpawnSignalFlare(Actor self)
|
void SpawnSignalFlare(Actor self)
|
||||||
{
|
{
|
||||||
self.World.CreateActor(signalFlareName, new TypeDictionary { new OwnerInit(allies), new LocationInit(extractionLZ.Location) });
|
self.World.CreateActor(SignalFlareName, new TypeDictionary { new OwnerInit(allies), new LocationInit(extractionLZ.Location) });
|
||||||
}
|
}
|
||||||
|
|
||||||
void SendAttackWave(Actor self, IEnumerable<string> wave)
|
void SendAttackWave(Actor self, IEnumerable<string> wave)
|
||||||
@@ -217,13 +215,13 @@ namespace OpenRA.Mods.RA.Missions
|
|||||||
|
|
||||||
bool AlliesControlLab(Actor self)
|
bool AlliesControlLab(Actor self)
|
||||||
{
|
{
|
||||||
var units = UnitsNearActor(self, lab, labRange);
|
var units = UnitsNearActor(self, lab, LabClearRange);
|
||||||
return units.Any() && units.All(a => a.Owner == allies);
|
return units.Any() && units.All(a => a.Owner == allies);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SpawnEinsteinAtLab(Actor self)
|
void SpawnEinsteinAtLab(Actor self)
|
||||||
{
|
{
|
||||||
einstein = self.World.CreateActor(einsteinName, new TypeDictionary { new OwnerInit(allies), new LocationInit(lab.Location) });
|
einstein = self.World.CreateActor(EinsteinName, new TypeDictionary { new OwnerInit(allies), new LocationInit(lab.Location) });
|
||||||
einstein.QueueActivity(new Move.Move(lab.Location - new CVec(0, 2)));
|
einstein.QueueActivity(new Move.Move(lab.Location - new CVec(0, 2)));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -239,7 +237,7 @@ namespace OpenRA.Mods.RA.Missions
|
|||||||
|
|
||||||
void FlyEinsteinFromExtractionLZ(Actor self)
|
void FlyEinsteinFromExtractionLZ(Actor self)
|
||||||
{
|
{
|
||||||
einsteinChinook = self.World.CreateActor(chinookName, new TypeDictionary { new OwnerInit(allies), new LocationInit(extractionLZEntryPoint.Location) });
|
einsteinChinook = self.World.CreateActor(ChinookName, new TypeDictionary { new OwnerInit(allies), new LocationInit(extractionLZEntryPoint.Location) });
|
||||||
einsteinChinook.QueueActivity(new HeliFly(extractionLZ.CenterLocation));
|
einsteinChinook.QueueActivity(new HeliFly(extractionLZ.CenterLocation));
|
||||||
einsteinChinook.QueueActivity(new Turn(0));
|
einsteinChinook.QueueActivity(new Turn(0));
|
||||||
einsteinChinook.QueueActivity(new HeliLand(true));
|
einsteinChinook.QueueActivity(new HeliLand(true));
|
||||||
@@ -251,8 +249,8 @@ namespace OpenRA.Mods.RA.Missions
|
|||||||
|
|
||||||
void FlyTanyaToInsertionLZ(Actor self)
|
void FlyTanyaToInsertionLZ(Actor self)
|
||||||
{
|
{
|
||||||
tanya = self.World.CreateActor(false, tanyaName, new TypeDictionary { new OwnerInit(allies) });
|
tanya = self.World.CreateActor(false, TanyaName, new TypeDictionary { new OwnerInit(allies) });
|
||||||
var chinook = self.World.CreateActor(chinookName, new TypeDictionary { new OwnerInit(allies), new LocationInit(insertionLZEntryPoint.Location) });
|
var chinook = self.World.CreateActor(ChinookName, new TypeDictionary { new OwnerInit(allies), new LocationInit(insertionLZEntryPoint.Location) });
|
||||||
chinook.Trait<Cargo>().Load(chinook, tanya);
|
chinook.Trait<Cargo>().Load(chinook, tanya);
|
||||||
chinook.QueueActivity(new HeliFly(insertionLZ.CenterLocation));
|
chinook.QueueActivity(new HeliFly(insertionLZ.CenterLocation));
|
||||||
chinook.QueueActivity(new Turn(0));
|
chinook.QueueActivity(new Turn(0));
|
||||||
|
|||||||
@@ -8,6 +8,7 @@
|
|||||||
*/
|
*/
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
using System.Drawing;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using OpenRA.Traits;
|
using OpenRA.Traits;
|
||||||
|
|
||||||
@@ -17,23 +18,87 @@ namespace OpenRA.Mods.RA.Missions
|
|||||||
|
|
||||||
class Allies02Script : IWorldLoaded, ITick
|
class Allies02Script : IWorldLoaded, ITick
|
||||||
{
|
{
|
||||||
|
static readonly string[] objectives =
|
||||||
|
{
|
||||||
|
"Destroy the SAM sites. Tanya and Einstein must survive.",
|
||||||
|
"Wait for the helicopter and extract Einstein. Tanya and Einstein must survive."
|
||||||
|
};
|
||||||
|
|
||||||
|
int currentObjective;
|
||||||
|
|
||||||
Actor chinookHusk;
|
Actor chinookHusk;
|
||||||
Actor sam1;
|
Actor sam1;
|
||||||
Actor sam2;
|
Actor sam2;
|
||||||
Actor sam3;
|
Actor sam3;
|
||||||
Actor sam4;
|
Actor sam4;
|
||||||
|
Actor tanya;
|
||||||
|
Actor einstein;
|
||||||
|
|
||||||
Player allies;
|
Player allies1;
|
||||||
|
Player allies2;
|
||||||
Player soviets;
|
Player soviets;
|
||||||
|
|
||||||
|
void DisplayObjective()
|
||||||
|
{
|
||||||
|
Game.AddChatLine(Color.LimeGreen, "Objective", objectives[currentObjective]);
|
||||||
|
Sound.Play("bleep6.aud", 5);
|
||||||
|
}
|
||||||
|
|
||||||
|
void MissionFailed(Actor self, string text)
|
||||||
|
{
|
||||||
|
if (allies1.WinState != WinState.Undefined)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
allies1.WinState = allies2.WinState = WinState.Lost;
|
||||||
|
Game.AddChatLine(Color.Red, "Mission failed", text);
|
||||||
|
Sound.Play("misnlst1.aud", 5);
|
||||||
|
}
|
||||||
|
|
||||||
|
void MissionAccomplished(Actor self, string text)
|
||||||
|
{
|
||||||
|
if (allies1.WinState != WinState.Undefined)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
allies1.WinState = allies2.WinState = WinState.Won;
|
||||||
|
Game.AddChatLine(Color.Blue, "Mission accomplished", text);
|
||||||
|
Sound.Play("misnwon1.aud", 5);
|
||||||
|
}
|
||||||
|
|
||||||
public void Tick(Actor self)
|
public void Tick(Actor self)
|
||||||
|
{
|
||||||
|
// display current objective every so often
|
||||||
|
if (self.World.FrameNumber % 1500 == 1)
|
||||||
|
{
|
||||||
|
DisplayObjective();
|
||||||
|
}
|
||||||
|
if (currentObjective == 0)
|
||||||
|
{
|
||||||
|
if (sam1.Destroyed && sam2.Destroyed && sam3.Destroyed && sam4.Destroyed)
|
||||||
|
{
|
||||||
|
currentObjective++;
|
||||||
|
DisplayObjective();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (currentObjective == 1)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
if (tanya.Destroyed)
|
||||||
|
{
|
||||||
|
MissionFailed(self, "Tanya was killed.");
|
||||||
|
}
|
||||||
|
if (einstein.Destroyed)
|
||||||
|
{
|
||||||
|
MissionFailed(self, "Einstein was killed.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public void WorldLoaded(World w)
|
public void WorldLoaded(World w)
|
||||||
{
|
{
|
||||||
allies = w.Players.Single(p => p.InternalName == "Allies");
|
allies1 = w.Players.Single(p => p.InternalName == "Allies1");
|
||||||
|
allies2 = w.Players.Single(p => p.InternalName == "Allies2");
|
||||||
soviets = w.Players.Single(p => p.InternalName == "Soviets");
|
soviets = w.Players.Single(p => p.InternalName == "Soviets");
|
||||||
var actors = w.WorldActor.Trait<SpawnMapActors>().Actors;
|
var actors = w.WorldActor.Trait<SpawnMapActors>().Actors;
|
||||||
chinookHusk = actors["ChinookHusk"];
|
chinookHusk = actors["ChinookHusk"];
|
||||||
@@ -41,10 +106,13 @@ namespace OpenRA.Mods.RA.Missions
|
|||||||
sam2 = actors["SAM2"];
|
sam2 = actors["SAM2"];
|
||||||
sam3 = actors["SAM3"];
|
sam3 = actors["SAM3"];
|
||||||
sam4 = actors["SAM4"];
|
sam4 = actors["SAM4"];
|
||||||
|
tanya = actors["Tanya"];
|
||||||
|
einstein = actors["Einstein"];
|
||||||
w.WorldActor.Trait<Shroud>().Explore(w, sam1.Location, 2);
|
w.WorldActor.Trait<Shroud>().Explore(w, sam1.Location, 2);
|
||||||
w.WorldActor.Trait<Shroud>().Explore(w, sam2.Location, 2);
|
w.WorldActor.Trait<Shroud>().Explore(w, sam2.Location, 2);
|
||||||
w.WorldActor.Trait<Shroud>().Explore(w, sam3.Location, 2);
|
w.WorldActor.Trait<Shroud>().Explore(w, sam3.Location, 2);
|
||||||
w.WorldActor.Trait<Shroud>().Explore(w, sam4.Location, 2);
|
w.WorldActor.Trait<Shroud>().Explore(w, sam4.Location, 2);
|
||||||
|
Game.MoveViewport(chinookHusk.Location.ToFloat2());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -24,22 +24,35 @@ Players:
|
|||||||
OwnsWorld: True
|
OwnsWorld: True
|
||||||
NonCombatant: True
|
NonCombatant: True
|
||||||
Race: allies
|
Race: allies
|
||||||
PlayerReference@Allies:
|
PlayerReference@Allies1:
|
||||||
Name: Allies
|
Name: Allies1
|
||||||
Playable: True
|
Playable: True
|
||||||
AllowBots: False
|
#AllowBots: False
|
||||||
LockRace: True
|
LockRace: True
|
||||||
Race: allies
|
Race: allies
|
||||||
LockColor: True
|
LockColor: True
|
||||||
ColorRamp: 153,240,130,10
|
ColorRamp: 153,240,130,10
|
||||||
LockSpawn: True
|
LockSpawn: True
|
||||||
LockTeam: True
|
LockTeam: True
|
||||||
|
Allies: Allies2
|
||||||
|
Enemies: Soviets
|
||||||
|
PlayerReference@Allies2:
|
||||||
|
Name: Allies2
|
||||||
|
Playable: True
|
||||||
|
#AllowBots: False
|
||||||
|
LockRace: True
|
||||||
|
Race: allies
|
||||||
|
LockColor: True
|
||||||
|
ColorRamp: 80,240,130,10
|
||||||
|
LockSpawn: True
|
||||||
|
LockTeam: True
|
||||||
|
Allies: Allies1
|
||||||
Enemies: Soviets
|
Enemies: Soviets
|
||||||
PlayerReference@Soviets:
|
PlayerReference@Soviets:
|
||||||
Name: Soviets
|
Name: Soviets
|
||||||
Race: soviet
|
Race: soviet
|
||||||
ColorRamp: 0,255,128,10
|
ColorRamp: 0,255,128,10
|
||||||
Enemies: Allies
|
Enemies: Allies1,Allies2
|
||||||
|
|
||||||
Actors:
|
Actors:
|
||||||
Actor1: v07
|
Actor1: v07
|
||||||
@@ -194,7 +207,7 @@ Actors:
|
|||||||
Owner: Neutral
|
Owner: Neutral
|
||||||
Actor78: e6
|
Actor78: e6
|
||||||
Location: 109,88
|
Location: 109,88
|
||||||
Owner: Allies
|
Owner: Allies1
|
||||||
Actor135: e1
|
Actor135: e1
|
||||||
Location: 97,104
|
Location: 97,104
|
||||||
Owner: Soviets
|
Owner: Soviets
|
||||||
@@ -260,7 +273,7 @@ Actors:
|
|||||||
Owner: Neutral
|
Owner: Neutral
|
||||||
ChinookHusk: tran.husk2
|
ChinookHusk: tran.husk2
|
||||||
Location: 108,87
|
Location: 108,87
|
||||||
Owner: Allies
|
Owner: Allies1
|
||||||
Actor54: cycl
|
Actor54: cycl
|
||||||
Location: 98,103
|
Location: 98,103
|
||||||
Owner: Soviets
|
Owner: Soviets
|
||||||
@@ -273,18 +286,18 @@ Actors:
|
|||||||
Actor313: brik
|
Actor313: brik
|
||||||
Location: 65,62
|
Location: 65,62
|
||||||
Owner: Soviets
|
Owner: Soviets
|
||||||
Actor84: einstein
|
Einstein: einstein
|
||||||
Location: 108,86
|
Location: 108,86
|
||||||
Owner: Allies
|
Owner: Allies1
|
||||||
Actor85: medi
|
Actor85: medi
|
||||||
Location: 110,87
|
Location: 110,87
|
||||||
Owner: Allies
|
Owner: Allies1
|
||||||
SAM1: sam
|
SAM1: sam
|
||||||
Location: 106,96
|
Location: 106,96
|
||||||
Owner: Soviets
|
Owner: Soviets
|
||||||
Actor83: e7
|
Tanya: e7
|
||||||
Location: 106,86
|
Location: 106,86
|
||||||
Owner: Allies
|
Owner: Allies1
|
||||||
Actor60: e2
|
Actor60: e2
|
||||||
Location: 77,96
|
Location: 77,96
|
||||||
Owner: Soviets
|
Owner: Soviets
|
||||||
@@ -578,7 +591,7 @@ Actors:
|
|||||||
Owner: Neutral
|
Owner: Neutral
|
||||||
Actor53: e1
|
Actor53: e1
|
||||||
Location: 109,89
|
Location: 109,89
|
||||||
Owner: Allies
|
Owner: Allies1
|
||||||
Actor148: t01
|
Actor148: t01
|
||||||
Location: 19,92
|
Location: 19,92
|
||||||
Owner: Neutral
|
Owner: Neutral
|
||||||
@@ -590,7 +603,7 @@ Actors:
|
|||||||
Owner: Neutral
|
Owner: Neutral
|
||||||
Actor52: e1
|
Actor52: e1
|
||||||
Location: 106,88
|
Location: 106,88
|
||||||
Owner: Allies
|
Owner: Allies1
|
||||||
Actor238: t06
|
Actor238: t06
|
||||||
Location: 16,35
|
Location: 16,35
|
||||||
Owner: Neutral
|
Owner: Neutral
|
||||||
@@ -1106,13 +1119,13 @@ Actors:
|
|||||||
Owner: Soviets
|
Owner: Soviets
|
||||||
Actor376: e1
|
Actor376: e1
|
||||||
Location: 107,89
|
Location: 107,89
|
||||||
Owner: Allies
|
Owner: Allies1
|
||||||
Actor377: e1
|
Actor377: e1
|
||||||
Location: 108,89
|
Location: 108,89
|
||||||
Owner: Allies
|
Owner: Allies1
|
||||||
Actor378: e1
|
Actor378: e1
|
||||||
Location: 110,88
|
Location: 110,88
|
||||||
Owner: Allies
|
Owner: Allies1
|
||||||
SAM2: sam
|
SAM2: sam
|
||||||
Location: 91,65
|
Location: 91,65
|
||||||
Owner: Soviets
|
Owner: Soviets
|
||||||
@@ -1539,6 +1552,30 @@ Actors:
|
|||||||
Actor456: sbag
|
Actor456: sbag
|
||||||
Location: 33,56
|
Location: 33,56
|
||||||
Owner: Soviets
|
Owner: Soviets
|
||||||
|
Actor452: tent
|
||||||
|
Location: 33,92
|
||||||
|
Owner: Allies2
|
||||||
|
Actor457: proc
|
||||||
|
Location: 24,92
|
||||||
|
Owner: Allies2
|
||||||
|
Actor458: weap
|
||||||
|
Location: 30,103
|
||||||
|
Owner: Allies2
|
||||||
|
Actor459: powr
|
||||||
|
Location: 38,101
|
||||||
|
Owner: Allies2
|
||||||
|
Actor460: powr
|
||||||
|
Location: 36,101
|
||||||
|
Owner: Allies2
|
||||||
|
Actor461: pbox.e1
|
||||||
|
Location: 35,88
|
||||||
|
Owner: Allies2
|
||||||
|
Actor465: gun
|
||||||
|
Location: 39,89
|
||||||
|
Owner: Allies2
|
||||||
|
Actor466: gun
|
||||||
|
Location: 31,89
|
||||||
|
Owner: Allies2
|
||||||
|
|
||||||
Smudges:
|
Smudges:
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user