Start work on Monster Tank Madness mission
This commit is contained in:
@@ -253,7 +253,7 @@ namespace OpenRA.Mods.RA.Missions
|
|||||||
foreach (var actor in world.Actors.Where(a => !a.IsDead() && a.HasTrait<Allies04TransformOnLabInfiltrate>()))
|
foreach (var actor in world.Actors.Where(a => !a.IsDead() && a.HasTrait<Allies04TransformOnLabInfiltrate>()))
|
||||||
actor.QueueActivity(false, new Transform(actor, actor.Info.Traits.Get<Allies04TransformOnLabInfiltrateInfo>().ToActor) { SkipMakeAnims = true });
|
actor.QueueActivity(false, new Transform(actor, actor.Info.Traits.Get<Allies04TransformOnLabInfiltrateInfo>().ToActor) { SkipMakeAnims = true });
|
||||||
|
|
||||||
lab.AddTrait(new Allies04TransformedAction(self => lab = self));
|
lab.AddTrait(new TransformedAction(self => lab = self));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -278,7 +278,7 @@ namespace OpenRA.Mods.RA.Missions
|
|||||||
allies2.PlayerActor.Trait<PlayerResources>().GiveCash(2500);
|
allies2.PlayerActor.Trait<PlayerResources>().GiveCash(2500);
|
||||||
}));
|
}));
|
||||||
|
|
||||||
lst.AddTrait(new Allies04TransformedAction(self =>
|
lst.AddTrait(new TransformedAction(self =>
|
||||||
{
|
{
|
||||||
self.QueueActivity(new Wait(10));
|
self.QueueActivity(new Wait(10));
|
||||||
self.QueueActivity(new Move.Move(reinforcementsEntryPoint.Location));
|
self.QueueActivity(new Move.Move(reinforcementsEntryPoint.Location));
|
||||||
@@ -333,7 +333,7 @@ namespace OpenRA.Mods.RA.Missions
|
|||||||
lst.Trait<Cargo>().Load(lst, allies2Spy);
|
lst.Trait<Cargo>().Load(lst, allies2Spy);
|
||||||
}
|
}
|
||||||
|
|
||||||
lst.AddTrait(new Allies04TransformedAction(self =>
|
lst.AddTrait(new TransformedAction(self =>
|
||||||
{
|
{
|
||||||
self.QueueActivity(new Wait(10));
|
self.QueueActivity(new Wait(10));
|
||||||
self.QueueActivity(new Move.Move(spyReinforcementsExitPoint.Location));
|
self.QueueActivity(new Move.Move(spyReinforcementsExitPoint.Location));
|
||||||
@@ -555,19 +555,4 @@ namespace OpenRA.Mods.RA.Missions
|
|||||||
}
|
}
|
||||||
|
|
||||||
class Allies04TransformOnLabInfiltrate { }
|
class Allies04TransformOnLabInfiltrate { }
|
||||||
|
|
||||||
class Allies04TransformedAction : INotifyTransformed
|
|
||||||
{
|
|
||||||
Action<Actor> a;
|
|
||||||
|
|
||||||
public Allies04TransformedAction(Action<Actor> a)
|
|
||||||
{
|
|
||||||
this.a = a;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void OnTransformed(Actor toActor)
|
|
||||||
{
|
|
||||||
a(toActor);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -204,5 +204,34 @@ namespace OpenRA.Mods.RA.Missions
|
|||||||
|
|
||||||
Sound.Play("misnlst1.aud");
|
Sound.Play("misnlst1.aud");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void SpawnAndMoveActors(World world, Player player, string[] actorNames, CPos entry, CPos move, int facing)
|
||||||
|
{
|
||||||
|
foreach (var actor in actorNames)
|
||||||
|
{
|
||||||
|
world.CreateActor(actor, new TypeDictionary
|
||||||
|
{
|
||||||
|
new LocationInit(entry),
|
||||||
|
new OwnerInit(player),
|
||||||
|
new FacingInit(facing)
|
||||||
|
})
|
||||||
|
.QueueActivity(new Move.Move(move));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class TransformedAction : INotifyTransformed
|
||||||
|
{
|
||||||
|
Action<Actor> a;
|
||||||
|
|
||||||
|
public TransformedAction(Action<Actor> a)
|
||||||
|
{
|
||||||
|
this.a = a;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void OnTransformed(Actor toActor)
|
||||||
|
{
|
||||||
|
a(toActor);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
217
OpenRA.Mods.RA/Missions/MonsterTankMadnessScript.cs
Normal file
217
OpenRA.Mods.RA/Missions/MonsterTankMadnessScript.cs
Normal file
@@ -0,0 +1,217 @@
|
|||||||
|
#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;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using OpenRA.Traits;
|
||||||
|
using OpenRA.FileFormats;
|
||||||
|
using OpenRA.Mods.RA.Activities;
|
||||||
|
using OpenRA.Mods.RA.Move;
|
||||||
|
using OpenRA.Mods.RA.Buildings;
|
||||||
|
|
||||||
|
namespace OpenRA.Mods.RA.Missions
|
||||||
|
{
|
||||||
|
class MonsterTankMadnessScriptInfo : ITraitInfo, Requires<SpawnMapActorsInfo>
|
||||||
|
{
|
||||||
|
public readonly string[] FirstStartUnits = null;
|
||||||
|
public readonly string[] SecondStartUnits = null;
|
||||||
|
public readonly string[] ThirdStartUnits = null;
|
||||||
|
public readonly string[] FirstBaseUnits = null;
|
||||||
|
|
||||||
|
public object Create(ActorInitializer init) { return new MonsterTankMadnessScript(this); }
|
||||||
|
}
|
||||||
|
|
||||||
|
class MonsterTankMadnessScript : IHasObjectives, IWorldLoaded, ITick
|
||||||
|
{
|
||||||
|
MonsterTankMadnessScriptInfo info;
|
||||||
|
|
||||||
|
public MonsterTankMadnessScript(MonsterTankMadnessScriptInfo info)
|
||||||
|
{
|
||||||
|
this.info = info;
|
||||||
|
}
|
||||||
|
|
||||||
|
public event Action<bool> OnObjectivesUpdated = notify => { };
|
||||||
|
|
||||||
|
public IEnumerable<Objective> Objectives { get { return objectives.Values; } }
|
||||||
|
|
||||||
|
Dictionary<int, Objective> objectives = new Dictionary<int, Objective>
|
||||||
|
{
|
||||||
|
{ BriefingID, new Objective(ObjectiveType.Primary, Briefing, ObjectiveStatus.InProgress) }
|
||||||
|
};
|
||||||
|
|
||||||
|
const int BriefingID = 0;
|
||||||
|
const string Briefing = "Dr. Demitri, creator of a Soviet Super Tank, wants to defect."
|
||||||
|
+ " We planned to extract him while the Soviets were testing their new weapon, but something has gone wrong."
|
||||||
|
+ " The Super Tanks are out of control, and Demitri is missing -- likely hiding in the village to the far south."
|
||||||
|
+ " Find our outpost and start repairs on it, then find and evacuate Demitri."
|
||||||
|
+ " As for the tanks, we can reprogram them. Send a spy into the Soviet radar dome in the NE, turning the tanks on their creators.";
|
||||||
|
|
||||||
|
World world;
|
||||||
|
|
||||||
|
Player neutral;
|
||||||
|
Player greece;
|
||||||
|
Player ussr;
|
||||||
|
Player turkey;
|
||||||
|
|
||||||
|
Actor startEntryPoint;
|
||||||
|
Actor startMovePoint;
|
||||||
|
Actor startBridgeEndPoint;
|
||||||
|
Actor alliedBaseTopLeft;
|
||||||
|
Actor alliedBaseBottomRight;
|
||||||
|
Actor alliedBaseProc;
|
||||||
|
Actor alliedBaseEntryPoint;
|
||||||
|
Actor alliedBaseMovePoint;
|
||||||
|
|
||||||
|
Actor demitriChurch;
|
||||||
|
Actor demitriChurchSpawnPoint;
|
||||||
|
Actor demitriTriggerAreaCenter;
|
||||||
|
Actor demitri;
|
||||||
|
Actor demitriLZ;
|
||||||
|
Actor demitriLZFlare;
|
||||||
|
Actor demitriChinook;
|
||||||
|
|
||||||
|
int baseTransferredTick = -1;
|
||||||
|
|
||||||
|
void MissionAccomplished(string text)
|
||||||
|
{
|
||||||
|
MissionUtils.CoopMissionAccomplished(world, text, ussr);
|
||||||
|
}
|
||||||
|
|
||||||
|
void MissionFailed(string text)
|
||||||
|
{
|
||||||
|
MissionUtils.CoopMissionFailed(world, text, ussr);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Tick(Actor self)
|
||||||
|
{
|
||||||
|
if (greece.WinState != WinState.Undefined) return;
|
||||||
|
|
||||||
|
if (world.FrameNumber == 1)
|
||||||
|
{
|
||||||
|
Sound.Play("reinfor1.aud");
|
||||||
|
SpawnAndMoveBridgeUnits(info.FirstStartUnits);
|
||||||
|
}
|
||||||
|
|
||||||
|
else if (world.FrameNumber == 25 * 3)
|
||||||
|
{
|
||||||
|
Sound.Play("reinfor1.aud");
|
||||||
|
SpawnAndMoveBridgeUnits(info.SecondStartUnits);
|
||||||
|
}
|
||||||
|
|
||||||
|
else if (world.FrameNumber == 25 * 8)
|
||||||
|
{
|
||||||
|
Sound.Play("reinfor1.aud");
|
||||||
|
SpawnAndMoveBridgeUnits(info.ThirdStartUnits);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (baseTransferredTick == -1)
|
||||||
|
{
|
||||||
|
var actorsInBase = world.FindUnits(alliedBaseTopLeft.CenterLocation, alliedBaseBottomRight.CenterLocation).Where(a => !a.IsDead() && a.IsInWorld);
|
||||||
|
if (actorsInBase.Any(a => a.Owner == greece))
|
||||||
|
{
|
||||||
|
foreach (var actor in actorsInBase)
|
||||||
|
{
|
||||||
|
// hack hack hack
|
||||||
|
actor.ChangeOwner(greece);
|
||||||
|
if (actor.Info.Name == "pbox")
|
||||||
|
{
|
||||||
|
actor.AddTrait(new TransformedAction(s => s.Trait<Cargo>().Load(s,
|
||||||
|
world.CreateActor(false, "e1", new TypeDictionary { new OwnerInit(greece) }))));
|
||||||
|
actor.QueueActivity(new Transform(actor, "hbox.e1") { SkipMakeAnims = true });
|
||||||
|
}
|
||||||
|
else if (actor.Info.Name == "proc.nofreeactor")
|
||||||
|
{
|
||||||
|
actor.QueueActivity(new Transform(actor, "proc") { SkipMakeAnims = true });
|
||||||
|
}
|
||||||
|
var building = actor.TraitOrDefault<Building>();
|
||||||
|
if (building != null)
|
||||||
|
building.OnCapture(actor, actor, neutral, greece);
|
||||||
|
}
|
||||||
|
baseTransferredTick = world.FrameNumber;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
if (demitri == null)
|
||||||
|
{
|
||||||
|
if (demitriChurch.IsDead())
|
||||||
|
MissionFailed("Dr. Demitri was killed.");
|
||||||
|
|
||||||
|
else if (world.FindAliveCombatantActorsInCircle(demitriTriggerAreaCenter.CenterLocation, 3).Any(a => a.Owner == greece))
|
||||||
|
{
|
||||||
|
demitri = world.CreateActor("demitri", new TypeDictionary
|
||||||
|
{
|
||||||
|
new OwnerInit(greece),
|
||||||
|
new LocationInit(demitriChurchSpawnPoint.Location)
|
||||||
|
});
|
||||||
|
demitri.QueueActivity(new Move.Move(demitriTriggerAreaCenter.Location, 0));
|
||||||
|
demitriLZFlare = world.CreateActor("flare", new TypeDictionary { new OwnerInit(greece), new LocationInit(demitriLZ.Location) });
|
||||||
|
Sound.Play("flaren1.aud");
|
||||||
|
var chinookEntry = new CPos(demitriLZ.Location.X, 0);
|
||||||
|
demitriChinook = MissionUtils.ExtractUnitWithChinook(world, greece, demitri, chinookEntry, demitriLZ.Location, chinookEntry);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (demitri.IsDead())
|
||||||
|
MissionFailed("Dr. Demitri was killed.");
|
||||||
|
else if (demitriChinook != null && !demitriChinook.IsDead() && !world.Map.IsInMap(demitriChinook.Location) && demitriChinook.Trait<Cargo>().Passengers.Contains(demitri))
|
||||||
|
{
|
||||||
|
demitriLZFlare.Destroy();
|
||||||
|
Sound.Play("reinfor1.aud");
|
||||||
|
SpawnAndMoveAlliedBaseUnits(info.FirstBaseUnits);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void SpawnAndMoveBridgeUnits(string[] units)
|
||||||
|
{
|
||||||
|
MissionUtils.SpawnAndMoveActors(world, greece, units, startEntryPoint.Location, startMovePoint.Location,
|
||||||
|
Util.GetFacing(startBridgeEndPoint.CenterLocation - startEntryPoint.CenterLocation, 0));
|
||||||
|
}
|
||||||
|
|
||||||
|
void SpawnAndMoveAlliedBaseUnits(string[] units)
|
||||||
|
{
|
||||||
|
MissionUtils.SpawnAndMoveActors(world, greece, units, alliedBaseEntryPoint.Location, alliedBaseMovePoint.Location,
|
||||||
|
Util.GetFacing(alliedBaseMovePoint.CenterLocation - alliedBaseEntryPoint.CenterLocation, 0));
|
||||||
|
}
|
||||||
|
|
||||||
|
public void WorldLoaded(World w)
|
||||||
|
{
|
||||||
|
world = w;
|
||||||
|
|
||||||
|
neutral = w.Players.Single(p => p.InternalName == "Neutral");
|
||||||
|
greece = w.Players.Single(p => p.InternalName == "Greece");
|
||||||
|
ussr = w.Players.Single(p => p.InternalName == "USSR");
|
||||||
|
turkey = w.Players.Single(p => p.InternalName == "Turkey");
|
||||||
|
|
||||||
|
greece.PlayerActor.Trait<PlayerResources>().Cash = 0;
|
||||||
|
ussr.PlayerActor.Trait<PlayerResources>().Cash = 2000;
|
||||||
|
|
||||||
|
var actors = w.WorldActor.Trait<SpawnMapActors>().Actors;
|
||||||
|
startEntryPoint = actors["StartEntryPoint"];
|
||||||
|
startMovePoint = actors["StartMovePoint"];
|
||||||
|
startBridgeEndPoint = actors["StartBridgeEndPoint"];
|
||||||
|
alliedBaseTopLeft = actors["AlliedBaseTopLeft"];
|
||||||
|
alliedBaseBottomRight = actors["AlliedBaseBottomRight"];
|
||||||
|
alliedBaseProc = actors["AlliedBaseProc"];
|
||||||
|
alliedBaseEntryPoint = actors["AlliedBaseEntryPoint"];
|
||||||
|
alliedBaseMovePoint = actors["AlliedBaseMovePoint"];
|
||||||
|
|
||||||
|
demitriChurch = actors["DemitriChurch"];
|
||||||
|
demitriChurchSpawnPoint = actors["DemitriChurchSpawnPoint"];
|
||||||
|
demitriTriggerAreaCenter = actors["DemitriTriggerAreaCenter"];
|
||||||
|
demitriLZ = actors["DemitriLZ"];
|
||||||
|
|
||||||
|
Game.MoveViewport(startEntryPoint.Location.ToFloat2());
|
||||||
|
MissionUtils.PlayMissionMusic();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -246,6 +246,7 @@
|
|||||||
<Compile Include="Missions\DefaultShellmapScript.cs" />
|
<Compile Include="Missions\DefaultShellmapScript.cs" />
|
||||||
<Compile Include="Missions\MissionUtils.cs" />
|
<Compile Include="Missions\MissionUtils.cs" />
|
||||||
<Compile Include="Missions\MissionWidgets.cs" />
|
<Compile Include="Missions\MissionWidgets.cs" />
|
||||||
|
<Compile Include="Missions\MonsterTankMadnessScript.cs" />
|
||||||
<Compile Include="Missions\Objective.cs" />
|
<Compile Include="Missions\Objective.cs" />
|
||||||
<Compile Include="Missions\Soviet01ClassicScript.cs" />
|
<Compile Include="Missions\Soviet01ClassicScript.cs" />
|
||||||
<Compile Include="Modifiers\FrozenUnderFog.cs" />
|
<Compile Include="Modifiers\FrozenUnderFog.cs" />
|
||||||
|
|||||||
BIN
mods/ra/maps/monster-tank-madness/map.bin
Normal file
BIN
mods/ra/maps/monster-tank-madness/map.bin
Normal file
Binary file not shown.
2740
mods/ra/maps/monster-tank-madness/map.yaml
Normal file
2740
mods/ra/maps/monster-tank-madness/map.yaml
Normal file
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user