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:
Dan9550
2013-01-11 17:18:57 +11:00
parent 002df7b24e
commit 897f6cd69e

View File

@@ -10,33 +10,37 @@
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using OpenRA.FileFormats;
using OpenRA.Mods.Cnc;
using OpenRA.Mods.RA;
using OpenRA.Mods.RA.Air;
using OpenRA.Mods.RA.Move;
using OpenRA.Mods.RA.Activities;
using OpenRA.Network;
using OpenRA.Mods.RA.Missions;
using OpenRA.Mods.RA.Buildings;
using OpenRA.Scripting;
using OpenRA.Traits;
using OpenRA.FileFormats;
namespace OpenRA.Mods.Cnc.Missions
{
class Nod01ScriptInfo : TraitInfo<Nod01Script>, Requires<SpawnMapActorsInfo> { }
class Nod01Script : IWorldLoaded, ITick
class Nod01Script : IHasObjectives, IWorldLoaded, ITick
{
static readonly string[] Objectives =
{
"Assasinate Nikoomba.",
"Level the village."
};
public event Action<bool> OnObjectivesUpdated = notify => { };
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 nod;
//actors and the likes go here
Actor nikoomba;
Actor vil01;
@@ -59,6 +63,7 @@ namespace OpenRA.Mods.Cnc.Missions
Actor civ05;
Actor civ06;
Actor civ07;
//waypoints
Actor nr1;
Actor nr2;
@@ -71,48 +76,20 @@ namespace OpenRA.Mods.Cnc.Missions
const string GRName = "E2";
const string GRName2 = "JEEP";
void DisplayObjective()
{
Game.AddChatLine(Color.LimeGreen, "Objective", Objectives[currentObjective]);
}
void MissionFailed(string text)
{
if (nod.WinState != WinState.Undefined)
{
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");
MissionUtils.CoopMissionFailed(world, text, nod);
}
void MissionAccomplished(string text)
{
if (nod.WinState != WinState.Undefined)
{
return;
}
nod.WinState = WinState.Won;
Game.AddChatLine(Color.Green, "Mission accomplished", text);
Sound.Play("accom1.aud");
MissionUtils.CoopMissionAccomplished(world, text, nod);
}
public void Tick(Actor self)
{
if (nod.WinState != WinState.Undefined)
{
return;
}
// display current objective every so often
if (world.FrameNumber % 1500 == 1)
{
DisplayObjective();
}
if (nod.WinState != WinState.Undefined) return;
//spawns nod reinf
if (world.FrameNumber == 700)
{
@@ -125,25 +102,34 @@ namespace OpenRA.Mods.Cnc.Missions
Sound.Play("reinfor1.aud");
}
// objectives
if (currentObjective == 0)
if (killnikoomba.Status == ObjectiveStatus.InProgress)
{
if (nikoomba.Destroyed)
{
currentObjective++;
DisplayObjective();
GDIReinforceNth();
killnikoomba.Status = ObjectiveStatus.Completed;
levelvillage.Status = ObjectiveStatus.InProgress;
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 &&
vil07.Destroyed && vil08.Destroyed && vil09.Destroyed && vil10.Destroyed && vil11.Destroyed && vil12.Destroyed &&
vil13.Destroyed && civ01.Destroyed && civ02.Destroyed && civ03.Destroyed && civ04.Destroyed && civ05.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)
@@ -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.QueueActivity(new Move.Move(nr1.Location - new CVec(0, 2)));
}
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, 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)