@@ -10,23 +10,33 @@
|
||||
|
||||
using System;
|
||||
using Eluant;
|
||||
using OpenRA.Scripting;
|
||||
using OpenRA.Traits;
|
||||
|
||||
namespace OpenRA.Mods.RA.Activities
|
||||
{
|
||||
public sealed class CallLuaFunc : Activity, IDisposable
|
||||
{
|
||||
readonly ScriptContext context;
|
||||
LuaFunction function;
|
||||
|
||||
public CallLuaFunc(LuaFunction func)
|
||||
public CallLuaFunc(LuaFunction function, ScriptContext context)
|
||||
{
|
||||
function = (LuaFunction)func.CopyReference();
|
||||
this.function = (LuaFunction)function.CopyReference();
|
||||
this.context = context;
|
||||
}
|
||||
|
||||
public override Activity Tick(Actor self)
|
||||
{
|
||||
if (function != null)
|
||||
function.Call().Dispose();
|
||||
try
|
||||
{
|
||||
if (function != null)
|
||||
function.Call().Dispose();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
context.FatalError(ex.Message);
|
||||
}
|
||||
|
||||
Dispose();
|
||||
return NextActivity;
|
||||
@@ -40,7 +50,9 @@ namespace OpenRA.Mods.RA.Activities
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
if (function == null) return;
|
||||
if (function == null)
|
||||
return;
|
||||
|
||||
function.Dispose();
|
||||
function = null;
|
||||
}
|
||||
|
||||
@@ -114,7 +114,7 @@ namespace OpenRA.Mods.RA.Scripting
|
||||
[Desc("Run an arbitrary Lua function.")]
|
||||
public void CallFunc(LuaFunction func)
|
||||
{
|
||||
self.QueueActivity(new CallLuaFunc(func));
|
||||
self.QueueActivity(new CallLuaFunc(func, context));
|
||||
}
|
||||
|
||||
[ScriptActorPropertyActivity]
|
||||
|
||||
@@ -249,51 +249,21 @@ Actors:
|
||||
Nikoomba: c10
|
||||
Location: 29,16
|
||||
Owner: Villagers
|
||||
Actor61: e1
|
||||
Location: 52,17
|
||||
Owner: Nod
|
||||
Actor62: e1
|
||||
Location: 51,17
|
||||
Owner: Nod
|
||||
Actor63: e1
|
||||
Location: 51,16
|
||||
Owner: Nod
|
||||
Actor64: e1
|
||||
Location: 52,16
|
||||
Owner: Nod
|
||||
Actor65: e1
|
||||
Location: 55,17
|
||||
Owner: Nod
|
||||
Actor66: e1
|
||||
Location: 56,17
|
||||
Owner: Nod
|
||||
Actor67: e1
|
||||
Location: 56,16
|
||||
Owner: Nod
|
||||
Actor68: e1
|
||||
Location: 55,16
|
||||
Owner: Nod
|
||||
Actor69: bggy
|
||||
Location: 53,16
|
||||
Owner: Nod
|
||||
Actor70: bggy
|
||||
Location: 54,16
|
||||
Owner: Nod
|
||||
StartSpawnPointLeft: waypoint
|
||||
Location: 52,14
|
||||
Owner: Nod
|
||||
Location: 50,14
|
||||
Owner: Neutral
|
||||
StartSpawnPointRight: waypoint
|
||||
Location: 56,14
|
||||
Owner: Nod
|
||||
Location: 52,14
|
||||
Owner: Neutral
|
||||
StartRallyPoint: waypoint
|
||||
Location: 54,16
|
||||
Owner: Nod
|
||||
Location: 53,17
|
||||
Owner: Neutral
|
||||
VillageSpawnPoint: waypoint
|
||||
Location: 24,14
|
||||
Owner: Nod
|
||||
Owner: Neutral
|
||||
VillageRallyPoint: waypoint
|
||||
Location: 24,17
|
||||
Owner: Nod
|
||||
Owner: Neutral
|
||||
Actor27: jeep
|
||||
Location: 31,28
|
||||
Owner: GDI
|
||||
|
||||
@@ -1,5 +1,14 @@
|
||||
InitialForcesA = { "bggy", "e1", "e1", "e1", "e1" }
|
||||
InitialForcesB = { "e1", "e1", "bggy", "e1", "e1" }
|
||||
|
||||
RifleInfantryReinforcements = { "e1", "e1" }
|
||||
RocketInfantryReinforcements = { "e3", "e3", "e3" }
|
||||
RocketInfantryReinforcements = { "e3", "e3", "e3", "e3", "e3" }
|
||||
|
||||
SendInitialForces = function()
|
||||
Media.PlaySpeechNotification(nod, "Reinforce")
|
||||
Reinforcements.Reinforce(nod, InitialForcesA, { StartSpawnPointLeft.Location, StartRallyPoint.Location }, 5)
|
||||
Reinforcements.Reinforce(nod, InitialForcesB, { StartSpawnPointRight.Location, StartRallyPoint.Location }, 10)
|
||||
end
|
||||
|
||||
SendFirstInfantryReinforcements = function()
|
||||
Media.PlaySpeechNotification(nod, "Reinforce")
|
||||
@@ -13,7 +22,13 @@ end
|
||||
|
||||
SendLastInfantryReinforcements = function()
|
||||
Media.PlaySpeechNotification(nod, "Reinforce")
|
||||
Reinforcements.Reinforce(nod, RocketInfantryReinforcements, { VillageSpawnPoint.Location, VillageRallyPoint.Location }, 15)
|
||||
|
||||
-- Move the units properly into the map before they start attacking
|
||||
local forces = Reinforcements.Reinforce(nod, RocketInfantryReinforcements, { VillageSpawnPoint.Location, VillageRallyPoint.Location }, 8)
|
||||
Utils.Do(forces, function(a)
|
||||
a.Stance = "Defend"
|
||||
a.CallFunc(function() a.Stance = "AttackAnything" end)
|
||||
end)
|
||||
end
|
||||
|
||||
WorldLoaded = function()
|
||||
@@ -54,6 +69,9 @@ WorldLoaded = function()
|
||||
end)
|
||||
end)
|
||||
|
||||
Camera.Position = StartRallyPoint.CenterPosition
|
||||
|
||||
SendInitialForces()
|
||||
Trigger.AfterDelay(DateTime.Seconds(30), SendFirstInfantryReinforcements)
|
||||
Trigger.AfterDelay(DateTime.Seconds(60), SendSecondInfantryReinforcements)
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user