Updated code, removed NOD_01, Spaces -> Tabs
NOD01Script Spaces -> Tabs started work on NOD_01 Conflicts: OpenRA.Mods.cnc_sw/OpenRA.Mods.Cnc_sw.csproj removing uneeded files Spaces -> Tabs NOD01Script.cs started work on NOD_01 Conflicts: OpenRA.Mods.cnc_sw/OpenRA.Mods.Cnc_sw.csproj removing uneeded files Did some messing around still broken Spaces -> Tabs #2 Updated the code a little, is somewhat more playable now removed NOD_01
This commit is contained in:
@@ -10,33 +10,37 @@
|
|||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Drawing;
|
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using OpenRA.FileFormats;
|
|
||||||
using OpenRA.Mods.Cnc;
|
using OpenRA.Mods.Cnc;
|
||||||
using OpenRA.Mods.RA;
|
using OpenRA.Mods.RA;
|
||||||
|
using OpenRA.Mods.RA.Air;
|
||||||
using OpenRA.Mods.RA.Move;
|
using OpenRA.Mods.RA.Move;
|
||||||
using OpenRA.Mods.RA.Activities;
|
using OpenRA.Mods.RA.Activities;
|
||||||
using OpenRA.Network;
|
using OpenRA.Mods.RA.Missions;
|
||||||
|
using OpenRA.Mods.RA.Buildings;
|
||||||
using OpenRA.Scripting;
|
using OpenRA.Scripting;
|
||||||
using OpenRA.Traits;
|
using OpenRA.Traits;
|
||||||
|
using OpenRA.FileFormats;
|
||||||
|
|
||||||
namespace OpenRA.Mods.Cnc.Missions
|
namespace OpenRA.Mods.Cnc.Missions
|
||||||
{
|
{
|
||||||
class Nod01ScriptInfo : TraitInfo<Nod01Script>, Requires<SpawnMapActorsInfo> { }
|
class Nod01ScriptInfo : TraitInfo<Nod01Script>, Requires<SpawnMapActorsInfo> { }
|
||||||
|
|
||||||
class Nod01Script : IWorldLoaded, ITick
|
class Nod01Script : IHasObjectives, IWorldLoaded, ITick
|
||||||
{
|
{
|
||||||
static readonly string[] Objectives =
|
public event Action<bool> OnObjectivesUpdated = notify => { };
|
||||||
{
|
|
||||||
"Assasinate Nikoomba.",
|
|
||||||
"Level the village."
|
|
||||||
};
|
|
||||||
|
|
||||||
int currentObjective;
|
public IEnumerable<Objective> Objectives { get { return new[] { killnikoomba, levelvillage }; } }
|
||||||
|
|
||||||
|
Objective killnikoomba = new Objective(ObjectiveType.Primary, KillNikoombaText, ObjectiveStatus.InProgress);
|
||||||
|
Objective levelvillage = new Objective(ObjectiveType.Primary, LevelVillageText, ObjectiveStatus.Inactive);
|
||||||
|
|
||||||
|
const string KillNikoombaText = "Find Nikoomba. Once found he must be assasinated.";
|
||||||
|
const string LevelVillageText = "Nikoomba has met his demise, now level the village.";
|
||||||
|
|
||||||
Player gdi;
|
Player gdi;
|
||||||
Player nod;
|
Player nod;
|
||||||
|
|
||||||
//actors and the likes go here
|
//actors and the likes go here
|
||||||
Actor nikoomba;
|
Actor nikoomba;
|
||||||
Actor vil01;
|
Actor vil01;
|
||||||
@@ -59,6 +63,7 @@ namespace OpenRA.Mods.Cnc.Missions
|
|||||||
Actor civ05;
|
Actor civ05;
|
||||||
Actor civ06;
|
Actor civ06;
|
||||||
Actor civ07;
|
Actor civ07;
|
||||||
|
|
||||||
//waypoints
|
//waypoints
|
||||||
Actor nr1;
|
Actor nr1;
|
||||||
Actor nr2;
|
Actor nr2;
|
||||||
@@ -71,48 +76,20 @@ namespace OpenRA.Mods.Cnc.Missions
|
|||||||
const string GRName = "E2";
|
const string GRName = "E2";
|
||||||
const string GRName2 = "JEEP";
|
const string GRName2 = "JEEP";
|
||||||
|
|
||||||
void DisplayObjective()
|
|
||||||
{
|
|
||||||
Game.AddChatLine(Color.LimeGreen, "Objective", Objectives[currentObjective]);
|
|
||||||
}
|
|
||||||
|
|
||||||
void MissionFailed(string text)
|
void MissionFailed(string text)
|
||||||
{
|
{
|
||||||
if (nod.WinState != WinState.Undefined)
|
MissionUtils.CoopMissionFailed(world, text, nod);
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
nod.WinState = WinState.Lost;
|
|
||||||
foreach (var actor in world.Actors.Where(a => a.IsInWorld && a.Owner == nod && !a.IsDead()))
|
|
||||||
{
|
|
||||||
actor.Kill(actor);
|
|
||||||
}
|
|
||||||
Game.AddChatLine(Color.Red, "Mission failed", text);
|
|
||||||
Sound.Play("fail1.aud");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void MissionAccomplished(string text)
|
void MissionAccomplished(string text)
|
||||||
{
|
{
|
||||||
if (nod.WinState != WinState.Undefined)
|
MissionUtils.CoopMissionAccomplished(world, text, nod);
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
nod.WinState = WinState.Won;
|
|
||||||
Game.AddChatLine(Color.Green, "Mission accomplished", text);
|
|
||||||
Sound.Play("accom1.aud");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Tick(Actor self)
|
public void Tick(Actor self)
|
||||||
{
|
{
|
||||||
if (nod.WinState != WinState.Undefined)
|
if (nod.WinState != WinState.Undefined) return;
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
// display current objective every so often
|
|
||||||
if (world.FrameNumber % 1500 == 1)
|
|
||||||
{
|
|
||||||
DisplayObjective();
|
|
||||||
}
|
|
||||||
//spawns nod reinf
|
//spawns nod reinf
|
||||||
if (world.FrameNumber == 700)
|
if (world.FrameNumber == 700)
|
||||||
{
|
{
|
||||||
@@ -125,25 +102,34 @@ namespace OpenRA.Mods.Cnc.Missions
|
|||||||
Sound.Play("reinfor1.aud");
|
Sound.Play("reinfor1.aud");
|
||||||
}
|
}
|
||||||
// objectives
|
// objectives
|
||||||
if (currentObjective == 0)
|
if (killnikoomba.Status == ObjectiveStatus.InProgress)
|
||||||
{
|
{
|
||||||
if (nikoomba.Destroyed)
|
if (nikoomba.Destroyed)
|
||||||
{
|
{
|
||||||
currentObjective++;
|
killnikoomba.Status = ObjectiveStatus.Completed;
|
||||||
DisplayObjective();
|
levelvillage.Status = ObjectiveStatus.InProgress;
|
||||||
GDIReinforceNth();
|
OnObjectivesUpdated(true);
|
||||||
|
//DisplayObjective();
|
||||||
|
//GDIReinforceNth();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (currentObjective == 1)
|
if (levelvillage.Status == ObjectiveStatus.InProgress)
|
||||||
{
|
{
|
||||||
if (vil01.Destroyed && vil02.Destroyed && vil03.Destroyed && vil04.Destroyed && vil05.Destroyed && vil06.Destroyed &&
|
if (vil01.Destroyed && vil02.Destroyed && vil03.Destroyed && vil04.Destroyed && vil05.Destroyed && vil06.Destroyed &&
|
||||||
vil07.Destroyed && vil08.Destroyed && vil09.Destroyed && vil10.Destroyed && vil11.Destroyed && vil12.Destroyed &&
|
vil07.Destroyed && vil08.Destroyed && vil09.Destroyed && vil10.Destroyed && vil11.Destroyed && vil12.Destroyed &&
|
||||||
vil13.Destroyed && civ01.Destroyed && civ02.Destroyed && civ03.Destroyed && civ04.Destroyed && civ05.Destroyed &&
|
vil13.Destroyed && civ01.Destroyed && civ02.Destroyed && civ03.Destroyed && civ04.Destroyed && civ05.Destroyed &&
|
||||||
civ06.Destroyed && civ07.Destroyed)
|
civ06.Destroyed && civ07.Destroyed)
|
||||||
{
|
{
|
||||||
MissionAccomplished("Nikoomba was killed and the Village was Destroyed.");
|
levelvillage.Status = ObjectiveStatus.Completed;
|
||||||
|
OnObjectivesUpdated(true);
|
||||||
|
MissionAccomplished("Nikoomba was killed and the village was destroyed.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!world.Actors.Any(a => (a.Owner == nod) && a.IsInWorld && !a.IsDead()))
|
||||||
|
{
|
||||||
|
MissionFailed("The Nod forces in the area have been wiped out.");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
IEnumerable<Actor> UnitsNearActor(Actor actor, int range)
|
IEnumerable<Actor> UnitsNearActor(Actor actor, int range)
|
||||||
@@ -156,7 +142,6 @@ namespace OpenRA.Mods.Cnc.Missions
|
|||||||
{
|
{
|
||||||
nr1 = world.CreateActor(true, NRName, new TypeDictionary { new OwnerInit(nod), new LocationInit(nr1.Location) });
|
nr1 = world.CreateActor(true, NRName, new TypeDictionary { new OwnerInit(nod), new LocationInit(nr1.Location) });
|
||||||
nr1 = world.CreateActor(true, NRName, new TypeDictionary { new OwnerInit(nod), new LocationInit(nr1.Location) });
|
nr1 = world.CreateActor(true, NRName, new TypeDictionary { new OwnerInit(nod), new LocationInit(nr1.Location) });
|
||||||
//nr1.QueueActivity(new Move.Move(nr1.Location - new CVec(0, 2)));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void NODReinforceNthB()
|
void NODReinforceNthB()
|
||||||
@@ -171,7 +156,7 @@ namespace OpenRA.Mods.Cnc.Missions
|
|||||||
gr1 = world.CreateActor(true, GRName, new TypeDictionary { new OwnerInit(gdi), new LocationInit(gr1.Location) });
|
gr1 = world.CreateActor(true, GRName, new TypeDictionary { new OwnerInit(gdi), new LocationInit(gr1.Location) });
|
||||||
gr1 = world.CreateActor(true, GRName, new TypeDictionary { new OwnerInit(gdi), new LocationInit(gr1.Location) });
|
gr1 = world.CreateActor(true, GRName, new TypeDictionary { new OwnerInit(gdi), new LocationInit(gr1.Location) });
|
||||||
gr1 = world.CreateActor(true, GRName2, new TypeDictionary { new OwnerInit(gdi), new LocationInit(gr1.Location) });
|
gr1 = world.CreateActor(true, GRName2, new TypeDictionary { new OwnerInit(gdi), new LocationInit(gr1.Location) });
|
||||||
//nr1.QueueActivity(new Move.Move(nr1.Location - new CVec(0, 2)));
|
//gr1.QueueActivity(new Move.Move(nr1.Location - new CVec(0, 2)));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void WorldLoaded(World w)
|
public void WorldLoaded(World w)
|
||||||
|
|||||||
Reference in New Issue
Block a user