Add objectives to MonsterTankMadness
This commit is contained in:
@@ -8,14 +8,13 @@
|
|||||||
*/
|
*/
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
using OpenRA.Mods.RA.Activities;
|
||||||
|
using OpenRA.Mods.RA.Buildings;
|
||||||
|
using OpenRA.Mods.RA.Move;
|
||||||
|
using OpenRA.Traits;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
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
|
namespace OpenRA.Mods.RA.Missions
|
||||||
{
|
{
|
||||||
@@ -45,15 +44,25 @@ namespace OpenRA.Mods.RA.Missions
|
|||||||
|
|
||||||
Dictionary<int, Objective> objectives = new Dictionary<int, Objective>
|
Dictionary<int, Objective> objectives = new Dictionary<int, Objective>
|
||||||
{
|
{
|
||||||
{ BriefingID, new Objective(ObjectiveType.Primary, Briefing, ObjectiveStatus.InProgress) }
|
{ FindOutpostID, new Objective(ObjectiveType.Primary, FindOutpost, ObjectiveStatus.InProgress) },
|
||||||
|
{ EvacuateDemitriID, new Objective(ObjectiveType.Primary, EvacuateDemitri, ObjectiveStatus.InProgress) },
|
||||||
|
{ InfiltrateRadarDomeID, new Objective(ObjectiveType.Primary, InfiltrateRadarDome, ObjectiveStatus.InProgress) },
|
||||||
};
|
};
|
||||||
|
|
||||||
const int BriefingID = 0;
|
const int FindOutpostID = 0;
|
||||||
const string Briefing = "Dr. Demitri, creator of a Soviet Super Tank, wants to defect."
|
const string FindOutpost = "Find our outpost and start repairs on it.";
|
||||||
+ " 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."
|
const int EvacuateDemitriID = 1;
|
||||||
+ " Find our outpost and start repairs on it, then find and evacuate Demitri."
|
const string EvacuateDemitri = "Find and evacuate Dr. Demitri. He is missing -- likely hiding in the village to the far south.";
|
||||||
+ " 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.";
|
|
||||||
|
const int InfiltrateRadarDomeID = 2;
|
||||||
|
const string InfiltrateRadarDome = "Reprogram the Super Tanks by sending a spy into the Soviet radar dome.";
|
||||||
|
|
||||||
|
//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;
|
World world;
|
||||||
|
|
||||||
@@ -89,7 +98,6 @@ namespace OpenRA.Mods.RA.Missions
|
|||||||
|
|
||||||
Actor superTankDome;
|
Actor superTankDome;
|
||||||
|
|
||||||
bool demitriExtracted;
|
|
||||||
bool hospitalEvacuated;
|
bool hospitalEvacuated;
|
||||||
bool superTanksDestroyed;
|
bool superTanksDestroyed;
|
||||||
|
|
||||||
@@ -135,6 +143,8 @@ namespace OpenRA.Mods.RA.Missions
|
|||||||
foreach (var actor in actorsInBase)
|
foreach (var actor in actorsInBase)
|
||||||
TransferActorToAllies(actor);
|
TransferActorToAllies(actor);
|
||||||
baseTransferredTick = world.FrameNumber;
|
baseTransferredTick = world.FrameNumber;
|
||||||
|
objectives[FindOutpostID].Status = ObjectiveStatus.Completed;
|
||||||
|
OnObjectivesUpdated(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (superTankDomeInfiltratedTick == -1)
|
else if (superTankDomeInfiltratedTick == -1)
|
||||||
@@ -172,13 +182,13 @@ namespace OpenRA.Mods.RA.Missions
|
|||||||
superTanksDestroyed = true;
|
superTanksDestroyed = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!demitriExtracted)
|
if (objectives[EvacuateDemitriID].Status != ObjectiveStatus.Completed)
|
||||||
{
|
{
|
||||||
if (demitri == null)
|
if (demitri == null)
|
||||||
{
|
{
|
||||||
if (demitriChurch.IsDead())
|
if (demitriChurch.IsDead())
|
||||||
{
|
{
|
||||||
objectives[BriefingID].Status = ObjectiveStatus.Failed;
|
objectives[EvacuateDemitriID].Status = ObjectiveStatus.Failed;
|
||||||
OnObjectivesUpdated(true);
|
OnObjectivesUpdated(true);
|
||||||
MissionFailed("Dr. Demitri was killed.");
|
MissionFailed("Dr. Demitri was killed.");
|
||||||
}
|
}
|
||||||
@@ -195,7 +205,7 @@ namespace OpenRA.Mods.RA.Missions
|
|||||||
}
|
}
|
||||||
else if (demitri.IsDead())
|
else if (demitri.IsDead())
|
||||||
{
|
{
|
||||||
objectives[BriefingID].Status = ObjectiveStatus.Failed;
|
objectives[EvacuateDemitriID].Status = ObjectiveStatus.Failed;
|
||||||
OnObjectivesUpdated(true);
|
OnObjectivesUpdated(true);
|
||||||
MissionFailed("Dr. Demitri was killed.");
|
MissionFailed("Dr. Demitri was killed.");
|
||||||
}
|
}
|
||||||
@@ -203,26 +213,23 @@ namespace OpenRA.Mods.RA.Missions
|
|||||||
{
|
{
|
||||||
demitriLZFlare.Destroy();
|
demitriLZFlare.Destroy();
|
||||||
SpawnAndMoveAlliedBaseUnits(info.FirstBaseUnits);
|
SpawnAndMoveAlliedBaseUnits(info.FirstBaseUnits);
|
||||||
demitriExtracted = true;
|
objectives[EvacuateDemitriID].Status = ObjectiveStatus.Completed;
|
||||||
|
OnObjectivesUpdated(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!world.Actors.Any(a => a.Owner == greece && a.IsInWorld && !a.IsDead()
|
if (!world.Actors.Any(a => a.Owner == greece && a.IsInWorld && !a.IsDead()
|
||||||
&& ((a.HasTrait<Building>() && !a.HasTrait<Wall>()) || a.HasTrait<BaseBuilding>() || a.HasTrait<Mobile>())))
|
&& ((a.HasTrait<Building>() && !a.HasTrait<Wall>()) || a.HasTrait<BaseBuilding>() || a.HasTrait<Mobile>())))
|
||||||
{
|
{
|
||||||
objectives[BriefingID].Status = ObjectiveStatus.Failed;
|
|
||||||
OnObjectivesUpdated(true);
|
|
||||||
MissionFailed("The remaining Allied forces in the area have been wiped out.");
|
MissionFailed("The remaining Allied forces in the area have been wiped out.");
|
||||||
}
|
}
|
||||||
if (superTankDomeInfiltratedTick == -1 && superTankDome.IsDead())
|
if (superTankDomeInfiltratedTick == -1 && superTankDome.IsDead())
|
||||||
{
|
{
|
||||||
objectives[BriefingID].Status = ObjectiveStatus.Failed;
|
objectives[InfiltrateRadarDomeID].Status = ObjectiveStatus.Failed;
|
||||||
OnObjectivesUpdated(true);
|
OnObjectivesUpdated(true);
|
||||||
MissionFailed("The Soviet radar dome was destroyed.");
|
MissionFailed("The Soviet radar dome was destroyed.");
|
||||||
}
|
}
|
||||||
if (superTanksDestroyed && demitriExtracted)
|
if (superTanksDestroyed && objectives[EvacuateDemitriID].Status == ObjectiveStatus.Completed)
|
||||||
{
|
{
|
||||||
objectives[BriefingID].Status = ObjectiveStatus.Completed;
|
|
||||||
OnObjectivesUpdated(true);
|
|
||||||
MissionAccomplished("Dr. Demitri has been extracted and the super tanks have been dealt with.");
|
MissionAccomplished("Dr. Demitri has been extracted and the super tanks have been dealt with.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -280,6 +287,8 @@ namespace OpenRA.Mods.RA.Missions
|
|||||||
foreach (var tank in superTanks.Where(t => !t.IsDead() && t.IsInWorld))
|
foreach (var tank in superTanks.Where(t => !t.IsDead() && t.IsInWorld))
|
||||||
MissionUtils.AttackNearestLandActor(false, tank, ussr);
|
MissionUtils.AttackNearestLandActor(false, tank, ussr);
|
||||||
superTankDomeInfiltratedTick = world.FrameNumber;
|
superTankDomeInfiltratedTick = world.FrameNumber;
|
||||||
|
objectives[InfiltrateRadarDomeID].Status = ObjectiveStatus.Completed;
|
||||||
|
OnObjectivesUpdated(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void WorldLoaded(World w)
|
public void WorldLoaded(World w)
|
||||||
|
|||||||
Reference in New Issue
Block a user