Merge pull request #6807 from obrakmann/lua-cleanups

Lua cleanups
This commit is contained in:
Matthias Mailänder
2014-10-24 18:29:34 +02:00
26 changed files with 186 additions and 258 deletions

View File

@@ -27,7 +27,7 @@ namespace OpenRA
Folders, Rules, ServerTraits,
Sequences, VoxelSequences, Cursors, Chrome, Assemblies, ChromeLayout,
Weapons, Voices, Notifications, Music, Movies, Translations, TileSets,
ChromeMetrics, LuaScripts, MapCompatibility, Missions;
ChromeMetrics, MapCompatibility, Missions;
public readonly IReadOnlyDictionary<string, string> Packages;
public readonly IReadOnlyDictionary<string, string> MapFolders;
@@ -81,7 +81,6 @@ namespace OpenRA
Translations = YamlList(yaml, "Translations", true);
TileSets = YamlList(yaml, "TileSets", true);
ChromeMetrics = YamlList(yaml, "ChromeMetrics", true);
LuaScripts = YamlList(yaml, "LuaScripts", true);
Missions = YamlList(yaml, "Missions", true);
ServerTraits = YamlList(yaml, "ServerTraits");

View File

@@ -14,7 +14,7 @@ using OpenRA.Scripting;
namespace OpenRA.Mods.RA.Scripting
{
[ScriptGlobal("Date")]
[ScriptGlobal("DateTime")]
public class DateGlobal : ScriptGlobal
{
public DateGlobal(ScriptContext context)
@@ -25,18 +25,23 @@ namespace OpenRA.Mods.RA.Scripting
{
get { return DateTime.Today.Month == 10 && DateTime.Today.Day == 31; }
}
}
[ScriptGlobal("Time")]
public class TimeGlobal : ScriptGlobal
{
public TimeGlobal(ScriptContext context)
: base(context) { }
[Desc("Get the current game time (in ticks)")]
public int GameTime
{
get { return context.World.WorldTick; }
}
[Desc("Converts the number of seconds into game time (ticks).")]
public int Seconds(int seconds)
{
return seconds * 25;
}
[Desc("Converts the number of minutes into game time (ticks).")]
public int Minutes(int minutes)
{
return Seconds(minutes * 60);
}
}
}

View File

@@ -86,6 +86,12 @@ namespace OpenRA.Mods.RA.Scripting
return context.World.Map.ChooseRandomEdgeCell(context.World.SharedRandom);
}
[Desc("Returns the center of a cell in world coordinates.")]
public WPos CenterOfCell(CPos cell)
{
return context.World.Map.CenterOfCell(cell);
}
[Desc("Returns true if there is only one human player.")]
public bool IsSinglePlayer { get { return context.World.LobbyInfo.IsSinglePlayer; } }

View File

@@ -62,10 +62,10 @@ namespace OpenRA.Mods.RA.Scripting
}
[Desc("Send reinforcements consisting of multiple units. Supports ground-based, naval and air units. " +
"The first member of the entryPath array will be the units' spawnpoint, " +
"while the last one will be their destination. If actionFunc is given, " +
"it will be executed once a unit has reached its destination. actionFunc " +
"will be called as actionFunc(Actor actor)")]
"The first member of the entryPath array will be the units' spawnpoint, " +
"while the last one will be their destination. If actionFunc is given, " +
"it will be executed once a unit has reached its destination. actionFunc " +
"will be called as actionFunc(Actor actor)")]
public Actor[] Reinforce(Player owner, string[] actorTypes, CPos[] entryPath, int interval = 25, LuaFunction actionFunc = null)
{
var actors = new List<Actor>();
@@ -99,13 +99,13 @@ namespace OpenRA.Mods.RA.Scripting
}
[Desc("Send reinforcements in a transport. A transport can be a ground unit (APC etc.), ships and aircraft. " +
"The first member of the entryPath array will be the spawnpoint for the transport, " +
"while the last one will be its destination. The last member of the exitPath array " +
"is be the place where the transport will be removed from the game. When the transport " +
"has reached the destination, it will unload its cargo unless a custom actionFunc has " +
"been supplied. Afterwards, the transport will follow the exitPath and leave the map, " +
"unless a custom exitFunc has been supplied. actionFunc will be called as " +
"actionFunc(Actor transport, Actor[] cargo). exitFunc will be called as exitFunc(Actor transport).")]
"The first member of the entryPath array will be the spawnpoint for the transport, " +
"while the last one will be its destination. The last member of the exitPath array " +
"is be the place where the transport will be removed from the game. When the transport " +
"has reached the destination, it will unload its cargo unless a custom actionFunc has " +
"been supplied. Afterwards, the transport will follow the exitPath and leave the map, " +
"unless a custom exitFunc has been supplied. actionFunc will be called as " +
"actionFunc(Actor transport, Actor[] cargo). exitFunc will be called as exitFunc(Actor transport).")]
public LuaTable ReinforceWithTransport(Player owner, string actorType, string[] cargoTypes, CPos[] entryPath, CPos[] exitPath = null,
LuaFunction actionFunc = null, LuaFunction exitFunc = null)
{

View File

@@ -172,14 +172,14 @@ namespace OpenRA.Mods.RA.Scripting
}
[Desc("Call a function when this actor is added to the world. " +
"The callback function will be called as func(Actor self).")]
"The callback function will be called as func(Actor self).")]
public void OnAddedToWorld(Actor a, LuaFunction func)
{
GetScriptTriggers(a).RegisterCallback(Trigger.OnAddedToWorld, func, context);
}
[Desc("Call a function when this actor is removed from the world. " +
"The callback function will be called as func(Actor self).")]
"The callback function will be called as func(Actor self).")]
public void OnRemovedFromWorld(Actor a, LuaFunction func)
{
GetScriptTriggers(a).RegisterCallback(Trigger.OnRemovedFromWorld, func, context);
@@ -214,7 +214,7 @@ namespace OpenRA.Mods.RA.Scripting
}
[Desc("Call a function when this actor is captured. The callback function " +
"will be called as func(Actor self, Actor captor, Player oldOwner, Player newOwner).")]
"will be called as func(Actor self, Actor captor, Player oldOwner, Player newOwner).")]
public void OnCapture(Actor a, LuaFunction func)
{
GetScriptTriggers(a).RegisterCallback(Trigger.OnCapture, func, context);
@@ -279,19 +279,23 @@ namespace OpenRA.Mods.RA.Scripting
}
[Desc("Call a function when this actor is infiltrated. The callback function " +
"will be called as func(Actor self, Actor infiltrator).")]
"will be called as func(Actor self, Actor infiltrator).")]
public void OnInfiltrated(Actor a, LuaFunction func)
{
GetScriptTriggers(a).RegisterCallback(Trigger.OnInfiltrated, func, context);
}
[Desc("Removes all triggers from this actor.")]
[Desc("Removes all triggers from this actor." +
"Note that the removal will only take effect at the end of a tick, " +
"so you must not add new triggers at the same time that you are calling this function.")]
public void ClearAll(Actor a)
{
GetScriptTriggers(a).ClearAll();
}
[Desc("Removes the specified trigger from this actor.")]
[Desc("Removes the specified trigger from this actor." +
"Note that the removal will only take effect at the end of a tick, " +
"so you must not add new triggers at the same time that you are calling this function.")]
public void Clear(Actor a, string triggerName)
{
var trigger = (Trigger)Enum.Parse(typeof(Trigger), triggerName);

View File

@@ -89,23 +89,5 @@ namespace OpenRA.Mods.RA.Scripting
return context.World.SharedRandom.Next(low, high);
}
[Desc("Returns the center of a cell in world coordinates.")]
public WPos CenterOfCell(CPos cell)
{
return context.World.Map.CenterOfCell(cell);
}
[Desc("Converts the number of seconds into game time (ticks).")]
public int Seconds(int seconds)
{
return seconds * 25;
}
[Desc("Converts the number of minutes into game time (ticks).")]
public int Minutes(int minutes)
{
return Seconds(minutes * 60);
}
}
}

View File

@@ -29,7 +29,7 @@ namespace OpenRA.Mods.RA.Scripting
[ScriptActorPropertyActivity]
[Desc("Add a primary mission objective for this player. The function returns the " +
"ID of the newly created objective, so that it can be referred to later.")]
"ID of the newly created objective, so that it can be referred to later.")]
public int AddPrimaryObjective(string description)
{
return mo.Add(player, description, ObjectiveType.Primary);
@@ -37,7 +37,7 @@ namespace OpenRA.Mods.RA.Scripting
[ScriptActorPropertyActivity]
[Desc("Add a secondary mission objective for this player. The function returns the " +
"ID of the newly created objective, so that it can be referred to later.")]
"ID of the newly created objective, so that it can be referred to later.")]
public int AddSecondaryObjective(string description)
{
return mo.Add(player, description, ObjectiveType.Secondary);

View File

@@ -94,10 +94,10 @@ namespace OpenRA.Mods.RA.Scripting
}
[Desc("Build the specified set of actors using a TD-style (per building) production queue. " +
"The function will return true if production could be started, false otherwise. " +
"If an actionFunc is given, it will be called as actionFunc(Actor[] actors) once " +
"production of all actors has been completed. The actors array is guaranteed to " +
"only contain alive actors.")]
"The function will return true if production could be started, false otherwise. " +
"If an actionFunc is given, it will be called as actionFunc(Actor[] actors) once " +
"production of all actors has been completed. The actors array is guaranteed to " +
"only contain alive actors.")]
public bool Build(string[] actorTypes, LuaFunction actionFunc = null)
{
if (triggers.Triggers[Trigger.OnProduction].Any())
@@ -145,7 +145,8 @@ namespace OpenRA.Mods.RA.Scripting
return true;
}
[Desc("Checks whether the factory is currently producing anything on the queue that produces this type of actor.")]
[Desc("Check whether the factory's production queue that builds this type of actor is currently busy." +
"Note: it does not check whether this particular type of actor is being produced.")]
public bool IsProducing(string actorType)
{
if (triggers.Triggers[Trigger.OnProduction].Any())
@@ -198,10 +199,10 @@ namespace OpenRA.Mods.RA.Scripting
}
[Desc("Build the specified set of actors using classic (RA-style) production queues. " +
"The function will return true if production could be started, false otherwise. " +
"If an actionFunc is given, it will be called as actionFunc(Actor[] actors) once " +
"production of all actors has been completed. The actors array is guaranteed to " +
"only contain alive actors.")]
"The function will return true if production could be started, false otherwise. " +
"If an actionFunc is given, it will be called as actionFunc(Actor[] actors) once " +
"production of all actors has been completed. The actors array is guaranteed to " +
"only contain alive actors.")]
public bool Build(string[] actorTypes, LuaFunction actionFunc = null)
{
var typeToQueueMap = new Dictionary<string, string>();
@@ -249,7 +250,8 @@ namespace OpenRA.Mods.RA.Scripting
return true;
}
[Desc("Checks whether the player is currently producing anything on the queue that produces this type of actor.")]
[Desc("Check whether the production queue that builds this type of actor is currently busy." +
"Note: it does not check whether this particular type of actor is being produced.")]
public bool IsProducing(string actorType)
{
var queue = GetBuildableInfo(actorType).Queue.First();

View File

@@ -76,10 +76,10 @@ WorldLoaded = function()
SendNodPatrol()
Trigger.AfterDelay(Utils.Seconds(5), function() Reinforce(InfantryReinforcements) end)
Trigger.AfterDelay(Utils.Seconds(15), function() Reinforce(InfantryReinforcements) end)
Trigger.AfterDelay(Utils.Seconds(30), function() Reinforce(VehicleReinforcements) end)
Trigger.AfterDelay(Utils.Seconds(60), function() Reinforce(VehicleReinforcements) end)
Trigger.AfterDelay(DateTime.Seconds(5), function() Reinforce(InfantryReinforcements) end)
Trigger.AfterDelay(DateTime.Seconds(15), function() Reinforce(InfantryReinforcements) end)
Trigger.AfterDelay(DateTime.Seconds(30), function() Reinforce(VehicleReinforcements) end)
Trigger.AfterDelay(DateTime.Seconds(60), function() Reinforce(VehicleReinforcements) end)
end
tick = 0
@@ -94,7 +94,7 @@ Tick = function()
enemy.MarkCompletedObjective(nodObjective)
end
if not baseEstablished and tick % Utils.Seconds(1) == 0 and CheckForBase() then
if not baseEstablished and tick % DateTime.Seconds(1) == 0 and CheckForBase() then
baseEstablished = true
player.MarkCompletedObjective(gdiObjective2)
end

View File

@@ -12,9 +12,9 @@ end
BridgeheadSecured = function()
Reinforce(MobileConstructionVehicle)
Trigger.AfterDelay(Utils.Seconds(15), NodAttack)
Trigger.AfterDelay(Utils.Seconds(30), function() Reinforce(EngineerReinforcements) end)
Trigger.AfterDelay(Utils.Seconds(120), function() Reinforce(VehicleReinforcements) end)
Trigger.AfterDelay(DateTime.Seconds(15), NodAttack)
Trigger.AfterDelay(DateTime.Seconds(30), function() Reinforce(EngineerReinforcements) end)
Trigger.AfterDelay(DateTime.Seconds(120), function() Reinforce(VehicleReinforcements) end)
end
NodAttack = function()
@@ -25,7 +25,7 @@ NodAttack = function()
unit.AttackMove(waypoint2.Location)
Trigger.OnIdle(unit, unit.Hunt)
end)
Trigger.OnAllKilled(attackers, function() Trigger.AfterDelay(Utils.Seconds(15), NodAttack) end)
Trigger.OnAllKilled(attackers, function() Trigger.AfterDelay(DateTime.Seconds(15), NodAttack) end)
end
end
@@ -45,14 +45,14 @@ WorldLoaded = function()
Trigger.OnPlayerWon(player, function()
Media.PlaySpeechNotification(player, "Win")
Trigger.AfterDelay(Utils.Seconds(1), function()
Trigger.AfterDelay(DateTime.Seconds(1), function()
Media.PlayMovieFullscreen("flag.vqa")
end)
end)
Trigger.OnPlayerLost(player, function()
Media.PlaySpeechNotification(player, "Lose")
Trigger.AfterDelay(Utils.Seconds(1), function()
Trigger.AfterDelay(DateTime.Seconds(1), function()
Media.PlayMovieFullscreen("gameover.vqa")
end)
end)

View File

@@ -11,9 +11,9 @@ GDIReinforcements = { "e2", "e2", "e2", "e2", "e2" }
GDIReinforcementsWaypoints = { GDIReinforcementsEntry.Location, GDIReinforcementsWP1.Location }
NodHelis = {
{ Utils.Seconds(HeliDelay[1]), { NodHeliEntry.Location, NodHeliLZ1.Location }, { "e1", "e1", "e3" } },
{ Utils.Seconds(HeliDelay[2]), { NodHeliEntry.Location, NodHeliLZ2.Location }, { "e1", "e1", "e1", "e1" } },
{ Utils.Seconds(HeliDelay[3]), { NodHeliEntry.Location, NodHeliLZ3.Location }, { "e1", "e1", "e3" } }
{ DateTime.Seconds(HeliDelay[1]), { NodHeliEntry.Location, NodHeliLZ1.Location }, { "e1", "e1", "e3" } },
{ DateTime.Seconds(HeliDelay[2]), { NodHeliEntry.Location, NodHeliLZ2.Location }, { "e1", "e1", "e1", "e1" } },
{ DateTime.Seconds(HeliDelay[3]), { NodHeliEntry.Location, NodHeliLZ3.Location }, { "e1", "e1", "e3" } }
}
SendHeli = function(heli)
@@ -30,7 +30,7 @@ SendGDIReinforcements = function()
Media.PlaySpeechNotification(gdi, "Reinforce")
Reinforcements.ReinforceWithTransport(gdi, "apc", GDIReinforcements, GDIReinforcementsWaypoints, nil, function(apc, team)
table.insert(team, apc)
Trigger.OnAllKilled(team, function() Trigger.AfterDelay(Utils.Seconds(5), SendGDIReinforcements) end)
Trigger.OnAllKilled(team, function() Trigger.AfterDelay(DateTime.Seconds(5), SendGDIReinforcements) end)
Utils.Do(team, function(unit) unit.Stance = "Defend" end)
end)
end
@@ -49,7 +49,7 @@ BuildNod1 = function()
end
if not HandOfNod.Build(Nod1Units, func) then
Trigger.AfterDelay(Utils.Seconds(5), BuildNod1)
Trigger.AfterDelay(DateTime.Seconds(5), BuildNod1)
end
end
@@ -66,7 +66,7 @@ BuildAuto1 = function()
end
if not HandOfNod.IsDead and HandOfNod.Build(Auto1Units, func) then
Trigger.AfterDelay(Utils.Seconds(5), BuildAuto1)
Trigger.AfterDelay(DateTime.Seconds(5), BuildAuto1)
end
end
@@ -84,7 +84,7 @@ Tick = function()
end
if gdi.HasNoRequiredUnits() then
Trigger.AfterDelay(Utils.Seconds(1), function() gdi.MarkFailedObjective(gdiObjective) end)
Trigger.AfterDelay(DateTime.Seconds(1), function() gdi.MarkFailedObjective(gdiObjective) end)
end
end
@@ -121,14 +121,14 @@ WorldLoaded = function()
Trigger.OnPlayerWon(gdi, function()
Media.PlaySpeechNotification(gdi, "Win")
Trigger.AfterDelay(Utils.Seconds(1), function()
Trigger.AfterDelay(DateTime.Seconds(1), function()
Media.PlayMovieFullscreen("burdet1.vqa")
end)
end)
Trigger.OnPlayerLost(gdi, function()
Media.PlaySpeechNotification(gdi, "Lose")
Trigger.AfterDelay(Utils.Seconds(1), function()
Trigger.AfterDelay(DateTime.Seconds(1), function()
Media.PlayMovieFullscreen("gameover.vqa")
end)
end)

View File

@@ -28,7 +28,7 @@ SendGDIReinforcements = function()
Media.PlaySpeechNotification(gdi, "Reinforce")
Reinforcements.ReinforceWithTransport(gdi, "apc", GDIReinforcements, GDIReinforcementsWaypoints, nil, function(apc, team)
table.insert(team, apc)
Trigger.OnAllKilled(team, function() Trigger.AfterDelay(Utils.Seconds(5), SendGDIReinforcements) end)
Trigger.OnAllKilled(team, function() Trigger.AfterDelay(DateTime.Seconds(5), SendGDIReinforcements) end)
Utils.Do(team, function(unit) unit.Stance = "Defend" end)
end)
end
@@ -48,7 +48,7 @@ Build = function(unitTypes, repeats, func)
end
if not HandOfNod.Build(unitTypes, innerFunc) then
Trigger.AfterDelay(Utils.Seconds(5), function()
Trigger.AfterDelay(DateTime.Seconds(5), function()
Build(unitTypes, repeats, func)
end)
end
@@ -90,7 +90,7 @@ Tick = function()
end
if gdi.HasNoRequiredUnits() then
Trigger.AfterDelay(Utils.Seconds(1), function()
Trigger.AfterDelay(DateTime.Seconds(1), function()
gdi.MarkFailedObjective(gdiObjective)
end)
end
@@ -126,14 +126,14 @@ WorldLoaded = function()
Trigger.OnPlayerWon(gdi, function()
Media.PlaySpeechNotification(gdi, "Win")
Trigger.AfterDelay(Utils.Seconds(1), function()
Trigger.AfterDelay(DateTime.Seconds(1), function()
Media.PlayMovieFullscreen("burdet1.vqa")
end)
end)
Trigger.OnPlayerLost(gdi, function()
Media.PlaySpeechNotification(gdi, "Lose")
Trigger.AfterDelay(Utils.Seconds(1), function()
Trigger.AfterDelay(DateTime.Seconds(1), function()
Media.PlayMovieFullscreen("gameover.vqa")
end)
end)
@@ -177,7 +177,7 @@ WorldLoaded = function()
autoTrigger = true
Trigger.RemoveFootprintTrigger(id)
BuildAuto()
Trigger.AfterDelay(Utils.Seconds(4), function()
Trigger.AfterDelay(DateTime.Seconds(4), function()
tank.Hunt()
end)
end

View File

@@ -6,7 +6,7 @@ GDIReinforcementsPart1 = { "jeep", "jeep" }
GDIReinforcementsPart2 = { "e2", "e2", "e2", "e2", "e2" }
TownAttackWave1 = { "bggy", "bggy" }
TownAttackWave2 = { "ltnk", "ltnk" }
TownAttackWave3 = { "e1", "e1", "e1", "e1", "e3", "e3", "e3", "e3" }
TownAttackWave3 = { "e1", "e1", "e1", "e3", "e3", "e3" }
TownAttackWpts = { waypoint1, waypoint2 }
Civvie1Wpts = { waypoint3, waypoint17 }
@@ -15,7 +15,7 @@ Civvie2Wpts = { waypoint26, waypoint3, waypoint9, waypoint4, waypoint5, waypoint
FollowCivvieWpts = function(actor, wpts)
Utils.Do(wpts, function(wpt)
actor.Move(wpt.Location, 2)
actor.Wait(Utils.Seconds(2))
actor.Wait(DateTime.Seconds(2))
end)
end
@@ -36,22 +36,22 @@ TownAttackAction = function(actor)
end
AttackTown = function()
Reinforcements.Reinforce(nod, TownAttackWave1, { NodReinfEntry.Location, waypoint0.Location }, Utils.Seconds(0.25), TownAttackAction)
Trigger.AfterDelay(Utils.Seconds(2), function()
Reinforcements.Reinforce(nod, TownAttackWave2, { NodReinfEntry.Location, waypoint0.Location }, Utils.Seconds(1), TownAttackAction)
Reinforcements.Reinforce(nod, TownAttackWave1, { NodReinfEntry.Location, waypoint0.Location }, DateTime.Seconds(0.25), TownAttackAction)
Trigger.AfterDelay(DateTime.Seconds(2), function()
Reinforcements.Reinforce(nod, TownAttackWave2, { NodReinfEntry.Location, waypoint0.Location }, DateTime.Seconds(1), TownAttackAction)
end)
Trigger.AfterDelay(Utils.Seconds(4), function()
Reinforcements.Reinforce(nod, TownAttackWave3, { NodReinfEntry.Location, waypoint0.Location }, Utils.Seconds(1), TownAttackAction)
Trigger.AfterDelay(DateTime.Seconds(4), function()
Reinforcements.Reinforce(nod, TownAttackWave3, { NodReinfEntry.Location, waypoint0.Location }, DateTime.Seconds(1), TownAttackAction)
end)
end
SendGDIReinforcements = function()
Reinforcements.Reinforce(player, GDIReinforcementsPart1, { GDIReinfEntry1.Location, waypoint12.Location }, Utils.Seconds(1), function(actor)
Reinforcements.Reinforce(player, GDIReinforcementsPart1, { GDIReinfEntry1.Location, waypoint12.Location }, DateTime.Seconds(1), function(actor)
Media.PlaySpeechNotification(player, "Reinforce")
actor.Move(waypoint10.Location)
actor.Stance = "Defend"
end)
Trigger.AfterDelay(Utils.Seconds(5), function()
Trigger.AfterDelay(DateTime.Seconds(5), function()
Reinforcements.ReinforceWithTransport(player, "apc", GDIReinforcementsPart2, { GDIReinfEntry2.Location, waypoint13.Location }, nil, function(apc, team)
Media.PlaySpeechNotification(player, "Reinforce")
apc.Move(GDIUnloadWpt.Location)
@@ -81,14 +81,14 @@ WorldLoaded = function()
Trigger.OnPlayerWon(player, function()
Media.PlaySpeechNotification(player, "Win")
Trigger.AfterDelay(Utils.Seconds(1), function()
Trigger.AfterDelay(DateTime.Seconds(1), function()
Media.PlayMovieFullscreen("burdet1.vqa")
end)
end)
Trigger.OnPlayerLost(player, function()
Media.PlaySpeechNotification(player, "Lose")
Trigger.AfterDelay(Utils.Seconds(1), function()
Trigger.AfterDelay(DateTime.Seconds(1), function()
Media.PlayMovieFullscreen("gameover.vqa")
end)
end)
@@ -97,15 +97,19 @@ WorldLoaded = function()
gdiObjective1 = player.AddPrimaryObjective("Defend the town of Bialystok")
gdiObjective2 = player.AddPrimaryObjective("Eliminate all Nod forces in the area")
townAttackTrigger = false
Trigger.OnExitedFootprint(TownAttackTrigger, function(a, id)
if a.Owner == player then
if not townAttackTrigger and a.Owner == player then
townAttackTrigger = true
Trigger.RemoveFootprintTrigger(id)
AttackTown()
end
end)
gdiReinforcementsTrigger = false
Trigger.OnEnteredFootprint(GDIReinforcementsTrigger, function(a, id)
if a.Owner == player then
if not gdiReinforcementsTrigger and a.Owner == player then
gdiReinforcementsTrigger = true
Trigger.RemoveFootprintTrigger(id)
SendGDIReinforcements()
end

View File

@@ -613,7 +613,7 @@ Actors:
Health: 1
Facing: 0
SubCell: 0
Actor155: e3
Actor155: e1
Location: 55,29
Owner: Nod
Health: 1
@@ -763,30 +763,12 @@ Actors:
Health: 1
Facing: 0
SubCell: 4
Actor180: e3
Location: 27,24
Owner: Nod
Health: 1
Facing: 0
SubCell: 3
Actor181: e3
Location: 27,25
Owner: Nod
Health: 1
Facing: 0
SubCell: 2
Actor182: e3
Location: 26,25
Owner: Nod
Health: 1
Facing: 0
SubCell: 2
Actor183: e3
Location: 50,28
Owner: Nod
Health: 1
Facing: 160
SubCell: 3
Actor184: e3
Location: 56,29
Owner: Nod

View File

@@ -37,7 +37,7 @@ WorldLoaded = function()
Trigger.OnPlayerLost(nod, function()
Media.PlaySpeechNotification(nod, "Lose")
Trigger.AfterDelay(Utils.Seconds(1), function()
Trigger.AfterDelay(DateTime.Seconds(1), function()
Media.PlayMovieFullscreen("nodlose.vqa")
end)
end)
@@ -49,13 +49,13 @@ WorldLoaded = function()
Trigger.OnKilled(Nikoomba, function()
nod.MarkCompletedObjective(NodObjective1)
Trigger.AfterDelay(Utils.Seconds(1), function()
Trigger.AfterDelay(DateTime.Seconds(1), function()
SendLastInfantryReinforcements()
end)
end)
Trigger.AfterDelay(Utils.Seconds(30), SendFirstInfantryReinforcements)
Trigger.AfterDelay(Utils.Seconds(60), SendSecondInfantryReinforcements)
Trigger.AfterDelay(DateTime.Seconds(30), SendFirstInfantryReinforcements)
Trigger.AfterDelay(DateTime.Seconds(60), SendSecondInfantryReinforcements)
end
Tick = function()

View File

@@ -3,14 +3,14 @@ FirstAttackWave = { "e1", "e1", "e1", "e2", }
SecondThirdAttackWave = { "e1", "e1", "e2", }
SendAttackWave = function(units, spawnPoint)
Reinforcements.Reinforce(enemy, units, { spawnPoint }, Utils.Seconds(1), function(actor)
Reinforcements.Reinforce(enemy, units, { spawnPoint }, DateTime.Seconds(1), function(actor)
actor.AttackMove(PlayerBase.Location)
end)
end
InsertNodUnits = function()
Reinforcements.Reinforce(player, NodUnits, { NodEntry.Location, NodRallyPoint.Location })
Trigger.AfterDelay(Utils.Seconds(9), function()
Trigger.AfterDelay(DateTime.Seconds(9), function()
Reinforcements.Reinforce(player, { "mcv" }, { NodEntry.Location, PlayerBase.Location })
end)
end
@@ -31,14 +31,14 @@ WorldLoaded = function()
Trigger.OnPlayerWon(player, function()
Media.PlaySpeechNotification(player, "Win")
Trigger.AfterDelay(Utils.Seconds(1), function()
Trigger.AfterDelay(DateTime.Seconds(1), function()
Media.PlayMovieFullscreen("desflees.vqa")
end)
end)
Trigger.OnPlayerLost(player, function()
Media.PlaySpeechNotification(player, "Lose")
Trigger.AfterDelay(Utils.Seconds(1), function()
Trigger.AfterDelay(DateTime.Seconds(1), function()
Media.PlayMovieFullscreen("flag.vqa")
end)
end)
@@ -48,7 +48,7 @@ WorldLoaded = function()
nodObjective2 = player.AddSecondaryObjective("Destroy all GDI forces")
Trigger.OnCapture(TechCenter, function()
Trigger.AfterDelay(Utils.Seconds(2), function()
Trigger.AfterDelay(DateTime.Seconds(2), function()
player.MarkCompletedObjective(nodObjective1)
end)
end)
@@ -58,9 +58,9 @@ WorldLoaded = function()
end)
InsertNodUnits()
Trigger.AfterDelay(Utils.Seconds(20), function() SendAttackWave(FirstAttackWave, AttackWaveSpawnA.Location) end)
Trigger.AfterDelay(Utils.Seconds(50), function() SendAttackWave(SecondThirdAttackWave, AttackWaveSpawnB.Location) end)
Trigger.AfterDelay(Utils.Seconds(100), function() SendAttackWave(SecondThirdAttackWave, AttackWaveSpawnC.Location) end)
Trigger.AfterDelay(DateTime.Seconds(20), function() SendAttackWave(FirstAttackWave, AttackWaveSpawnA.Location) end)
Trigger.AfterDelay(DateTime.Seconds(50), function() SendAttackWave(SecondThirdAttackWave, AttackWaveSpawnB.Location) end)
Trigger.AfterDelay(DateTime.Seconds(100), function() SendAttackWave(SecondThirdAttackWave, AttackWaveSpawnC.Location) end)
end
Tick = function()

View File

@@ -26,7 +26,7 @@ end
InsertNodUnits = function()
Reinforcements.Reinforce(player, { "mcv" }, { McvEntry.Location, McvDeploy.Location })
Reinforcements.Reinforce(player, NodUnits, { NodEntry.Location, NodRallypoint.Location })
Trigger.AfterDelay(Utils.Seconds(15), function()
Trigger.AfterDelay(DateTime.Seconds(15), function()
Reinforcements.Reinforce(player, Engineers, { McvEntry.Location, PlayerBase.Location })
end)
end
@@ -47,14 +47,14 @@ WorldLoaded = function()
Trigger.OnPlayerWon(player, function()
Media.PlaySpeechNotification(player, "Win")
Trigger.AfterDelay(Utils.Seconds(1), function()
Trigger.AfterDelay(DateTime.Seconds(1), function()
Media.PlayMovieFullscreen("desflees.vqa")
end)
end)
Trigger.OnPlayerLost(player, function()
Media.PlaySpeechNotification(player, "Lose")
Trigger.AfterDelay(Utils.Seconds(1), function()
Trigger.AfterDelay(DateTime.Seconds(1), function()
Media.PlayMovieFullscreen("flag.vqa")
end)
end)
@@ -65,15 +65,15 @@ WorldLoaded = function()
Trigger.OnKilled(TechCenter, function() player.MarkFailedObjective(nodObjective1) end)
Trigger.OnCapture(TechCenter, function()
Trigger.AfterDelay(Utils.Seconds(2), function()
Trigger.AfterDelay(DateTime.Seconds(2), function()
player.MarkCompletedObjective(nodObjective1)
end)
end)
InsertNodUnits()
Trigger.AfterDelay(Utils.Seconds(40), function() SendAttackWave(FirstAttackWaveUnits, FirstAttackWave) end)
Trigger.AfterDelay(Utils.Seconds(80), function() SendAttackWave(SecondAttackWaveUnits, SecondAttackWave) end)
Trigger.AfterDelay(Utils.Seconds(140), function() SendAttackWave(ThirdAttackWaveUnits, FirstAttackWave) end)
Trigger.AfterDelay(DateTime.Seconds(40), function() SendAttackWave(FirstAttackWaveUnits, FirstAttackWave) end)
Trigger.AfterDelay(DateTime.Seconds(80), function() SendAttackWave(SecondAttackWaveUnits, SecondAttackWave) end)
Trigger.AfterDelay(DateTime.Seconds(140), function() SendAttackWave(ThirdAttackWaveUnits, FirstAttackWave) end)
end

View File

@@ -195,23 +195,9 @@ Fonts:
Font:./mods/common/FreeSansBold.ttf
Size:10
LuaScripts:
./mods/common/lua/utils.lua
./mods/common/lua/openra.lua
./mods/common/lua/map.lua
./mods/common/lua/actor.lua
./mods/common/lua/team.lua
./mods/common/lua/media.lua
./mods/common/lua/mission.lua
./mods/common/lua/reinforcements.lua
./mods/common/lua/supportpowers.lua
./mods/common/lua/rules.lua
./mods/common/lua/production.lua
./mods/common/lua/facing.lua
Missions:
./mods/cnc/missions.yaml
SupportsMapsFrom: cnc
SpriteFormats: ShpTD, TmpTD, ShpTS, TmpRA
SpriteFormats: ShpTD, TmpTD, ShpTS, TmpRA

View File

@@ -176,20 +176,6 @@ Fonts:
Font:./mods/common/FreeSansBold.ttf
Size:10
LuaScripts:
./mods/common/lua/utils.lua
./mods/common/lua/openra.lua
./mods/common/lua/map.lua
./mods/common/lua/actor.lua
./mods/common/lua/team.lua
./mods/common/lua/media.lua
./mods/common/lua/mission.lua
./mods/common/lua/reinforcements.lua
./mods/common/lua/supportpowers.lua
./mods/common/lua/rules.lua
./mods/common/lua/production.lua
./mods/common/lua/facing.lua
SupportsMapsFrom: d2k
SpriteFormats: R8, ShpTD, TmpRA
SpriteFormats: R8, ShpTD, TmpRA

View File

@@ -17,7 +17,7 @@ SendInsertionHelicopter = function()
end
SendJeeps = function()
Reinforcements.Reinforce(player, JeepReinforcements, InsertionPath, Utils.Seconds(2))
Reinforcements.Reinforce(player, JeepReinforcements, InsertionPath, DateTime.Seconds(2))
Media.PlaySpeechNotification(player, "ReinforcementsArrived")
end
@@ -28,8 +28,8 @@ RunInitialActivities = function()
Patrol3.Hunt()
Patrol4.Hunt()
Harvester.FindResources()
Civilian1.Wait(Utils.Seconds(6))
Civilian2.Wait(Utils.Seconds(6))
Civilian1.Wait(DateTime.Seconds(6))
Civilian2.Wait(DateTime.Seconds(6))
Civilian1.Hunt()
Civilian2.Hunt()
end
@@ -37,21 +37,21 @@ end
LabGuardsKilled = function()
CreateEinstein()
Trigger.AfterDelay(Utils.Seconds(2), function()
Trigger.AfterDelay(DateTime.Seconds(2), function()
Actor.Create(FlareType, true, { Owner = england, Location = ExtractionFlarePoint.Location })
Media.PlaySpeechNotification(player, "SignalFlareNorth")
SendExtractionHelicopter()
end)
Trigger.AfterDelay(Utils.Seconds(10), function()
Trigger.AfterDelay(DateTime.Seconds(10), function()
Media.PlaySpeechNotification(player, "AlliedReinforcementsArrived")
Actor.Create("camera", true, { Owner = player, Location = CruiserCameraPoint.Location })
SendCruisers()
end)
Trigger.AfterDelay(Utils.Seconds(12), function()
Trigger.AfterDelay(DateTime.Seconds(12), function()
for i = 0, 2 do
Trigger.AfterDelay(Utils.Seconds(i), function()
Trigger.AfterDelay(DateTime.Seconds(i), function()
Media.PlaySoundNotification(player, "AlertBuzzer")
end)
end
@@ -100,7 +100,7 @@ RescueFailed = function()
end
OilPumpDestroyed = function()
Trigger.AfterDelay(Utils.Seconds(5), SendJeeps)
Trigger.AfterDelay(DateTime.Seconds(5), SendJeeps)
end
CiviliansKilled = function()
@@ -116,13 +116,13 @@ CreateEinstein = function()
einstein.Scatter()
Trigger.OnKilled(einstein, RescueFailed)
ExtractObjective = player.AddPrimaryObjective("Wait for the helicopter and extract Einstein.")
Trigger.AfterDelay(Utils.Seconds(1), function() Media.PlaySpeechNotification(player, "TargetFreed") end)
Trigger.AfterDelay(DateTime.Seconds(1), function() Media.PlaySpeechNotification(player, "TargetFreed") end)
end
HelicopterGone = function()
if not heli.IsDead then
Media.PlaySpeechNotification(player, "TargetRescued")
Trigger.AfterDelay(Utils.Seconds(1), function()
Trigger.AfterDelay(DateTime.Seconds(1), function()
player.MarkCompletedObjective(ExtractObjective)
player.MarkCompletedObjective(SurviveObjective)
ussr.MarkFailedObjective(DefendObjective)
@@ -135,14 +135,14 @@ end
MissionAccomplished = function()
Media.PlaySpeechNotification(player, "Win")
--Trigger.AfterDelay(Utils.Seconds(1), function()
--Trigger.AfterDelay(DateTime.Seconds(1), function()
--Media.PlayMovieFullscreen("snowbomb.vqa") -- https://github.com/OpenRA/OpenRA/issues/4224
--end)
end
MissionFailed = function()
Media.PlaySpeechNotification(player, "Lose")
Trigger.AfterDelay(Utils.Seconds(1), function() Media.PlayMovieFullscreen("bmap.vqa") end)
Trigger.AfterDelay(DateTime.Seconds(1), function() Media.PlayMovieFullscreen("bmap.vqa") end)
end
SetUnitStances = function()
@@ -197,7 +197,7 @@ WorldLoaded = function()
SetUnitStances()
Trigger.AfterDelay(Utils.Seconds(5), function() Actor.Create("camera", true, { Owner = player, Location = BaseCameraPoint.Location }) end)
Trigger.AfterDelay(DateTime.Seconds(5), function() Actor.Create("camera", true, { Owner = player, Location = BaseCameraPoint.Location }) end)
Camera.Position = InsertionLZ.CenterPosition

View File

@@ -13,7 +13,7 @@ end
SendJeepReinforcements = function()
Media.PlaySpeechNotification(player, "ReinforcementsArrived")
Reinforcements.Reinforce(player, JeepReinforcements, JeepPath, Utils.Seconds(1))
Reinforcements.Reinforce(player, JeepReinforcements, JeepPath, DateTime.Seconds(1))
end
RunInitialActivities = function()
@@ -22,14 +22,14 @@ end
MissionAccomplished = function()
Media.PlaySpeechNotification(player, "Win")
Trigger.AfterDelay(Utils.Seconds(1), function()
Trigger.AfterDelay(DateTime.Seconds(1), function()
Media.PlayMovieFullscreen("montpass.vqa")
end)
end
MissionFailed = function()
Media.PlaySpeechNotification(player, "Lose")
Trigger.AfterDelay(Utils.Seconds(1), function()
Trigger.AfterDelay(DateTime.Seconds(1), function()
Media.PlayMovieFullscreen("frozen.vqa")
end)
end
@@ -53,9 +53,9 @@ SendTrucks = function()
ConvoyOnSite = true
ConvoyObjective = player.AddPrimaryObjective("Escort the convoy")
Media.PlaySpeechNotification(player, "ConvoyApproaching")
Trigger.AfterDelay(Utils.Seconds(3), function()
Trigger.AfterDelay(DateTime.Seconds(3), function()
ConvoyUnharmed = true
local trucks = Reinforcements.Reinforce(france, TruckReinforcements, TruckPath, Utils.Seconds(1),
local trucks = Reinforcements.Reinforce(france, TruckReinforcements, TruckPath, DateTime.Seconds(1),
function(truck)
Trigger.OnIdle(truck, function() truck.Move(TruckExitPoint.Location) end)
end)
@@ -79,7 +79,7 @@ ConvoyCasualites = function()
Media.PlaySpeechNotification(player, "ConvoyUnitLost")
if ConvoyUnharmed then
ConvoyUnharmed = false
Trigger.AfterDelay(Utils.Seconds(1), function() player.MarkFailedObjective(ConvoyObjective) end)
Trigger.AfterDelay(DateTime.Seconds(1), function() player.MarkFailedObjective(ConvoyObjective) end)
end
end
@@ -116,19 +116,19 @@ WorldLoaded = function()
RunInitialActivities()
SendConstructionVehicleReinforcements()
Trigger.AfterDelay(Utils.Seconds(5), SendJeepReinforcements)
Trigger.AfterDelay(Utils.Seconds(10), SendJeepReinforcements)
Trigger.AfterDelay(DateTime.Seconds(5), SendJeepReinforcements)
Trigger.AfterDelay(DateTime.Seconds(10), SendJeepReinforcements)
Trigger.AfterDelay(Utils.Minutes(10), SendTrucks)
Trigger.AfterDelay(DateTime.Minutes(10), SendTrucks)
Camera.Position = ReinforcementsEntryPoint.CenterPosition
Media.PlayMovieFullscreen("mcv.vqa")
ConvoyTimer(Utils.Seconds(3), "TenMinutesRemaining")
ConvoyTimer(Utils.Minutes(5), "WarningFiveMinutesRemaining")
ConvoyTimer(Utils.Minutes(6), "WarningFourMinutesRemaining")
ConvoyTimer(Utils.Minutes(7), "WarningThreeMinutesRemaining")
ConvoyTimer(Utils.Minutes(8), "WarningTwoMinutesRemaining")
ConvoyTimer(Utils.Minutes(9), "WarningOneMinuteRemaining")
ConvoyTimer(DateTime.Seconds(3), "TenMinutesRemaining")
ConvoyTimer(DateTime.Minutes(5), "WarningFiveMinutesRemaining")
ConvoyTimer(DateTime.Minutes(6), "WarningFourMinutesRemaining")
ConvoyTimer(DateTime.Minutes(7), "WarningThreeMinutesRemaining")
ConvoyTimer(DateTime.Minutes(8), "WarningTwoMinutesRemaining")
ConvoyTimer(DateTime.Minutes(9), "WarningOneMinuteRemaining")
end

View File

@@ -1,4 +1,4 @@
if Date.IsHalloween then
if DateTime.IsHalloween then
UnitTypes = { "ant", "ant", "ant" }
BeachUnitTypes = { "ant", "ant" }
ParadropUnitTypes = { "zombie", "zombie", "zombie", "zombie", "zombie" }
@@ -68,7 +68,7 @@ ShipAlliedUnits = function()
BindActorTriggers(unit)
end)
Trigger.AfterDelay(Utils.Seconds(60), ShipAlliedUnits)
Trigger.AfterDelay(DateTime.Seconds(60), ShipAlliedUnits)
end
InsertAlliedChinookReinforcements = function(entry, hpad)
@@ -79,13 +79,13 @@ InsertAlliedChinookReinforcements = function(entry, hpad)
BindActorTriggers(unit)
end)
Trigger.AfterDelay(Utils.Seconds(60), function() InsertAlliedChinookReinforcements(entry, hpad) end)
Trigger.AfterDelay(DateTime.Seconds(60), function() InsertAlliedChinookReinforcements(entry, hpad) end)
end
ParadropSovietUnits = function()
local lz = Utils.Random(ParadropWaypoints).Location
local start = Utils.CenterOfCell(Map.RandomEdgeCell()) + WVec.New(0, 0, Actor.CruiseAltitude("badr"))
local transport = Actor.Create("badr", true, { CenterPosition = start, Owner = soviets, Facing = (Utils.CenterOfCell(lz) - start).Facing })
local start = Map.CenterOfCell(Map.RandomEdgeCell()) + WVec.New(0, 0, Actor.CruiseAltitude("badr"))
local transport = Actor.Create("badr", true, { CenterPosition = start, Owner = soviets, Facing = (Map.CenterOfCell(lz) - start).Facing })
Utils.Do(ParadropUnitTypes, function(type)
local a = Actor.Create(type, false, { Owner = soviets })
@@ -94,7 +94,7 @@ ParadropSovietUnits = function()
end)
transport.Paradrop(lz)
Trigger.AfterDelay(Utils.Seconds(35), ParadropSovietUnits)
Trigger.AfterDelay(DateTime.Seconds(35), ParadropSovietUnits)
end
ProduceUnits = function(t)
@@ -131,7 +131,7 @@ ChronoshiftAlliedUnits = function()
units[unit] = cells[i]
end
Chronosphere.Chronoshift(units)
Trigger.AfterDelay(Utils.Seconds(60), ChronoshiftAlliedUnits)
Trigger.AfterDelay(DateTime.Seconds(60), ChronoshiftAlliedUnits)
end
ticks = 0
@@ -155,7 +155,7 @@ WorldLoaded = function()
InsertAlliedChinookReinforcements(Chinook1Entry, HeliPad1)
InsertAlliedChinookReinforcements(Chinook2Entry, HeliPad2)
ParadropSovietUnits()
Trigger.AfterDelay(Utils.Seconds(5), ChronoshiftAlliedUnits)
Trigger.AfterDelay(DateTime.Seconds(5), ChronoshiftAlliedUnits)
Utils.Do(ProducedUnitTypes, ProduceUnits)
SendSovietUnits(Entry1.Location, UnitTypes, 50)
@@ -165,4 +165,4 @@ WorldLoaded = function()
SendSovietUnits(Entry5.Location, UnitTypes, 50)
SendSovietUnits(Entry6.Location, UnitTypes, 50)
SendSovietUnits(Entry7.Location, BeachUnitTypes, 15)
end
end

View File

@@ -9,14 +9,14 @@ BeachheadTrigger =
CPos.New(137, 104), CPos.New(137, 105), CPos.New(137, 106), CPos.New(136, 106), CPos.New(136, 107)
}
BaseRaidInterval = Utils.Minutes(3)
BaseFrontAttackInterval = Utils.Minutes(3) + Utils.Seconds(30)
BaseRearAttackInterval = Utils.Minutes(8)
UBoatPatrolDelay = Utils.Minutes(2) + Utils.Seconds(30)
BaseRaidInterval = DateTime.Minutes(3)
BaseFrontAttackInterval = DateTime.Minutes(3) + DateTime.Seconds(30)
BaseRearAttackInterval = DateTime.Minutes(8)
UBoatPatrolDelay = DateTime.Minutes(2) + DateTime.Seconds(30)
BaseFrontAttackWpts = { PatrolWpt1.Location, BaseRaidWpt1.Location }
Village = { FarmHouse1, FarmHouse2, FarmHouse3, FarmHouse4, FarmHouse5, FarmHouse6, FarmHouse7, FarmHouse8, FarmHouse9, Church }
VillageRaidInterval = Utils.Minutes(3)
VillageRaidInterval = DateTime.Minutes(3)
VillageRaidAircraft = { "mig", "mig" }
VillageRaidWpts = { VillageRaidEntrypoint.Location, VillageRaidWpt1.Location, VillageRaidWpt2.Location }
@@ -48,7 +48,7 @@ Paratroopers = { "e1", "e1", "e1", "e3", "e3" }
ParadropSovietUnits = function()
local start = BaseRaidEntrypoint.CenterPosition + WVec.New(0, 0, Actor.CruiseAltitude("badr"))
local transport = Actor.Create("badr", true, { CenterPosition = start, Owner = soviets, Facing = (Utils.CenterOfCell(MCVDeployLocation.Location) - start).Facing })
local transport = Actor.Create("badr", true, { CenterPosition = start, Owner = soviets, Facing = (Map.CenterOfCell(MCVDeployLocation.Location) - start).Facing })
Utils.Do(Paratroopers, function(type)
local a = Actor.Create(type, false, { Owner = soviets })
@@ -65,9 +65,9 @@ AirRaid = function(planeTypes, ingress, egress, target)
end
for i = 1, #planeTypes do
Trigger.AfterDelay((i - 1) * Utils.Seconds(1), function()
local start = Utils.CenterOfCell(ingress[1]) + WVec.New(0, 0, Actor.CruiseAltitude(planeTypes[i]))
local plane = Actor.Create(planeTypes[i], true, { CenterPosition = start, Owner = soviets, Facing = (Utils.CenterOfCell(ingress[2]) - start).Facing })
Trigger.AfterDelay((i - 1) * DateTime.Seconds(1), function()
local start = Map.CenterOfCell(ingress[1]) + WVec.New(0, 0, Actor.CruiseAltitude(planeTypes[i]))
local plane = Actor.Create(planeTypes[i], true, { CenterPosition = start, Owner = soviets, Facing = (Map.CenterOfCell(ingress[2]) - start).Facing })
Utils.Do(ingress, function(wpt) plane.Move(wpt) end)
plane.Attack(target)
@@ -116,7 +116,7 @@ SendUboatPatrol = function(team)
Utils.Do(team, function(uboat)
if not uboat.IsDead then
uboat.PatrolUntil(UboatPatrolWpts1, function()
return Time.GameTime > Utils.Minutes(2) + UBoatPatrolDelay
return DateTime.GameTime > DateTime.Minutes(2) + UBoatPatrolDelay
end)
uboat.Patrol(UboatPatrolWpts2)
end
@@ -125,7 +125,7 @@ SendUboatPatrol = function(team)
end
SendGroundPatrol = function(team)
Utils.Do(team, function(unit) unit.Patrol(GroundPatrolWpts, true, Utils.Seconds(3)) end)
Utils.Do(team, function(unit) unit.Patrol(GroundPatrolWpts, true, DateTime.Seconds(3)) end)
Utils.Do(team, function(unit)
Trigger.OnIdle(unit, function(actor) actor.Hunt() end)
end)
@@ -152,7 +152,7 @@ end
Build = function(units, action)
if not soviets.Build(units, action) then
Trigger.AfterDelay(Utils.Seconds(15), function()
Trigger.AfterDelay(DateTime.Seconds(15), function()
Build(units, action)
end)
end
@@ -235,7 +235,7 @@ WorldLoaded = function()
captureObjective = player.AddPrimaryObjective("Locate and capture the enemy's Air Force HQ.")
Trigger.OnCapture(AirForceHQ, function()
Trigger.AfterDelay(Utils.Seconds(3), function()
Trigger.AfterDelay(DateTime.Seconds(3), function()
player.MarkCompletedObjective(captureObjective)
player.MarkCompletedObjective(villageObjective)
end)
@@ -275,5 +275,5 @@ WorldLoaded = function()
end)
Camera.Position = CameraSpot.CenterPosition
Trigger.AfterDelay(Utils.Seconds(5), function() CameraSpot.Destroy() end)
Trigger.AfterDelay(DateTime.Seconds(5), function() CameraSpot.Destroy() end)
end

View File

@@ -1,8 +1,8 @@
AlliedUnits =
{
{ 0, { "1tnk", "1tnk", "2tnk", "2tnk" } },
{ Utils.Seconds(3), { "e1", "e1", "e1", "e3", "e3" } },
{ Utils.Seconds(7), { "e6" } }
{ DateTime.Seconds(3), { "e1", "e1", "e1", "e3", "e3" } },
{ DateTime.Seconds(7), { "e6" } }
}
ReinforceBaseUnits = { "1tnk", "1tnk", "2tnk", "arty", "arty" }
CivilianEvacuees = { "c1", "c2", "c5", "c7", "c8" }
@@ -66,11 +66,11 @@ SetupAlliedBase = function()
DefendOutpost = player.AddSecondaryObjective("Defend and repair our outpost.")
player.MarkCompletedObjective(FindOutpost)
Trigger.AfterDelay(Utils.Seconds(1), function() -- don't fail the Objective instantly
Trigger.AfterDelay(DateTime.Seconds(1), function() -- don't fail the Objective instantly
Trigger.OnAllRemovedFromWorld(alliedOutpost, function() player.MarkFailedObjective(DefendOutpost) end)
end)
Trigger.AfterDelay(Utils.Minutes(1) + Utils.Seconds(40), function()
Trigger.AfterDelay(DateTime.Minutes(1) + DateTime.Seconds(40), function()
if not SuperTankDomeIsInfiltrated then
SuperTankAttack = true
Utils.Do(SuperTanks, function(tnk)
@@ -101,7 +101,7 @@ SendAlliedUnits = function()
Actor.Create("camera" ,true , { Owner = player, Location = ProvingGroundsCameraPoint.Location })
Actor.Create("camera" ,true , { Owner = ussr, Location = USSRSpen.Location })
Trigger.AfterDelay(Utils.Seconds(1), function() Media.PlaySpeechNotification(player, "ReinforcementsArrived") end)
Trigger.AfterDelay(DateTime.Seconds(1), function() Media.PlaySpeechNotification(player, "ReinforcementsArrived") end)
--To avoid overlapping "battlecontrol initialized" and "reinforcements have arrived"
Utils.Do(AlliedUnits, function(table)
Trigger.AfterDelay(table[1], function()
@@ -109,7 +109,7 @@ SendAlliedUnits = function()
end)
end)
Trigger.AfterDelay(Utils.Seconds(1), function() InitialUnitsArrived = true end)
Trigger.AfterDelay(DateTime.Seconds(1), function() InitialUnitsArrived = true end)
end
SuperTankDomeInfiltrated = function()
@@ -145,12 +145,12 @@ SuperTankDomeInfiltrated = function()
end)
player.MarkCompletedObjective(InfiltrateRadarDome)
Trigger.AfterDelay(Utils.Minutes(3), SuperTanksDestruction)
Trigger.AfterDelay(DateTime.Minutes(3), SuperTanksDestruction)
Trigger.AfterDelay(Utils.Seconds(2), function()
Trigger.AfterDelay(DateTime.Seconds(2), function()
Media.PlaySpeechNotification(player, "ControlCenterDeactivated")
Trigger.AfterDelay(Utils.Seconds(3), function()
Trigger.AfterDelay(DateTime.Seconds(3), function()
Media.DisplayMessage("In 3 minutes the super tanks will self destruct.")
Media.PlaySpeechNotification(player, "WarningThreeMinutesRemaining")
end)
@@ -185,7 +185,7 @@ CreateDemitri = function()
local flarepos = CPos.New(DemitriLZ.Location.X, DemitriLZ.Location.Y - 1)
local demitriLZFlare = Actor.Create("flare", true, { Owner = player, Location = flarepos })
Trigger.AfterDelay(Utils.Seconds(3), function() Media.PlaySpeechNotification(player, "SignalFlareNorth") end)
Trigger.AfterDelay(DateTime.Seconds(3), function() Media.PlaySpeechNotification(player, "SignalFlareNorth") end)
local demitriChinook = Reinforcements.ReinforceWithTransport(player, ExtractionHeli, nil, { ExtractionWaypoint, ExtractionLZ })[1]
@@ -196,8 +196,8 @@ CreateDemitri = function()
Trigger.OnRemovedFromWorld(demitriChinook, function()
if not demitriChinook.IsDead then
Media.PlaySpeechNotification(player, "TargetRescued")
Trigger.AfterDelay(Utils.Seconds(1), function() player.MarkCompletedObjective(EvacuateDemitri) end)
Trigger.AfterDelay(Utils.Seconds(3), SpawnAndMoveAlliedBaseUnits)
Trigger.AfterDelay(DateTime.Seconds(1), function() player.MarkCompletedObjective(EvacuateDemitri) end)
Trigger.AfterDelay(DateTime.Seconds(3), SpawnAndMoveAlliedBaseUnits)
end
end)
Trigger.OnRemovedFromWorld(demitri, function()
@@ -280,7 +280,7 @@ end
InitTriggers = function()
Trigger.OnAllKilled(SuperTanks, function()
Trigger.AfterDelay(Utils.Seconds(3), function() player.MarkCompletedObjective(EliminateSuperTanks) end)
Trigger.AfterDelay(DateTime.Seconds(3), function() player.MarkCompletedObjective(EliminateSuperTanks) end)
end)
Trigger.OnKilled(SuperTankDome, function()

View File

@@ -192,23 +192,9 @@ Fonts:
Font:./mods/common/FreeSansBold.ttf
Size:10
LuaScripts:
./mods/common/lua/utils.lua
./mods/common/lua/openra.lua
./mods/common/lua/map.lua
./mods/common/lua/actor.lua
./mods/common/lua/team.lua
./mods/common/lua/media.lua
./mods/common/lua/mission.lua
./mods/common/lua/reinforcements.lua
./mods/common/lua/supportpowers.lua
./mods/common/lua/rules.lua
./mods/common/lua/production.lua
./mods/common/lua/facing.lua
Missions:
./mods/ra/missions.yaml
SupportsMapsFrom: ra
SpriteFormats: ShpTD, TmpRA, TmpTD, ShpTS
SpriteFormats: ShpTD, TmpRA, TmpTD, ShpTS

View File

@@ -217,20 +217,6 @@ Fonts:
Font:./mods/common/FreeSansBold.ttf
Size:10
LuaScripts:
./mods/common/lua/utils.lua
./mods/common/lua/openra.lua
./mods/common/lua/map.lua
./mods/common/lua/actor.lua
./mods/common/lua/team.lua
./mods/common/lua/media.lua
./mods/common/lua/mission.lua
./mods/common/lua/reinforcements.lua
./mods/common/lua/supportpowers.lua
./mods/common/lua/rules.lua
./mods/common/lua/production.lua
./mods/common/lua/facing.lua
SupportsMapsFrom: ts
SpriteFormats: ShpTS, TmpTS, ShpTD
SpriteFormats: ShpTS, TmpTS, ShpTD