recreated GDI01 in Lua
This commit is contained in:
@@ -1,221 +0,0 @@
|
|||||||
#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;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using OpenRA.FileFormats;
|
|
||||||
using OpenRA.Graphics;
|
|
||||||
using OpenRA.Mods.RA;
|
|
||||||
using OpenRA.Mods.RA.Activities;
|
|
||||||
using OpenRA.Mods.RA.Move;
|
|
||||||
using OpenRA.Scripting;
|
|
||||||
using OpenRA.Traits;
|
|
||||||
|
|
||||||
namespace OpenRA.Mods.Cnc.Missions
|
|
||||||
{
|
|
||||||
class Gdi01ScriptInfo : TraitInfo<Gdi01Script> { }
|
|
||||||
|
|
||||||
class Gdi01Script : IWorldLoaded, ITick
|
|
||||||
{
|
|
||||||
Dictionary<string, Actor> actors;
|
|
||||||
Dictionary<string, Player> players;
|
|
||||||
|
|
||||||
public void WorldLoaded(World w, WorldRenderer wr)
|
|
||||||
{
|
|
||||||
players = w.Players.ToDictionary(p => p.InternalName);
|
|
||||||
actors = w.WorldActor.Trait<SpawnMapActors>().Actors;
|
|
||||||
var b = w.Map.Bounds;
|
|
||||||
wr.Viewport.Center(new CPos(b.Left + b.Width / 2, b.Top + b.Height / 2).CenterPosition);
|
|
||||||
|
|
||||||
Action afterFMV = () =>
|
|
||||||
{
|
|
||||||
Sound.PlayMusic(Rules.Music["aoi"]);
|
|
||||||
started = true;
|
|
||||||
};
|
|
||||||
Game.RunAfterDelay(0, () => Media.PlayFMVFullscreen(w, "gdi1.vqa", () =>
|
|
||||||
Media.PlayFMVFullscreen(w, "landing.vqa", afterFMV)));
|
|
||||||
}
|
|
||||||
|
|
||||||
public void OnVictory(World w)
|
|
||||||
{
|
|
||||||
Action afterFMV = () =>
|
|
||||||
{
|
|
||||||
players["GoodGuy"].WinState = WinState.Won;
|
|
||||||
started = false;
|
|
||||||
Sound.StopMusic();
|
|
||||||
Sound.PlayToPlayer(players["GoodGuy"], "accom1.aud");
|
|
||||||
};
|
|
||||||
Game.RunAfterDelay(0, () => Media.PlayFMVFullscreen(w, "consyard.vqa", afterFMV));
|
|
||||||
}
|
|
||||||
|
|
||||||
public void OnLose(World w)
|
|
||||||
{
|
|
||||||
Action afterFMV = () =>
|
|
||||||
{
|
|
||||||
players["GoodGuy"].WinState = WinState.Lost;
|
|
||||||
started = false;
|
|
||||||
Sound.StopMusic();
|
|
||||||
Sound.PlayToPlayer(players["GoodGuy"], "fail1.aud");
|
|
||||||
};
|
|
||||||
Game.RunAfterDelay(0, () => Media.PlayFMVFullscreen(w, "gameover.vqa", afterFMV));
|
|
||||||
}
|
|
||||||
|
|
||||||
int ticks = 0;
|
|
||||||
bool started = false;
|
|
||||||
|
|
||||||
int lastBadCount = -1;
|
|
||||||
public void Tick(Actor self)
|
|
||||||
{
|
|
||||||
if (!started)
|
|
||||||
return;
|
|
||||||
|
|
||||||
if (ticks == 0)
|
|
||||||
{
|
|
||||||
SetGunboatPath();
|
|
||||||
self.World.AddFrameEndTask(w =>
|
|
||||||
{
|
|
||||||
// Initial Nod reinforcements
|
|
||||||
foreach (var i in new[] { "e1", "e1" })
|
|
||||||
{
|
|
||||||
var a = self.World.CreateActor(i.ToLowerInvariant(), new TypeDictionary
|
|
||||||
{
|
|
||||||
new OwnerInit(players["BadGuy"]),
|
|
||||||
new FacingInit(0),
|
|
||||||
new LocationInit(actors["nod0"].Location),
|
|
||||||
});
|
|
||||||
var mobile = a.Trait<Mobile>();
|
|
||||||
a.QueueActivity(mobile.MoveTo(actors["nod1"].Location, 2));
|
|
||||||
a.QueueActivity(mobile.MoveTo(actors["nod2"].Location, 2));
|
|
||||||
a.QueueActivity(mobile.MoveTo(actors["nod3"].Location, 2));
|
|
||||||
|
|
||||||
// TODO: Queue hunt order
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
// GoodGuy win conditions
|
|
||||||
// BadGuy is dead
|
|
||||||
var badcount = self.World.Actors.Count(a => a != a.Owner.PlayerActor &&
|
|
||||||
a.Owner == players["BadGuy"] && !a.IsDead());
|
|
||||||
if (badcount != lastBadCount)
|
|
||||||
{
|
|
||||||
Game.Debug("{0} badguys remain".F(badcount));
|
|
||||||
lastBadCount = badcount;
|
|
||||||
|
|
||||||
if (badcount == 0)
|
|
||||||
OnVictory(self.World);
|
|
||||||
}
|
|
||||||
|
|
||||||
// GoodGuy lose conditions: MCV/cyard must survive
|
|
||||||
var hasAnything = self.World.ActorsWithTrait<MustBeDestroyed>()
|
|
||||||
.Any(a => a.Actor.Owner == players["GoodGuy"]);
|
|
||||||
if (!hasAnything)
|
|
||||||
OnLose(self.World);
|
|
||||||
|
|
||||||
// GoodGuy reinforcements
|
|
||||||
if (ticks == 25 * 5)
|
|
||||||
{
|
|
||||||
ReinforceFromSea(self.World,
|
|
||||||
actors["lstStart"].Location,
|
|
||||||
actors["lstEnd"].Location,
|
|
||||||
new CPos(53, 53),
|
|
||||||
new string[] { "e1", "e1", "e1" },
|
|
||||||
players["GoodGuy"]);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (ticks == 25 * 15)
|
|
||||||
{
|
|
||||||
ReinforceFromSea(self.World,
|
|
||||||
actors["lstStart"].Location,
|
|
||||||
actors["lstEnd"].Location,
|
|
||||||
new CPos(53, 53),
|
|
||||||
new string[] { "e1", "e1", "e1" },
|
|
||||||
players["GoodGuy"]);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (ticks == 25 * 30)
|
|
||||||
{
|
|
||||||
ReinforceFromSea(self.World,
|
|
||||||
actors["lstStart"].Location,
|
|
||||||
actors["lstEnd"].Location,
|
|
||||||
new CPos(53, 53),
|
|
||||||
new string[] { "jeep" },
|
|
||||||
players["GoodGuy"]);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (ticks == 25 * 60)
|
|
||||||
{
|
|
||||||
ReinforceFromSea(self.World,
|
|
||||||
actors["lstStart"].Location,
|
|
||||||
actors["lstEnd"].Location,
|
|
||||||
new CPos(53, 53),
|
|
||||||
new string[] { "jeep" },
|
|
||||||
players["GoodGuy"]);
|
|
||||||
}
|
|
||||||
|
|
||||||
ticks++;
|
|
||||||
}
|
|
||||||
|
|
||||||
void SetGunboatPath()
|
|
||||||
{
|
|
||||||
var self = actors["Gunboat"];
|
|
||||||
var mobile = self.Trait<Mobile>();
|
|
||||||
self.Trait<AutoTarget>().stance = UnitStance.AttackAnything; // TODO: this is ignored
|
|
||||||
self.QueueActivity(mobile.ScriptedMove(actors["gunboatLeft"].Location));
|
|
||||||
self.QueueActivity(mobile.ScriptedMove(actors["gunboatRight"].Location));
|
|
||||||
self.QueueActivity(new CallFunc(() => SetGunboatPath()));
|
|
||||||
}
|
|
||||||
|
|
||||||
void ReinforceFromSea(World world, CPos startPos, CPos endPos, CPos unload, string[] items, Player player)
|
|
||||||
{
|
|
||||||
world.AddFrameEndTask(w =>
|
|
||||||
{
|
|
||||||
Sound.PlayToPlayer(w.LocalPlayer, "reinfor1.aud");
|
|
||||||
|
|
||||||
var a = w.CreateActor("lst", new TypeDictionary
|
|
||||||
{
|
|
||||||
new LocationInit(startPos),
|
|
||||||
new OwnerInit(player),
|
|
||||||
new FacingInit(0),
|
|
||||||
});
|
|
||||||
|
|
||||||
var mobile = a.Trait<Mobile>();
|
|
||||||
var cargo = a.Trait<Cargo>();
|
|
||||||
foreach (var i in items)
|
|
||||||
cargo.Load(a, world.CreateActor(false, i.ToLowerInvariant(), new TypeDictionary
|
|
||||||
{
|
|
||||||
new OwnerInit(player),
|
|
||||||
new FacingInit(0),
|
|
||||||
}));
|
|
||||||
|
|
||||||
a.CancelActivity();
|
|
||||||
a.QueueActivity(mobile.ScriptedMove(endPos));
|
|
||||||
a.QueueActivity(new CallFunc(() =>
|
|
||||||
{
|
|
||||||
while (!cargo.IsEmpty(a))
|
|
||||||
{
|
|
||||||
var b = cargo.Unload(a);
|
|
||||||
world.AddFrameEndTask(w2 =>
|
|
||||||
{
|
|
||||||
if (b.Destroyed) return;
|
|
||||||
w2.Add(b);
|
|
||||||
b.TraitsImplementing<IPositionable>().FirstOrDefault().SetPosition(b, a.Location);
|
|
||||||
b.QueueActivity(mobile.MoveTo(unload, 2));
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}));
|
|
||||||
a.QueueActivity(new Wait(25));
|
|
||||||
a.QueueActivity(mobile.ScriptedMove(startPos));
|
|
||||||
a.QueueActivity(new RemoveSelf());
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -77,7 +77,6 @@
|
|||||||
<Compile Include="CncMenuPaletteEffect.cs" />
|
<Compile Include="CncMenuPaletteEffect.cs" />
|
||||||
<Compile Include="Effects\IonCannon.cs" />
|
<Compile Include="Effects\IonCannon.cs" />
|
||||||
<Compile Include="IonCannonPower.cs" />
|
<Compile Include="IonCannonPower.cs" />
|
||||||
<Compile Include="Missions\Gdi01Script.cs" />
|
|
||||||
<Compile Include="Missions\Nod01Script.cs" />
|
<Compile Include="Missions\Nod01Script.cs" />
|
||||||
<Compile Include="PoisonedByTiberium.cs" />
|
<Compile Include="PoisonedByTiberium.cs" />
|
||||||
<Compile Include="ProductionAirdrop.cs" />
|
<Compile Include="ProductionAirdrop.cs" />
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ Options:
|
|||||||
Shroud: True
|
Shroud: True
|
||||||
AllyBuildRadius: False
|
AllyBuildRadius: False
|
||||||
FragileAlliances: False
|
FragileAlliances: False
|
||||||
StartingCash: 500
|
StartingCash: 5000
|
||||||
ConfigurableStartingUnits: False
|
ConfigurableStartingUnits: False
|
||||||
|
|
||||||
Players:
|
Players:
|
||||||
@@ -454,9 +454,15 @@ Rules:
|
|||||||
-SpawnMPUnits:
|
-SpawnMPUnits:
|
||||||
-MPStartLocations:
|
-MPStartLocations:
|
||||||
-CrateSpawner:
|
-CrateSpawner:
|
||||||
Gdi01Script:
|
PlayMusicOnMapLoad:
|
||||||
|
Music: aoi
|
||||||
|
Loop: false
|
||||||
|
LuaScriptInterface:
|
||||||
|
LuaScripts: mission.lua
|
||||||
Player:
|
Player:
|
||||||
-ConquestVictoryConditions:
|
-ConquestVictoryConditions:
|
||||||
|
^Infantry:
|
||||||
|
MustBeDestroyed:
|
||||||
PROC:
|
PROC:
|
||||||
-Buildable:
|
-Buildable:
|
||||||
SILO:
|
SILO:
|
||||||
@@ -475,6 +481,7 @@ Rules:
|
|||||||
-Buildable:
|
-Buildable:
|
||||||
GUN:
|
GUN:
|
||||||
-Buildable:
|
-Buildable:
|
||||||
|
MustBeDestroyed:
|
||||||
GTWR:
|
GTWR:
|
||||||
-Buildable:
|
-Buildable:
|
||||||
ATWR:
|
ATWR:
|
||||||
@@ -488,8 +495,12 @@ Rules:
|
|||||||
RMBO:
|
RMBO:
|
||||||
-Buildable:
|
-Buildable:
|
||||||
BOAT:
|
BOAT:
|
||||||
Mobile:
|
Health:
|
||||||
OnRails: false
|
HP: 1000
|
||||||
|
AutoTarget:
|
||||||
|
InitialStance: AttackAnything
|
||||||
|
RejectsOrders:
|
||||||
|
Except: Attack
|
||||||
|
|
||||||
Sequences:
|
Sequences:
|
||||||
|
|
||||||
|
|||||||
61
mods/cnc/maps/gdi01/mission.lua
Normal file
61
mods/cnc/maps/gdi01/mission.lua
Normal file
@@ -0,0 +1,61 @@
|
|||||||
|
InfantryReinforcements = { "e1", "e1", "e1" }
|
||||||
|
VehicleReinforcements = { "jeep" }
|
||||||
|
NodPatrol = { "e1", "e1" }
|
||||||
|
|
||||||
|
MissionAccomplished = function()
|
||||||
|
Mission.MissionOver({ player }, nil, false)
|
||||||
|
Media.PlayMovieFullscreen("consyard.vqa")
|
||||||
|
end
|
||||||
|
|
||||||
|
MissionFailed = function()
|
||||||
|
Mission.MissionOver(nil, { player }, false)
|
||||||
|
Media.PlayMovieFullscreen("gameover.vqa")
|
||||||
|
end
|
||||||
|
|
||||||
|
SendNodPatrol = function()
|
||||||
|
local patrol = Reinforcements.Reinforce(enemy, NodPatrol, nod0.Location, nod1.Location, 0)
|
||||||
|
for i, soldier in ipairs(patrol) do
|
||||||
|
Actor.Move(soldier, nod2.Location)
|
||||||
|
Actor.Move(soldier, nod3.Location)
|
||||||
|
Actor.Hunt(soldier)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
SetGunboatPath = function()
|
||||||
|
Actor.AttackMove(Gunboat, gunboatLeft.Location)
|
||||||
|
Actor.AttackMove(Gunboat, gunboatRight.Location)
|
||||||
|
end
|
||||||
|
|
||||||
|
ReinforceFromSea = function(passengers)
|
||||||
|
local hovercraft, troops = Reinforcements.Insert(player, "lst", passengers, { lstStart.Location, lstEnd.Location }, { lstStart.Location })
|
||||||
|
Media.PlaySpeechNotification("Reinforce")
|
||||||
|
end
|
||||||
|
|
||||||
|
WorldLoaded = function()
|
||||||
|
player = OpenRA.GetPlayer("GoodGuy")
|
||||||
|
enemy = OpenRA.GetPlayer("BadGuy")
|
||||||
|
|
||||||
|
Media.PlayMovieFullscreen("gdi1.vqa", function() Media.PlayMovieFullscreen("landing.vqa") end)
|
||||||
|
|
||||||
|
SendNodPatrol()
|
||||||
|
|
||||||
|
OpenRA.RunAfterDelay(25 * 5, function() ReinforceFromSea(InfantryReinforcements) end)
|
||||||
|
OpenRA.RunAfterDelay(25 * 15, function() ReinforceFromSea(InfantryReinforcements) end)
|
||||||
|
OpenRA.RunAfterDelay(25 * 30, function() ReinforceFromSea(VehicleReinforcements) end)
|
||||||
|
OpenRA.RunAfterDelay(25 * 60, function() ReinforceFromSea(VehicleReinforcements) end)
|
||||||
|
end
|
||||||
|
|
||||||
|
Tick = function()
|
||||||
|
if Actor.IsIdle(Gunboat) then
|
||||||
|
SetGunboatPath()
|
||||||
|
end
|
||||||
|
|
||||||
|
if not Mission.MissionIsOver then
|
||||||
|
if Mission.RequiredUnitsAreDestroyed(player) then
|
||||||
|
MissionFailed()
|
||||||
|
end
|
||||||
|
if Mission.RequiredUnitsAreDestroyed(enemy) then
|
||||||
|
MissionAccomplished()
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
@@ -284,7 +284,7 @@
|
|||||||
Water: 100
|
Water: 100
|
||||||
SelectionDecorations:
|
SelectionDecorations:
|
||||||
Selectable:
|
Selectable:
|
||||||
Voice: GenericVoice
|
Voice: VehicleVoice
|
||||||
TargetableUnit:
|
TargetableUnit:
|
||||||
TargetTypes: Ground, Water
|
TargetTypes: Ground, Water
|
||||||
HiddenUnderFog:
|
HiddenUnderFog:
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
GenericVoice:
|
GenericVoice:
|
||||||
Variants:
|
Variants:
|
||||||
nod: .v01,.v03
|
nod: .v01,.v03
|
||||||
gdi: .v01,.v03
|
gdi: .v01,.v03
|
||||||
@@ -8,27 +8,27 @@ GenericVoice:
|
|||||||
Die: nuyell1,nuyell3,nuyell4,nuyell5
|
Die: nuyell1,nuyell3,nuyell4,nuyell5
|
||||||
DisableVariants: Die
|
DisableVariants: Die
|
||||||
|
|
||||||
VehicleVoice:
|
VehicleVoice:
|
||||||
Variants:
|
Variants:
|
||||||
nod: .v00,.v02
|
nod: .v00,.v02
|
||||||
gdi: .v00,.v02
|
gdi: .v00,.v02
|
||||||
Voices:
|
Voices:
|
||||||
Select: vehic1,yessir1,report1,await1,unit1
|
Select: vehic1,yessir1,report1,await1,unit1
|
||||||
Move: ackno,affirm1,movout1
|
Move: ackno,affirm1,movout1
|
||||||
|
|
||||||
CivilianMaleVoice:
|
CivilianMaleVoice:
|
||||||
Voices:
|
Voices:
|
||||||
Select: guyyeah1
|
Select: guyyeah1
|
||||||
Move: guyokay1
|
Move: guyokay1
|
||||||
Die: nuyell1,nuyell3,nuyell4,nuyell5
|
Die: nuyell1,nuyell3,nuyell4,nuyell5
|
||||||
|
|
||||||
CivilianFemaleVoice:
|
CivilianFemaleVoice:
|
||||||
Voices:
|
Voices:
|
||||||
Select: girlyeah
|
Select: girlyeah
|
||||||
Move: girlokay
|
Move: girlokay
|
||||||
Die: nuyell1,nuyell3,nuyell4,nuyell5
|
Die: nuyell1,nuyell3,nuyell4,nuyell5
|
||||||
|
|
||||||
CommandoVoice:
|
CommandoVoice:
|
||||||
Voices:
|
Voices:
|
||||||
Select: yeah1,yes1,yo1
|
Select: yeah1,yes1,yo1
|
||||||
Move: cmon1,onit1,gotit1
|
Move: cmon1,onit1,gotit1
|
||||||
|
|||||||
Reference in New Issue
Block a user