From 781cbc00d3b4b98e2c8bb9ca9a71c46bfc7b0a6b Mon Sep 17 00:00:00 2001 From: ScottNZ Date: Sat, 30 Jun 2012 20:27:39 +1200 Subject: [PATCH 01/14] Make Einstein run out of the building when he appears. --- OpenRA.Mods.RA/Missions/Allies01Script.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/OpenRA.Mods.RA/Missions/Allies01Script.cs b/OpenRA.Mods.RA/Missions/Allies01Script.cs index 16902b05db..3dcae70262 100644 --- a/OpenRA.Mods.RA/Missions/Allies01Script.cs +++ b/OpenRA.Mods.RA/Missions/Allies01Script.cs @@ -203,6 +203,7 @@ namespace OpenRA.Mods.RA.Missions private void SpawnEinsteinAtLab(Actor self) { 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))); } private void SendShips(Actor self) From b9be918b6c04b5bba45e388d5873894472ba4af6 Mon Sep 17 00:00:00 2001 From: ScottNZ Date: Sat, 30 Jun 2012 23:20:04 +1200 Subject: [PATCH 02/14] Remove some code noise and improved the chinook cargo check --- OpenRA.Mods.RA/Missions/Allies01Script.cs | 529 +++++++++++----------- 1 file changed, 262 insertions(+), 267 deletions(-) diff --git a/OpenRA.Mods.RA/Missions/Allies01Script.cs b/OpenRA.Mods.RA/Missions/Allies01Script.cs index 3dcae70262..9c56a647d5 100644 --- a/OpenRA.Mods.RA/Missions/Allies01Script.cs +++ b/OpenRA.Mods.RA/Missions/Allies01Script.cs @@ -1,276 +1,271 @@ -#region Copyright & License Information +#region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. - */ -#endregion - -using System.Collections.Generic; -using System.Drawing; -using System.Linq; -using OpenRA.FileFormats; -using OpenRA.Mods.RA.Activities; -using OpenRA.Mods.RA.Air; -using OpenRA.Network; -using OpenRA.Traits; - -namespace OpenRA.Mods.RA.Missions -{ - public class Allies01ScriptInfo : TraitInfo, Requires { } - - public class Allies01Script : IWorldLoaded, ITick - { - private static readonly string[] objectives = + */ +#endregion + +using System.Collections.Generic; +using System.Drawing; +using System.Linq; +using OpenRA.FileFormats; +using OpenRA.Mods.RA.Activities; +using OpenRA.Mods.RA.Air; +using OpenRA.Network; +using OpenRA.Traits; + +namespace OpenRA.Mods.RA.Missions +{ + class Allies01ScriptInfo : TraitInfo, Requires { } + + class Allies01Script : IWorldLoaded, ITick + { + static readonly string[] objectives = { "Find Einstein.", "Wait for the helicopter and extract Einstein." - }; - - private int currentObjective; - - private Player allies; - private Player soviets; - - private ISound music; - - private Actor insertionLZ; - private Actor extractionLZ; - private Actor lab; - private Actor insertionLZEntryPoint; - private Actor extractionLZEntryPoint; - private Actor chinookExitPoint; - private Actor shipSpawnPoint; - private Actor shipMovePoint; - private Actor einstein; - private Actor einsteinChinook; - private Actor tanya; - private Actor attackEntryPoint1; - private Actor attackEntryPoint2; - - private static readonly string[] taunts = { "laugh1.aud", "lefty1.aud", "cmon1.aud", "gotit1.aud" }; - - private static readonly string[] ships = { "ca", "ca", "ca", "ca" }; - - private static readonly string[] attackWave = { "e1", "e1", "e1", "e1", "e2", "e2", "e2", "e2", "dog" }; - 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 = "einstein"; - private const string tanyaName = "e7"; - private const string chinookName = "tran"; - private const string signalFlareName = "flare"; - - private void NextObjective() - { - currentObjective++; - } - - private void DisplayObjective() - { - Game.AddChatLine(Color.LimeGreen, "Objective", objectives[currentObjective]); - Sound.Play("bleep6.aud", 5); - } - - private void MissionFailed(Actor self, string text) - { - if (allies.WinState != WinState.Undefined) - { - return; - } - allies.WinState = WinState.Lost; - Game.AddChatLine(Color.Red, "Mission failed", text); - self.World.LocalShroud.Disabled = true; - Sound.Play("misnlst1.aud", 5); - } - - private void MissionAccomplished(Actor self, string text) - { - if (allies.WinState != WinState.Undefined) - { - return; - } - 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) - { - if (allies.WinState != WinState.Undefined) - { - return; - } - // display current objective every so often - if (self.World.FrameNumber % 1500 == 1) - { - DisplayObjective(); - } - // taunt every so often - if (self.World.FrameNumber % 1000 == 0) - { - Sound.Play(taunts[self.World.SharedRandom.Next(taunts.Length)]); - } - // take Tanya to the LZ - if (self.World.FrameNumber == 1) - { - FlyTanyaToInsertionLZ(self); - } - // objectives - if (currentObjective == 0) - { - 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) - { - MissionFailed(self, "Einstein was killed."); - } - } - else if (currentObjective == 1) - { - 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) - { - FlyEinsteinFromExtractionLZ(self); - } - } - if (einsteinChinook != null && !self.World.Map.IsInMap(einsteinChinook.Location) && !einstein.IsInWorld) - { - MissionAccomplished(self, "Einstein was rescued."); - } - if (einstein.Destroyed) - { - MissionFailed(self, "Einstein was killed."); - } - } - if (tanya.Destroyed) - { - MissionFailed(self, "Tanya was killed."); - } - } - - private void SpawnSignalFlare(Actor self) - { - self.World.CreateActor(signalFlareName, new TypeDictionary { new OwnerInit(allies), new LocationInit(extractionLZ.Location) }); - } - - private void SendAttackWave(Actor self, IEnumerable wave) - { - foreach (var unit in wave) - { - var spawnActor = self.World.SharedRandom.Next(2) == 0 ? attackEntryPoint1 : attackEntryPoint2; - var actor = self.World.CreateActor(unit, new TypeDictionary { new OwnerInit(soviets), new LocationInit(spawnActor.Location) }); - actor.QueueActivity(new AttackMove.AttackMoveActivity(actor, new Attack(Target.FromActor(einstein), 3))); // better way of doing this? - } - } - - private IEnumerable UnitsNearActor(Actor self, Actor actor, int range) - { - return self.World.FindUnitsInCircle(actor.CenterLocation, Game.CellSize * range) - .Where(a => a.IsInWorld && a != self.World.WorldActor && !a.Destroyed && a.HasTrait() && !a.Owner.NonCombatant); - } - - private bool AlliesControlLab(Actor self) - { - var units = UnitsNearActor(self, lab, labRange); - return units.Any() && units.All(a => a.Owner == allies); - } - - private void SpawnEinsteinAtLab(Actor self) - { - 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))); - } - - private void SendShips(Actor self) - { - for (int i = 0; i < ships.Length; i++) - { - var actor = self.World.CreateActor(ships[i], - new TypeDictionary { new OwnerInit(allies), new LocationInit(shipSpawnPoint.Location + new CVec(i * 2, 0)) }); - actor.QueueActivity(new Move.Move(shipMovePoint.Location + new CVec(i * 4, 0))); - } - } - - 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().Passengers.Contains(einstein))); - einsteinChinook.QueueActivity(new Wait(150)); - einsteinChinook.QueueActivity(new HeliFly(chinookExitPoint.CenterLocation)); - einsteinChinook.QueueActivity(new RemoveSelf()); - } - - private void FlyTanyaToInsertionLZ(Actor self) - { - 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) }); - chinook.Trait().Load(chinook, tanya); - // use CenterLocation for HeliFly, Location for Move - chinook.QueueActivity(new HeliFly(insertionLZ.CenterLocation)); - chinook.QueueActivity(new Turn(0)); - chinook.QueueActivity(new HeliLand(true)); - chinook.QueueActivity(new UnloadCargo()); - chinook.QueueActivity(new CallFunc(() => Sound.Play("laugh1.aud"))); - chinook.QueueActivity(new Wait(150)); - chinook.QueueActivity(new HeliFly(chinookExitPoint.CenterLocation)); - chinook.QueueActivity(new RemoveSelf()); - } - - public void WorldLoaded(World w) - { - allies = w.Players.Single(p => p.InternalName == "Allies"); - soviets = w.Players.Single(p => p.InternalName == "Soviets"); - var actors = w.WorldActor.Trait().Actors; - insertionLZ = actors["InsertionLZ"]; - extractionLZ = actors["ExtractionLZ"]; - lab = actors["Lab"]; - insertionLZEntryPoint = actors["InsertionLZEntryPoint"]; - chinookExitPoint = actors["ChinookExitPoint"]; - extractionLZEntryPoint = actors["ExtractionLZEntryPoint"]; - shipSpawnPoint = actors["ShipSpawnPoint"]; - shipMovePoint = actors["ShipMovePoint"]; - attackEntryPoint1 = actors["SovietAttackEntryPoint1"]; - attackEntryPoint2 = actors["SovietAttackEntryPoint2"]; - Game.MoveViewport(insertionLZ.Location.ToFloat2()); - music = Sound.Play("hell226m.aud"); // Hell March - Game.ConnectionStateChanged += StopMusic; - } - - private void StopMusic(OrderManager orderManager) - { - if (!orderManager.GameStarted) - { - Sound.StopSound(music); - Game.ConnectionStateChanged -= StopMusic; - } - } - } -} + }; + + int currentObjective; + + Player allies; + Player soviets; + + ISound music; + + Actor insertionLZ; + Actor extractionLZ; + Actor lab; + Actor insertionLZEntryPoint; + Actor extractionLZEntryPoint; + Actor chinookExitPoint; + Actor shipSpawnPoint; + Actor shipMovePoint; + Actor einstein; + Actor einsteinChinook; + Actor tanya; + Actor attackEntryPoint1; + Actor attackEntryPoint2; + + static readonly string[] taunts = { "laugh1.aud", "lefty1.aud", "cmon1.aud", "gotit1.aud" }; + + static readonly string[] ships = { "ca", "ca", "ca", "ca" }; + + static readonly string[] attackWave = { "e1", "e1", "e1", "e1", "e2", "e2", "e2", "e2", "dog" }; + static readonly string[] lastAttackWaveAddition = { "3tnk", "e1", "e1", "e1", "e1", "e2", "e2", "e2", "e2" }; + int currentAttackWaveFrameNumber; + int currentAttackWave; + const int einsteinChinookArrivesAtAttackWave = 5; + + const int labRange = 5; + const string einsteinName = "einstein"; + const string tanyaName = "e7"; + const string chinookName = "tran"; + const string signalFlareName = "flare"; + + void DisplayObjective() + { + Game.AddChatLine(Color.LimeGreen, "Objective", objectives[currentObjective]); + Sound.Play("bleep6.aud", 5); + } + + void MissionFailed(Actor self, string text) + { + if (allies.WinState != WinState.Undefined) + { + return; + } + allies.WinState = WinState.Lost; + Game.AddChatLine(Color.Red, "Mission failed", text); + self.World.LocalShroud.Disabled = true; + Sound.Play("misnlst1.aud", 5); + } + + void MissionAccomplished(Actor self, string text) + { + if (allies.WinState != WinState.Undefined) + { + return; + } + 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) + { + if (allies.WinState != WinState.Undefined) + { + return; + } + // display current objective every so often + if (self.World.FrameNumber % 1500 == 1) + { + DisplayObjective(); + } + // taunt every so often + if (self.World.FrameNumber % 1000 == 0) + { + Sound.Play(taunts[self.World.SharedRandom.Next(taunts.Length)]); + } + // take Tanya to the LZ + if (self.World.FrameNumber == 1) + { + FlyTanyaToInsertionLZ(self); + } + // objectives + if (currentObjective == 0) + { + 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); + currentObjective++; + DisplayObjective(); + currentAttackWaveFrameNumber = self.World.FrameNumber; + } + if (lab.Destroyed) + { + MissionFailed(self, "Einstein was killed."); + } + } + else if (currentObjective == 1) + { + 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) + { + FlyEinsteinFromExtractionLZ(self); + } + } + if (einsteinChinook != null && !self.World.Map.IsInMap(einsteinChinook.Location) && einsteinChinook.Trait().Passengers.Contains(einstein)) + { + MissionAccomplished(self, "Einstein was rescued."); + } + if (einstein.Destroyed) + { + MissionFailed(self, "Einstein was killed."); + } + } + if (tanya.Destroyed) + { + MissionFailed(self, "Tanya was killed."); + } + } + + void SpawnSignalFlare(Actor self) + { + self.World.CreateActor(signalFlareName, new TypeDictionary { new OwnerInit(allies), new LocationInit(extractionLZ.Location) }); + } + + void SendAttackWave(Actor self, IEnumerable wave) + { + foreach (var unit in wave) + { + var spawnActor = self.World.SharedRandom.Next(2) == 0 ? attackEntryPoint1 : attackEntryPoint2; + var actor = self.World.CreateActor(unit, new TypeDictionary { new OwnerInit(soviets), new LocationInit(spawnActor.Location) }); + actor.QueueActivity(new AttackMove.AttackMoveActivity(actor, new Attack(Target.FromActor(einstein), 3))); // better way of doing this? + } + } + + IEnumerable UnitsNearActor(Actor self, Actor actor, int range) + { + return self.World.FindUnitsInCircle(actor.CenterLocation, Game.CellSize * range) + .Where(a => a.IsInWorld && a != self.World.WorldActor && !a.Destroyed && a.HasTrait() && !a.Owner.NonCombatant); + } + + bool AlliesControlLab(Actor self) + { + var units = UnitsNearActor(self, lab, labRange); + return units.Any() && units.All(a => a.Owner == allies); + } + + void SpawnEinsteinAtLab(Actor self) + { + 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))); + } + + void SendShips(Actor self) + { + for (int i = 0; i < ships.Length; i++) + { + var actor = self.World.CreateActor(ships[i], + new TypeDictionary { new OwnerInit(allies), new LocationInit(shipSpawnPoint.Location + new CVec(i * 2, 0)) }); + actor.QueueActivity(new Move.Move(shipMovePoint.Location + new CVec(i * 4, 0))); + } + } + + 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().Passengers.Contains(einstein))); + einsteinChinook.QueueActivity(new Wait(150)); + einsteinChinook.QueueActivity(new HeliFly(chinookExitPoint.CenterLocation)); + einsteinChinook.QueueActivity(new RemoveSelf()); + } + + void FlyTanyaToInsertionLZ(Actor self) + { + 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) }); + chinook.Trait().Load(chinook, tanya); + // use CenterLocation for HeliFly, Location for Move + chinook.QueueActivity(new HeliFly(insertionLZ.CenterLocation)); + chinook.QueueActivity(new Turn(0)); + chinook.QueueActivity(new HeliLand(true)); + chinook.QueueActivity(new UnloadCargo()); + chinook.QueueActivity(new CallFunc(() => Sound.Play("laugh1.aud"))); + chinook.QueueActivity(new Wait(150)); + chinook.QueueActivity(new HeliFly(chinookExitPoint.CenterLocation)); + chinook.QueueActivity(new RemoveSelf()); + } + + public void WorldLoaded(World w) + { + allies = w.Players.Single(p => p.InternalName == "Allies"); + soviets = w.Players.Single(p => p.InternalName == "Soviets"); + var actors = w.WorldActor.Trait().Actors; + insertionLZ = actors["InsertionLZ"]; + extractionLZ = actors["ExtractionLZ"]; + lab = actors["Lab"]; + insertionLZEntryPoint = actors["InsertionLZEntryPoint"]; + chinookExitPoint = actors["ChinookExitPoint"]; + extractionLZEntryPoint = actors["ExtractionLZEntryPoint"]; + shipSpawnPoint = actors["ShipSpawnPoint"]; + shipMovePoint = actors["ShipMovePoint"]; + attackEntryPoint1 = actors["SovietAttackEntryPoint1"]; + attackEntryPoint2 = actors["SovietAttackEntryPoint2"]; + Game.MoveViewport(insertionLZ.Location.ToFloat2()); + music = Sound.Play("hell226m.aud"); // Hell March + Game.ConnectionStateChanged += StopMusic; + } + + void StopMusic(OrderManager orderManager) + { + if (!orderManager.GameStarted) + { + Sound.StopSound(music); + Game.ConnectionStateChanged -= StopMusic; + } + } + } +} From 2c55a008f1c4a607f8909f070fbf866589fe668c Mon Sep 17 00:00:00 2001 From: ScottNZ Date: Sat, 30 Jun 2012 23:33:09 +1200 Subject: [PATCH 03/14] Reduced cruiser range from 32 to 25 to reduce risk of friendly fire. Increased barrel hitpoints. Removed jeep cargo ability as a workaround for Einstein being removed from the game world and Soviet forces not attacking. --- mods/ra/maps/allies-01.oramap | Bin 2788 -> 2816 bytes 1 file changed, 0 insertions(+), 0 deletions(-) diff --git a/mods/ra/maps/allies-01.oramap b/mods/ra/maps/allies-01.oramap index 269e51d14c0be57175faae4c255a54289d52d68d..8b2dfe1422b032cab792f02babf40ea3dfaffb87 100644 GIT binary patch delta 1728 zcmV;x20!`a6@V77>;r$7yWT(>3$6|?1^@ug7ytkW0001OVQ?;aVQp-kSWA!7Fc3a( zenl^cOF*%mXHS%65ug^Twor)+@}{N@o5mq=S<0_x?4&J?A0Q69jmO{TnemLrk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^u^$`$>H9j+Rxkh9~O5l@KaVoUg{A>pcI8*oa(Icy2C5VumiVoAZC6 z>6lQE`4>=%?pt0pa&+mjzbEJP9rK^g{`mH1C4JIVdBe7`-u{H&@*h=( zIEZbx@Lrjjl(c+2O@dvs6n|I6K}CP+rR01DSe{Ce`|U$453$$-SEn~IURKBf&m$9# zJ#b{gi3RRjYvfokC~;ciG+1tTtF#fT_G^G}}xPGSsFH)bhSp!R7A}@DPwuS-K%~~$t z`}Wgf@%C2v_(t$=pj4&Gua|$jy4Ll{i)G8$N?jbZ8P$3N$6sF;y_hv?g?*{WkacKT z?qKiiwT8NDOO<4VqpK^`1}B2&t9s6wwS;+eQof^N!{}<-%M$8ylBmXKsB`bM<+{cU z6Q$8J-MZr(Kv~ka=Ae^24C+Pyu?G{?=&*pDj>1|k?N@f_P@{JcJ;FPHbZt$$O>fh~ z8%C9?ST*~A?JM#+@`UPrLwhrmgV8PIk0sRiLB~gW&-oVNqp-8lUQiJPpLwM{`5Tir z3P~v?%9iH}Rm}md(1cb8Rm}lVO928u02BZK00;ncrQAS(QipgG1^@t^lc@?RE|y-f u8wyp;0VT?o=L%KL0nQ$URtHth0Z>Z?1^@s600IC40J8u902>Mb0000Nku5p^ From 6014f648f415a7e774ced7feb1d7952b77a62764 Mon Sep 17 00:00:00 2001 From: ScottNZ Date: Sun, 1 Jul 2012 03:29:05 +1200 Subject: [PATCH 04/14] Add e1, dog, e1 soviet patrol --- OpenRA.Mods.RA/Missions/Allies01Script.cs | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/OpenRA.Mods.RA/Missions/Allies01Script.cs b/OpenRA.Mods.RA/Missions/Allies01Script.cs index 9c56a647d5..90b8bd77ba 100644 --- a/OpenRA.Mods.RA/Missions/Allies01Script.cs +++ b/OpenRA.Mods.RA/Missions/Allies01Script.cs @@ -53,6 +53,7 @@ namespace OpenRA.Mods.RA.Missions static readonly string[] taunts = { "laugh1.aud", "lefty1.aud", "cmon1.aud", "gotit1.aud" }; static readonly string[] ships = { "ca", "ca", "ca", "ca" }; + static readonly string[] patrol = { "e1", "dog", "e1" }; static readonly string[] attackWave = { "e1", "e1", "e1", "e1", "e2", "e2", "e2", "e2", "dog" }; static readonly string[] lastAttackWaveAddition = { "3tnk", "e1", "e1", "e1", "e1", "e2", "e2", "e2", "e2" }; @@ -116,6 +117,7 @@ namespace OpenRA.Mods.RA.Missions if (self.World.FrameNumber == 1) { FlyTanyaToInsertionLZ(self); + SendPatrol(self); } // objectives if (currentObjective == 0) @@ -183,6 +185,15 @@ namespace OpenRA.Mods.RA.Missions } } + void SendPatrol(Actor self) + { + for (int i = 0; i < patrol.Length; i++) + { + var actor = self.World.CreateActor(patrol[i], new TypeDictionary { new OwnerInit(soviets), new LocationInit(insertionLZ.Location + new CVec(-1 + i, 6 + i * 2)) }); + actor.QueueActivity(new Move.Move(insertionLZ.Location)); + } + } + IEnumerable UnitsNearActor(Actor self, Actor actor, int range) { return self.World.FindUnitsInCircle(actor.CenterLocation, Game.CellSize * range) From e02397da3ee2c4d627ce8ebc8b14ca00e9af641c Mon Sep 17 00:00:00 2001 From: ScottNZ Date: Sun, 1 Jul 2012 03:47:08 +1200 Subject: [PATCH 05/14] Use Sound.PlayMusic for Hell March --- OpenRA.Mods.RA/Missions/Allies01Script.cs | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/OpenRA.Mods.RA/Missions/Allies01Script.cs b/OpenRA.Mods.RA/Missions/Allies01Script.cs index 90b8bd77ba..6e17becbb2 100644 --- a/OpenRA.Mods.RA/Missions/Allies01Script.cs +++ b/OpenRA.Mods.RA/Missions/Allies01Script.cs @@ -34,8 +34,6 @@ namespace OpenRA.Mods.RA.Missions Player allies; Player soviets; - ISound music; - Actor insertionLZ; Actor extractionLZ; Actor lab; @@ -266,7 +264,7 @@ namespace OpenRA.Mods.RA.Missions attackEntryPoint1 = actors["SovietAttackEntryPoint1"]; attackEntryPoint2 = actors["SovietAttackEntryPoint2"]; Game.MoveViewport(insertionLZ.Location.ToFloat2()); - music = Sound.Play("hell226m.aud"); // Hell March + Sound.PlayMusic(Rules.Music["hell226m"]); // Hell March Game.ConnectionStateChanged += StopMusic; } @@ -274,7 +272,7 @@ namespace OpenRA.Mods.RA.Missions { if (!orderManager.GameStarted) { - Sound.StopSound(music); + Sound.StopMusic(); Game.ConnectionStateChanged -= StopMusic; } } From 18d75feb15edae696871168fc433cd231b1bde90 Mon Sep 17 00:00:00 2001 From: ScottNZ Date: Sun, 1 Jul 2012 12:14:12 +1200 Subject: [PATCH 06/14] Adjust the patrol starting position --- OpenRA.Mods.RA/Missions/Allies01Script.cs | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/OpenRA.Mods.RA/Missions/Allies01Script.cs b/OpenRA.Mods.RA/Missions/Allies01Script.cs index 6e17becbb2..073b095010 100644 --- a/OpenRA.Mods.RA/Missions/Allies01Script.cs +++ b/OpenRA.Mods.RA/Missions/Allies01Script.cs @@ -1,10 +1,10 @@ #region Copyright & License Information -/* - * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made - * available to you under the terms of the GNU General Public License - * as published by the Free Software Foundation. For more information, - * see COPYING. +/* + * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) + * This file is part of OpenRA, which is free software. It is made + * available to you under the terms of the GNU General Public License + * as published by the Free Software Foundation. For more information, + * see COPYING. */ #endregion @@ -23,10 +23,10 @@ namespace OpenRA.Mods.RA.Missions class Allies01Script : IWorldLoaded, ITick { - static readonly string[] objectives = - { - "Find Einstein.", - "Wait for the helicopter and extract Einstein." + static readonly string[] objectives = + { + "Find Einstein.", + "Wait for the helicopter and extract Einstein." }; int currentObjective; @@ -187,7 +187,7 @@ namespace OpenRA.Mods.RA.Missions { for (int i = 0; i < patrol.Length; i++) { - var actor = self.World.CreateActor(patrol[i], new TypeDictionary { new OwnerInit(soviets), new LocationInit(insertionLZ.Location + new CVec(-1 + i, 6 + i * 2)) }); + var actor = self.World.CreateActor(patrol[i], new TypeDictionary { new OwnerInit(soviets), new LocationInit(insertionLZ.Location + new CVec(-1 + i, 8 + i * 2)) }); actor.QueueActivity(new Move.Move(insertionLZ.Location)); } } From cbb0b17c319b6bde665aa8f61cf8af4f5d922d4e Mon Sep 17 00:00:00 2001 From: ScottNZ Date: Sun, 1 Jul 2012 12:52:36 +1200 Subject: [PATCH 07/14] Add AutoTargetIgnore for stek --- mods/ra/maps/allies-01.oramap | Bin 2816 -> 2830 bytes 1 file changed, 0 insertions(+), 0 deletions(-) diff --git a/mods/ra/maps/allies-01.oramap b/mods/ra/maps/allies-01.oramap index 8b2dfe1422b032cab792f02babf40ea3dfaffb87..49d3b8bf5f64a3ae3a0af99568b26654470e504a 100644 GIT binary patch delta 1742 zcmV;<1~K`77LFFM>;r!;X5m0*7OT%a1^@u*7ytkW0001OVQ?;aVQp-kSX-CUFc5y; z{t8|^zEn?>^af9|D;_VP96&k87f-fCs9T!a23P#`PSOI>T=e*`OEdYt%uHr7xhz@1 zGC}VPHX5wz1M|EYtzPkZPsL~udEP1)vTIxvIco+1^1PR<$?AW+5;-qV@~4BZdEJP? zK5rTjd*1jUcDx=9mKhh~%lprAoPsq>fav{)wNkRof5E_E>c^qy-SR`ZX-0$8Pkn-Y zl6v09hK-x$jupk8R-?fyS~LvCIaa`$ofORrdSrDo@^0F%1^dcsR%YzQdv*{tEuiP- zJ>3JR6F~dJW7&VKd0lK;mnDLicYJ?O1uex{xS$!(sPa%B|E^}NYA(aK?f)CAoyE&o z;|`~Qm)L*+didil7fm}MQZ(h+gB;$dtLwkx1+UKl)mqR!%qohAkHf%61pa~!y{zbC z*`hniiqZX9&{=!&cv7;xk}Ua;oC$-2UB|`4PH?uiQSE{+px3xoCha-FdFc@xW6VOJ~}hb#&!$>8W7R&#HJyV z`1lHsBfCMNgeThYfeoLI2KRN*vuEgIWV1g30<8;;5ZDOVsKGHqv4MaC2O*JB>jjMv zpCD`0fKY$&$GWG&;RM1aM(AP?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XXWSKB{;xy!`x7;5#Tloy=Ee<8SylKM6&9hrxeLt{Pd@7`6M`&&eIhus2 zx6BUJP{Cd`yjCr>+Gg{QRUuj>n9Y}hHsWN75_T>GXsI4`rP2@Uh3t64Xeobo@CBc9 zh;jfne|S56Y3qAASxilRvTHFVmaf%e^1d_n@(>MKmna!LBl8t)woFJFhJTQcb;&o~ zV<{{%3a^X3{&#nGb1A(A0$1HL`g6^S?G9E>AlvhzzJ+&Y)%2DO<`dX*zSnSR>!u@p zTjk2Y#fR52Qv>-)t1T!|JHda;1H5y?w-mFQH}JjsxLDk+WKzr<{tbL6dmCuO6+ql{lqewPB!Nd4LO_X|+hJoVXiE6Dm2T&4qt*KX>qEn{|(vPEb z7n=Qiw<>K*8Hq3KB#^ypNVi6Vv~@|_UFXx+SBy$iv21o3-aX-~RBfd6746)NPEOZQ zaF!4#u3$6|?1^@ugleY>fE|eXrg0oi50Z-aDz_V7(0Y0-gz_V7(0Z>Z? W1^@s600IC40J8u905=K%00028usp&5 From facf958bae9fd6b092cb17a1fd37820ad83ee9e2 Mon Sep 17 00:00:00 2001 From: ScottNZ Date: Sun, 1 Jul 2012 13:02:23 +1200 Subject: [PATCH 08/14] Move towards extraction LZ if einstein isn't in the world. --- OpenRA.Mods.RA/Missions/Allies01Script.cs | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/OpenRA.Mods.RA/Missions/Allies01Script.cs b/OpenRA.Mods.RA/Missions/Allies01Script.cs index 073b095010..a1e7d5bcfc 100644 --- a/OpenRA.Mods.RA/Missions/Allies01Script.cs +++ b/OpenRA.Mods.RA/Missions/Allies01Script.cs @@ -179,7 +179,16 @@ namespace OpenRA.Mods.RA.Missions { var spawnActor = self.World.SharedRandom.Next(2) == 0 ? attackEntryPoint1 : attackEntryPoint2; var actor = self.World.CreateActor(unit, new TypeDictionary { new OwnerInit(soviets), new LocationInit(spawnActor.Location) }); - actor.QueueActivity(new AttackMove.AttackMoveActivity(actor, new Attack(Target.FromActor(einstein), 3))); // better way of doing this? + Activity innerActivity; + if (einstein != null && einstein.IsInWorld) + { + innerActivity = new Attack(Target.FromActor(einstein), 3); + } + else + { + innerActivity = new Move.Move(extractionLZ.Location, 3); + } + actor.QueueActivity(new AttackMove.AttackMoveActivity(actor, innerActivity)); } } From b74e63f42d062042525716e7b9d645e498188982 Mon Sep 17 00:00:00 2001 From: ScottNZ Date: Sun, 1 Jul 2012 20:30:25 +1200 Subject: [PATCH 09/14] Drain Soviet resources so the ore truck doesn't stay at the refinery --- OpenRA.Mods.RA/Missions/Allies01Script.cs | 9 +++++++++ mods/ra/maps/allies-01.oramap | Bin 2830 -> 2816 bytes 2 files changed, 9 insertions(+) diff --git a/OpenRA.Mods.RA/Missions/Allies01Script.cs b/OpenRA.Mods.RA/Missions/Allies01Script.cs index a1e7d5bcfc..aec5451d68 100644 --- a/OpenRA.Mods.RA/Missions/Allies01Script.cs +++ b/OpenRA.Mods.RA/Missions/Allies01Script.cs @@ -8,6 +8,7 @@ */ #endregion +using System; using System.Collections.Generic; using System.Drawing; using System.Linq; @@ -166,6 +167,14 @@ namespace OpenRA.Mods.RA.Missions { MissionFailed(self, "Tanya was killed."); } + ManageSovietOre(); + } + + void ManageSovietOre() + { + var res = soviets.PlayerActor.Trait(); + res.TakeOre(res.Ore); + res.TakeCash(res.Cash); } void SpawnSignalFlare(Actor self) diff --git a/mods/ra/maps/allies-01.oramap b/mods/ra/maps/allies-01.oramap index 49d3b8bf5f64a3ae3a0af99568b26654470e504a..b646b627f79758ac409acbdfcbc118cb52aab532 100644 GIT binary patch delta 1728 zcmV;x20!_Z7JwG8>;r!dpy5Cp3$6|?1^@ug7ytkW0001OVQ?;aVQp-kSWA!7Fc3a( zenl^cOF*%mXHS%65ug^Twor)+@}{N@o5mq=S<0_x?4&J?A0Q69jmO{TnemLrk0mQv zF6e#9#-mkpV4gRl^=sbjsThwU&s!Bjc1_B%VC^VCp7)Bic~gJXqTtm@{&e)UXj(Da z7i|k-&zl^?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Bit of cleanup --- OpenRA.Mods.RA/Missions/Allies01Script.cs | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/OpenRA.Mods.RA/Missions/Allies01Script.cs b/OpenRA.Mods.RA/Missions/Allies01Script.cs index aec5451d68..596346d2bc 100644 --- a/OpenRA.Mods.RA/Missions/Allies01Script.cs +++ b/OpenRA.Mods.RA/Missions/Allies01Script.cs @@ -1,6 +1,6 @@ #region Copyright & License Information /* - * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) + * Copyright 2007-2012 The OpenRA Developers (see AUTHORS) * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, @@ -8,7 +8,6 @@ */ #endregion -using System; using System.Collections.Generic; using System.Drawing; using System.Linq; @@ -255,7 +254,6 @@ namespace OpenRA.Mods.RA.Missions 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) }); chinook.Trait().Load(chinook, tanya); - // use CenterLocation for HeliFly, Location for Move chinook.QueueActivity(new HeliFly(insertionLZ.CenterLocation)); chinook.QueueActivity(new Turn(0)); chinook.QueueActivity(new HeliLand(true)); From 8b0f15f80bc2763e4085576cbf44a53ea338cb30 Mon Sep 17 00:00:00 2001 From: ScottNZ Date: Mon, 2 Jul 2012 04:21:10 +1200 Subject: [PATCH 11/14] Bring Soviet patrol back a bit --- OpenRA.Mods.RA/Missions/Allies01Script.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/OpenRA.Mods.RA/Missions/Allies01Script.cs b/OpenRA.Mods.RA/Missions/Allies01Script.cs index 596346d2bc..9fc74f33ab 100644 --- a/OpenRA.Mods.RA/Missions/Allies01Script.cs +++ b/OpenRA.Mods.RA/Missions/Allies01Script.cs @@ -204,7 +204,7 @@ namespace OpenRA.Mods.RA.Missions { for (int i = 0; i < patrol.Length; i++) { - var actor = self.World.CreateActor(patrol[i], new TypeDictionary { new OwnerInit(soviets), new LocationInit(insertionLZ.Location + new CVec(-1 + i, 8 + i * 2)) }); + var actor = self.World.CreateActor(patrol[i], new TypeDictionary { new OwnerInit(soviets), new LocationInit(insertionLZ.Location + new CVec(-1 + i, 10 + i * 2)) }); actor.QueueActivity(new Move.Move(insertionLZ.Location)); } } From 5897a44fc570c0ba26bb739b615c69a2ffffb7d9 Mon Sep 17 00:00:00 2001 From: ScottNZ Date: Mon, 2 Jul 2012 04:22:23 +1200 Subject: [PATCH 12/14] Remove unneeded barrel YAML overrides --- mods/ra/maps/allies-01.oramap | Bin 2816 -> 2803 bytes 1 file changed, 0 insertions(+), 0 deletions(-) diff --git a/mods/ra/maps/allies-01.oramap b/mods/ra/maps/allies-01.oramap index b646b627f79758ac409acbdfcbc118cb52aab532..de8be6da0921efada557bb8d7f0c0c4d55eb6c92 100644 GIT binary patch delta 719 zcmV;=0x;nz8BH}=!!`Or(1^@tyd-M+E+Y9=)vTW7VO1$%@haSI=F%XWX~YlpGeAe4@gMAOT-~j! z37J-+IXcI{zBO@iV(`^m&u(``#rebZXCYkLGSSvmi(y}8oH-#Kc!qi)4hia%`uNq#f zmRfDI`NygdtrE=UOFp@s0GmI&y?bfv zTP-H2eluV}MnLdr1wgUqT+zUiJlVZl&%C+tUhH=WL<^cDzQb2S+dlJ2wR9lIC zF3C`EXr3Qn*&LNaO0=g^Gs3}aCfg7{2zpW8v1%(|9956kwAnGb8F#uG`8kSY;}bk_ zAJjyt=Vcfu4xXsinsWdpQP;YYQ*`Q7QTlO|?n1Ml?^Y#XMkyolg`EVlcMXZtXppup zX}jxu`ud7dX)2b@E?2w9c$IXGl)j>!o6*VX8cN3!0tGfc(0k7J2%nW*^>&If&-=s+ z70KU|HwtA9wIbp`qr=#QA_f2en3JgrDGj$CY?-B3%>lO_Y?-B#-wGQBDhdDq003Qc BU1|UT delta 754 zcmV;nxApy5Cp3$6|?1^@ugllcQ917#7QvmXQn0Wq5L{6P+H)YbRj z@{%`afNCx19%dCq#K&RaBLaUxk6zaFvFgyhWX0(IEaUG`0hhZs(Qa1A0#5@Sjva8M!-)ZIn`>m5 zFnHoLUNyW{ zEw$Qa^N&>_S|ymxmx4CpWQh`XE(B<)9(ASC59@{Oc*AHZcJKwCe{+a(05*SkJAG;E zdpTK5O?|R!F(sC+)nf9#GxqWj4Oy2c89XEN6>YXmNEwEIkdJlAH{D|?EHetPi@pAL zcXx9sy#)eS-81@g&5G>~R!$(>^P;|mcV^Y}mJH?-*mAztaB1tNBYj)t%D}~k*D_NB z`AMrSC{a7X%LBY~f5W#Fvzj;Xz52LV+^u9%%p3jn8AKO`9E~ zn{lVBk)NYTHa@|__(4sSdX$EN;^2vDtvLr!5_PSqoT5{wQwq|LqjVRV{d~77ZA%%6 zFYF|cy=zFfMuW6j0Hb{XD1;j2__r1TZ-+>B06*HCbl5Gb(mf!=ez zNBFGls<%^=dEO^ps7U?>lPU^j4Go~-KpP9L4lf1(0M3(~3Mnp$M=_FLSIq&5M=_FL kSIq%Fvp2xAR?PuWO9ci10000200IEB0000t3IG5A0F%9FeE Date: Mon, 2 Jul 2012 14:03:26 +1200 Subject: [PATCH 13/14] Remove bad/duplicate UnloadCargo line --- OpenRA.Mods.RA/Missions/Allies01Script.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/OpenRA.Mods.RA/Missions/Allies01Script.cs b/OpenRA.Mods.RA/Missions/Allies01Script.cs index 011fc95a06..94e5543e55 100644 --- a/OpenRA.Mods.RA/Missions/Allies01Script.cs +++ b/OpenRA.Mods.RA/Missions/Allies01Script.cs @@ -257,7 +257,6 @@ namespace OpenRA.Mods.RA.Missions chinook.QueueActivity(new HeliFly(insertionLZ.CenterLocation)); chinook.QueueActivity(new Turn(0)); chinook.QueueActivity(new HeliLand(true)); - chinook.QueueActivity(new UnloadCargo()); chinook.QueueActivity(new UnloadCargo(true)); chinook.QueueActivity(new CallFunc(() => Sound.Play("laugh1.aud"))); chinook.QueueActivity(new Wait(150)); From 4a101cf1b1219e5e1b0259d022c1ed6d82ce1dee Mon Sep 17 00:00:00 2001 From: ScottNZ Date: Mon, 2 Jul 2012 16:19:57 +1200 Subject: [PATCH 14/14] Convert line endings --- OpenRA.Mods.RA/Missions/Allies01Script.cs | 592 +++++++++++----------- 1 file changed, 296 insertions(+), 296 deletions(-) diff --git a/OpenRA.Mods.RA/Missions/Allies01Script.cs b/OpenRA.Mods.RA/Missions/Allies01Script.cs index 94e5543e55..5c0e39507d 100644 --- a/OpenRA.Mods.RA/Missions/Allies01Script.cs +++ b/OpenRA.Mods.RA/Missions/Allies01Script.cs @@ -1,296 +1,296 @@ -#region Copyright & License Information -/* - * Copyright 2007-2012 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made - * available to you under the terms of the GNU General Public License - * as published by the Free Software Foundation. For more information, - * see COPYING. - */ -#endregion - -using System.Collections.Generic; -using System.Drawing; -using System.Linq; -using OpenRA.FileFormats; -using OpenRA.Mods.RA.Activities; -using OpenRA.Mods.RA.Air; -using OpenRA.Network; -using OpenRA.Traits; - -namespace OpenRA.Mods.RA.Missions -{ - class Allies01ScriptInfo : TraitInfo, Requires { } - - class Allies01Script : IWorldLoaded, ITick - { - static readonly string[] objectives = - { - "Find Einstein.", - "Wait for the helicopter and extract Einstein." - }; - - int currentObjective; - - Player allies; - Player soviets; - - Actor insertionLZ; - Actor extractionLZ; - Actor lab; - Actor insertionLZEntryPoint; - Actor extractionLZEntryPoint; - Actor chinookExitPoint; - Actor shipSpawnPoint; - Actor shipMovePoint; - Actor einstein; - Actor einsteinChinook; - Actor tanya; - Actor attackEntryPoint1; - Actor attackEntryPoint2; - - static readonly string[] taunts = { "laugh1.aud", "lefty1.aud", "cmon1.aud", "gotit1.aud" }; - - static readonly string[] ships = { "ca", "ca", "ca", "ca" }; - static readonly string[] patrol = { "e1", "dog", "e1" }; - - static readonly string[] attackWave = { "e1", "e1", "e1", "e1", "e2", "e2", "e2", "e2", "dog" }; - static readonly string[] lastAttackWaveAddition = { "3tnk", "e1", "e1", "e1", "e1", "e2", "e2", "e2", "e2" }; - int currentAttackWaveFrameNumber; - int currentAttackWave; - const int einsteinChinookArrivesAtAttackWave = 5; - - const int labRange = 5; - const string einsteinName = "einstein"; - const string tanyaName = "e7"; - const string chinookName = "tran"; - const string signalFlareName = "flare"; - - void DisplayObjective() - { - Game.AddChatLine(Color.LimeGreen, "Objective", objectives[currentObjective]); - Sound.Play("bleep6.aud", 5); - } - - void MissionFailed(Actor self, string text) - { - if (allies.WinState != WinState.Undefined) - { - return; - } - allies.WinState = WinState.Lost; - Game.AddChatLine(Color.Red, "Mission failed", text); - self.World.LocalShroud.Disabled = true; - Sound.Play("misnlst1.aud", 5); - } - - void MissionAccomplished(Actor self, string text) - { - if (allies.WinState != WinState.Undefined) - { - return; - } - 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) - { - if (allies.WinState != WinState.Undefined) - { - return; - } - // display current objective every so often - if (self.World.FrameNumber % 1500 == 1) - { - DisplayObjective(); - } - // taunt every so often - if (self.World.FrameNumber % 1000 == 0) - { - Sound.Play(taunts[self.World.SharedRandom.Next(taunts.Length)]); - } - // take Tanya to the LZ - if (self.World.FrameNumber == 1) - { - FlyTanyaToInsertionLZ(self); - SendPatrol(self); - } - // objectives - if (currentObjective == 0) - { - 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); - currentObjective++; - DisplayObjective(); - currentAttackWaveFrameNumber = self.World.FrameNumber; - } - if (lab.Destroyed) - { - MissionFailed(self, "Einstein was killed."); - } - } - else if (currentObjective == 1) - { - 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) - { - FlyEinsteinFromExtractionLZ(self); - } - } - if (einsteinChinook != null && !self.World.Map.IsInMap(einsteinChinook.Location) && einsteinChinook.Trait().Passengers.Contains(einstein)) - { - MissionAccomplished(self, "Einstein was rescued."); - } - if (einstein.Destroyed) - { - MissionFailed(self, "Einstein was killed."); - } - } - if (tanya.Destroyed) - { - MissionFailed(self, "Tanya was killed."); - } - ManageSovietOre(); - } - - void ManageSovietOre() - { - var res = soviets.PlayerActor.Trait(); - res.TakeOre(res.Ore); - res.TakeCash(res.Cash); - } - - void SpawnSignalFlare(Actor self) - { - self.World.CreateActor(signalFlareName, new TypeDictionary { new OwnerInit(allies), new LocationInit(extractionLZ.Location) }); - } - - void SendAttackWave(Actor self, IEnumerable wave) - { - foreach (var unit in wave) - { - var spawnActor = self.World.SharedRandom.Next(2) == 0 ? attackEntryPoint1 : attackEntryPoint2; - var actor = self.World.CreateActor(unit, new TypeDictionary { new OwnerInit(soviets), new LocationInit(spawnActor.Location) }); - Activity innerActivity; - if (einstein != null && einstein.IsInWorld) - { - innerActivity = new Attack(Target.FromActor(einstein), 3); - } - else - { - innerActivity = new Move.Move(extractionLZ.Location, 3); - } - actor.QueueActivity(new AttackMove.AttackMoveActivity(actor, innerActivity)); - } - } - - void SendPatrol(Actor self) - { - for (int i = 0; i < patrol.Length; i++) - { - var actor = self.World.CreateActor(patrol[i], new TypeDictionary { new OwnerInit(soviets), new LocationInit(insertionLZ.Location + new CVec(-1 + i, 10 + i * 2)) }); - actor.QueueActivity(new Move.Move(insertionLZ.Location)); - } - } - - IEnumerable UnitsNearActor(Actor self, Actor actor, int range) - { - return self.World.FindUnitsInCircle(actor.CenterLocation, Game.CellSize * range) - .Where(a => a.IsInWorld && a != self.World.WorldActor && !a.Destroyed && a.HasTrait() && !a.Owner.NonCombatant); - } - - bool AlliesControlLab(Actor self) - { - var units = UnitsNearActor(self, lab, labRange); - return units.Any() && units.All(a => a.Owner == allies); - } - - void SpawnEinsteinAtLab(Actor self) - { - 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))); - } - - void SendShips(Actor self) - { - for (int i = 0; i < ships.Length; i++) - { - var actor = self.World.CreateActor(ships[i], - new TypeDictionary { new OwnerInit(allies), new LocationInit(shipSpawnPoint.Location + new CVec(i * 2, 0)) }); - actor.QueueActivity(new Move.Move(shipMovePoint.Location + new CVec(i * 4, 0))); - } - } - - 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().Passengers.Contains(einstein))); - einsteinChinook.QueueActivity(new Wait(150)); - einsteinChinook.QueueActivity(new HeliFly(chinookExitPoint.CenterLocation)); - einsteinChinook.QueueActivity(new RemoveSelf()); - } - - void FlyTanyaToInsertionLZ(Actor self) - { - 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) }); - chinook.Trait().Load(chinook, tanya); - chinook.QueueActivity(new HeliFly(insertionLZ.CenterLocation)); - chinook.QueueActivity(new Turn(0)); - chinook.QueueActivity(new HeliLand(true)); - chinook.QueueActivity(new UnloadCargo(true)); - chinook.QueueActivity(new CallFunc(() => Sound.Play("laugh1.aud"))); - chinook.QueueActivity(new Wait(150)); - chinook.QueueActivity(new HeliFly(chinookExitPoint.CenterLocation)); - chinook.QueueActivity(new RemoveSelf()); - } - - public void WorldLoaded(World w) - { - allies = w.Players.Single(p => p.InternalName == "Allies"); - soviets = w.Players.Single(p => p.InternalName == "Soviets"); - var actors = w.WorldActor.Trait().Actors; - insertionLZ = actors["InsertionLZ"]; - extractionLZ = actors["ExtractionLZ"]; - lab = actors["Lab"]; - insertionLZEntryPoint = actors["InsertionLZEntryPoint"]; - chinookExitPoint = actors["ChinookExitPoint"]; - extractionLZEntryPoint = actors["ExtractionLZEntryPoint"]; - shipSpawnPoint = actors["ShipSpawnPoint"]; - shipMovePoint = actors["ShipMovePoint"]; - attackEntryPoint1 = actors["SovietAttackEntryPoint1"]; - attackEntryPoint2 = actors["SovietAttackEntryPoint2"]; - Game.MoveViewport(insertionLZ.Location.ToFloat2()); - Sound.PlayMusic(Rules.Music["hell226m"]); // Hell March - Game.ConnectionStateChanged += StopMusic; - } - - void StopMusic(OrderManager orderManager) - { - if (!orderManager.GameStarted) - { - Sound.StopMusic(); - Game.ConnectionStateChanged -= StopMusic; - } - } - } -} +#region Copyright & License Information +/* + * Copyright 2007-2012 The OpenRA Developers (see AUTHORS) + * This file is part of OpenRA, which is free software. It is made + * available to you under the terms of the GNU General Public License + * as published by the Free Software Foundation. For more information, + * see COPYING. + */ +#endregion + +using System.Collections.Generic; +using System.Drawing; +using System.Linq; +using OpenRA.FileFormats; +using OpenRA.Mods.RA.Activities; +using OpenRA.Mods.RA.Air; +using OpenRA.Network; +using OpenRA.Traits; + +namespace OpenRA.Mods.RA.Missions +{ + class Allies01ScriptInfo : TraitInfo, Requires { } + + class Allies01Script : IWorldLoaded, ITick + { + static readonly string[] objectives = + { + "Find Einstein.", + "Wait for the helicopter and extract Einstein." + }; + + int currentObjective; + + Player allies; + Player soviets; + + Actor insertionLZ; + Actor extractionLZ; + Actor lab; + Actor insertionLZEntryPoint; + Actor extractionLZEntryPoint; + Actor chinookExitPoint; + Actor shipSpawnPoint; + Actor shipMovePoint; + Actor einstein; + Actor einsteinChinook; + Actor tanya; + Actor attackEntryPoint1; + Actor attackEntryPoint2; + + static readonly string[] taunts = { "laugh1.aud", "lefty1.aud", "cmon1.aud", "gotit1.aud" }; + + static readonly string[] ships = { "ca", "ca", "ca", "ca" }; + static readonly string[] patrol = { "e1", "dog", "e1" }; + + static readonly string[] attackWave = { "e1", "e1", "e1", "e1", "e2", "e2", "e2", "e2", "dog" }; + static readonly string[] lastAttackWaveAddition = { "3tnk", "e1", "e1", "e1", "e1", "e2", "e2", "e2", "e2" }; + int currentAttackWaveFrameNumber; + int currentAttackWave; + const int einsteinChinookArrivesAtAttackWave = 5; + + const int labRange = 5; + const string einsteinName = "einstein"; + const string tanyaName = "e7"; + const string chinookName = "tran"; + const string signalFlareName = "flare"; + + void DisplayObjective() + { + Game.AddChatLine(Color.LimeGreen, "Objective", objectives[currentObjective]); + Sound.Play("bleep6.aud", 5); + } + + void MissionFailed(Actor self, string text) + { + if (allies.WinState != WinState.Undefined) + { + return; + } + allies.WinState = WinState.Lost; + Game.AddChatLine(Color.Red, "Mission failed", text); + self.World.LocalShroud.Disabled = true; + Sound.Play("misnlst1.aud", 5); + } + + void MissionAccomplished(Actor self, string text) + { + if (allies.WinState != WinState.Undefined) + { + return; + } + 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) + { + if (allies.WinState != WinState.Undefined) + { + return; + } + // display current objective every so often + if (self.World.FrameNumber % 1500 == 1) + { + DisplayObjective(); + } + // taunt every so often + if (self.World.FrameNumber % 1000 == 0) + { + Sound.Play(taunts[self.World.SharedRandom.Next(taunts.Length)]); + } + // take Tanya to the LZ + if (self.World.FrameNumber == 1) + { + FlyTanyaToInsertionLZ(self); + SendPatrol(self); + } + // objectives + if (currentObjective == 0) + { + 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); + currentObjective++; + DisplayObjective(); + currentAttackWaveFrameNumber = self.World.FrameNumber; + } + if (lab.Destroyed) + { + MissionFailed(self, "Einstein was killed."); + } + } + else if (currentObjective == 1) + { + 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) + { + FlyEinsteinFromExtractionLZ(self); + } + } + if (einsteinChinook != null && !self.World.Map.IsInMap(einsteinChinook.Location) && einsteinChinook.Trait().Passengers.Contains(einstein)) + { + MissionAccomplished(self, "Einstein was rescued."); + } + if (einstein.Destroyed) + { + MissionFailed(self, "Einstein was killed."); + } + } + if (tanya.Destroyed) + { + MissionFailed(self, "Tanya was killed."); + } + ManageSovietOre(); + } + + void ManageSovietOre() + { + var res = soviets.PlayerActor.Trait(); + res.TakeOre(res.Ore); + res.TakeCash(res.Cash); + } + + void SpawnSignalFlare(Actor self) + { + self.World.CreateActor(signalFlareName, new TypeDictionary { new OwnerInit(allies), new LocationInit(extractionLZ.Location) }); + } + + void SendAttackWave(Actor self, IEnumerable wave) + { + foreach (var unit in wave) + { + var spawnActor = self.World.SharedRandom.Next(2) == 0 ? attackEntryPoint1 : attackEntryPoint2; + var actor = self.World.CreateActor(unit, new TypeDictionary { new OwnerInit(soviets), new LocationInit(spawnActor.Location) }); + Activity innerActivity; + if (einstein != null && einstein.IsInWorld) + { + innerActivity = new Attack(Target.FromActor(einstein), 3); + } + else + { + innerActivity = new Move.Move(extractionLZ.Location, 3); + } + actor.QueueActivity(new AttackMove.AttackMoveActivity(actor, innerActivity)); + } + } + + void SendPatrol(Actor self) + { + for (int i = 0; i < patrol.Length; i++) + { + var actor = self.World.CreateActor(patrol[i], new TypeDictionary { new OwnerInit(soviets), new LocationInit(insertionLZ.Location + new CVec(-1 + i, 10 + i * 2)) }); + actor.QueueActivity(new Move.Move(insertionLZ.Location)); + } + } + + IEnumerable UnitsNearActor(Actor self, Actor actor, int range) + { + return self.World.FindUnitsInCircle(actor.CenterLocation, Game.CellSize * range) + .Where(a => a.IsInWorld && a != self.World.WorldActor && !a.Destroyed && a.HasTrait() && !a.Owner.NonCombatant); + } + + bool AlliesControlLab(Actor self) + { + var units = UnitsNearActor(self, lab, labRange); + return units.Any() && units.All(a => a.Owner == allies); + } + + void SpawnEinsteinAtLab(Actor self) + { + 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))); + } + + void SendShips(Actor self) + { + for (int i = 0; i < ships.Length; i++) + { + var actor = self.World.CreateActor(ships[i], + new TypeDictionary { new OwnerInit(allies), new LocationInit(shipSpawnPoint.Location + new CVec(i * 2, 0)) }); + actor.QueueActivity(new Move.Move(shipMovePoint.Location + new CVec(i * 4, 0))); + } + } + + 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().Passengers.Contains(einstein))); + einsteinChinook.QueueActivity(new Wait(150)); + einsteinChinook.QueueActivity(new HeliFly(chinookExitPoint.CenterLocation)); + einsteinChinook.QueueActivity(new RemoveSelf()); + } + + void FlyTanyaToInsertionLZ(Actor self) + { + 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) }); + chinook.Trait().Load(chinook, tanya); + chinook.QueueActivity(new HeliFly(insertionLZ.CenterLocation)); + chinook.QueueActivity(new Turn(0)); + chinook.QueueActivity(new HeliLand(true)); + chinook.QueueActivity(new UnloadCargo(true)); + chinook.QueueActivity(new CallFunc(() => Sound.Play("laugh1.aud"))); + chinook.QueueActivity(new Wait(150)); + chinook.QueueActivity(new HeliFly(chinookExitPoint.CenterLocation)); + chinook.QueueActivity(new RemoveSelf()); + } + + public void WorldLoaded(World w) + { + allies = w.Players.Single(p => p.InternalName == "Allies"); + soviets = w.Players.Single(p => p.InternalName == "Soviets"); + var actors = w.WorldActor.Trait().Actors; + insertionLZ = actors["InsertionLZ"]; + extractionLZ = actors["ExtractionLZ"]; + lab = actors["Lab"]; + insertionLZEntryPoint = actors["InsertionLZEntryPoint"]; + chinookExitPoint = actors["ChinookExitPoint"]; + extractionLZEntryPoint = actors["ExtractionLZEntryPoint"]; + shipSpawnPoint = actors["ShipSpawnPoint"]; + shipMovePoint = actors["ShipMovePoint"]; + attackEntryPoint1 = actors["SovietAttackEntryPoint1"]; + attackEntryPoint2 = actors["SovietAttackEntryPoint2"]; + Game.MoveViewport(insertionLZ.Location.ToFloat2()); + Sound.PlayMusic(Rules.Music["hell226m"]); // Hell March + Game.ConnectionStateChanged += StopMusic; + } + + void StopMusic(OrderManager orderManager) + { + if (!orderManager.GameStarted) + { + Sound.StopMusic(); + Game.ConnectionStateChanged -= StopMusic; + } + } + } +}