1
Makefile
1
Makefile
@@ -314,6 +314,7 @@ install-core: default
|
||||
@$(INSTALL_DIR) "$(DATA_INSTALL_DIR)"
|
||||
@$(INSTALL_PROGRAM) $(foreach prog,$(CORE),$($(prog)_TARGET)) "$(DATA_INSTALL_DIR)"
|
||||
@$(INSTALL_DIR) "$(DATA_INSTALL_DIR)/mods"
|
||||
@$(CP_R) mods/common "$(DATA_INSTALL_DIR)/mods/"
|
||||
@$(CP_R) mods/cnc "$(DATA_INSTALL_DIR)/mods/"
|
||||
@$(INSTALL_PROGRAM) $(mod_cnc_TARGET) "$(DATA_INSTALL_DIR)/mods/cnc"
|
||||
@$(CP_R) mods/ra "$(DATA_INSTALL_DIR)/mods/"
|
||||
|
||||
@@ -9,6 +9,8 @@
|
||||
#endregion
|
||||
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using NLua;
|
||||
using OpenRA.Effects;
|
||||
@@ -33,6 +35,7 @@ namespace OpenRA.Mods.RA.Scripting
|
||||
public class LuaScriptInterface : IWorldLoaded, ITick
|
||||
{
|
||||
World world;
|
||||
Dictionary<string, Actor> mapActors;
|
||||
readonly LuaScriptContext context = new LuaScriptContext();
|
||||
readonly LuaScriptInterfaceInfo info;
|
||||
|
||||
@@ -44,11 +47,13 @@ namespace OpenRA.Mods.RA.Scripting
|
||||
public void WorldLoaded(World w, WorldRenderer wr)
|
||||
{
|
||||
world = w;
|
||||
mapActors = world.WorldActor.Trait<SpawnMapActors>().Actors;
|
||||
|
||||
context.Lua["World"] = w;
|
||||
context.Lua["WorldRenderer"] = wr;
|
||||
context.RegisterObject(this, "Internal", false);
|
||||
context.RegisterType(typeof(WVec), "WVec", true);
|
||||
context.RegisterType(typeof(CVec), "CVec", true);
|
||||
context.RegisterType(typeof(WPos), "WPos", true);
|
||||
context.RegisterType(typeof(CPos), "CPos", true);
|
||||
context.RegisterType(typeof(WRot), "WRot", true);
|
||||
@@ -70,7 +75,7 @@ namespace OpenRA.Mods.RA.Scripting
|
||||
|
||||
void AddMapActorGlobals()
|
||||
{
|
||||
foreach (var kv in world.WorldActor.Trait<SpawnMapActors>().Actors)
|
||||
foreach (var kv in mapActors)
|
||||
{
|
||||
if (context.Lua[kv.Key] != null)
|
||||
context.ShowErrorMessage("{0}: The global name '{1}' is reserved and may not be used by map actor {2}".F(GetType().Name, kv.Key, kv.Value), null);
|
||||
@@ -146,6 +151,19 @@ namespace OpenRA.Mods.RA.Scripting
|
||||
return ret != null;
|
||||
}
|
||||
|
||||
[LuaGlobal]
|
||||
public object[] ActorsWithTrait(string className)
|
||||
{
|
||||
var type = Game.modData.ObjectCreator.FindType(className);
|
||||
if (type == null)
|
||||
throw new InvalidOperationException("Cannot locate type: {0}".F(className));
|
||||
|
||||
var method = typeof(World).GetMethod("ActorsWithTrait");
|
||||
var genericMethod = method.MakeGenericMethod(type);
|
||||
var result = ((IEnumerable)genericMethod.Invoke(world, null)).Cast<object>().ToArray();
|
||||
return result;
|
||||
}
|
||||
|
||||
[LuaGlobal]
|
||||
public object TraitInfoOrDefault(string actorType, string className)
|
||||
{
|
||||
@@ -273,5 +291,38 @@ namespace OpenRA.Mods.RA.Scripting
|
||||
{
|
||||
return world.ActorsWithTrait<MustBeDestroyed>().All(p => p.Actor.Owner != player);
|
||||
}
|
||||
|
||||
[LuaGlobal]
|
||||
public void AttackMove(Actor actor, CPos location)
|
||||
{
|
||||
if (actor.HasTrait<AttackMove>())
|
||||
actor.QueueActivity(new AttackMove.AttackMoveActivity(actor, new Move.Move(location, 0)));
|
||||
else
|
||||
actor.QueueActivity(new Move.Move(location, 0));
|
||||
}
|
||||
|
||||
[LuaGlobal]
|
||||
public int GetRandomInteger(double low, double high)
|
||||
{
|
||||
return world.SharedRandom.Next((int)low, (int)high);
|
||||
}
|
||||
|
||||
[LuaGlobal]
|
||||
public CPos GetRandomCell()
|
||||
{
|
||||
return world.ChooseRandomCell(world.SharedRandom);
|
||||
}
|
||||
|
||||
[LuaGlobal]
|
||||
public CPos GetRandomEdgeCell()
|
||||
{
|
||||
return world.ChooseRandomEdgeCell();
|
||||
}
|
||||
|
||||
[LuaGlobal]
|
||||
public Actor GetNamedActor(string actorName)
|
||||
{
|
||||
return mapActors[actorName];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,7 +5,7 @@ speed = 5
|
||||
Tick = function()
|
||||
ticks = ticks + 1
|
||||
local t = (ticks + 45) % (360 * speed) * (math.pi / 180) / speed;
|
||||
OpenRA.SetViewportCenterPosition(WPos.op_Addition(viewportOrigin, MakeVec(-15360 * math.sin(t), 4096 * math.cos(t))))
|
||||
OpenRA.SetViewportCenterPosition(WPos.op_Addition(viewportOrigin, WVec.New(-15360 * math.sin(t), 4096 * math.cos(t))))
|
||||
end
|
||||
|
||||
WorldLoaded = function()
|
||||
@@ -16,7 +16,7 @@ WorldLoaded = function()
|
||||
|
||||
local units = { boat1, boat2, boat3, boat4, lst1, lst2, lst3}
|
||||
for i, unit in ipairs(units) do
|
||||
LoopTrack(unit, MakePos(8, unit.Location.Y), MakePos(87, unit.Location.Y))
|
||||
LoopTrack(unit, CPos.New(8, unit.Location.Y), CPos.New(87, unit.Location.Y))
|
||||
end
|
||||
end
|
||||
|
||||
@@ -34,13 +34,4 @@ CreateUnitsInTransport = function(transport, passengerNames)
|
||||
for i, passengerName in ipairs(passengerNames) do
|
||||
cargo:Load(transport, Actor.Create(passengerName, { AddToWorld = false, Owner = owner, Facing = { facing, "Int32" } }))
|
||||
end
|
||||
end
|
||||
|
||||
-- TODO: The standard library should expose CPos.New() etc
|
||||
MakePos = function(x, y)
|
||||
return OpenRA.New("CPos", { {x, "Int32"}, {y, "Int32"} })
|
||||
end
|
||||
|
||||
MakeVec = function(x, y)
|
||||
return OpenRA.New("WVec", { {x, "Int32"}, {y, "Int32"}, {0, "Int32"} })
|
||||
end
|
||||
@@ -165,12 +165,13 @@ Fonts:
|
||||
Size:10
|
||||
|
||||
LuaScripts:
|
||||
mods/ra/lua/utils.lua
|
||||
mods/ra/lua/openra.lua
|
||||
mods/ra/lua/map.lua
|
||||
mods/ra/lua/actor.lua
|
||||
mods/ra/lua/team.lua
|
||||
mods/ra/lua/media.lua
|
||||
mods/ra/lua/mission.lua
|
||||
mods/ra/lua/reinforcements.lua
|
||||
mods/ra/lua/supportpowers.lua
|
||||
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
|
||||
|
||||
@@ -24,17 +24,33 @@ Actor.Move = function(actor, location)
|
||||
end
|
||||
|
||||
Actor.MoveNear = function(actor, location, nearEnough)
|
||||
actor:QueueActivity(OpenRA.New("Move", { location, Map.GetWRangeFromCells(nearEnough) }))
|
||||
actor:QueueActivity(OpenRA.New("Move", { location, WRange.FromCells(nearEnough) }))
|
||||
end
|
||||
|
||||
Actor.ScriptedMove = function(actor, location)
|
||||
actor:QueueActivity(OpenRA.New("Move", { location }))
|
||||
if Actor.HasTrait(actor, "Helicopter") then
|
||||
actor:QueueActivity(OpenRA.New("HeliFly", { location.CenterPosition }))
|
||||
else
|
||||
actor:QueueActivity(OpenRA.New("Move", { location }))
|
||||
end
|
||||
end
|
||||
|
||||
Actor.AfterMove = function(actor)
|
||||
local heli = Actor.TraitOrDefault(actor, "Helicopter")
|
||||
if heli ~= nil then
|
||||
Actor.Turn(actor, heli.Info.InitialFacing)
|
||||
Actor.HeliLand(actor, true)
|
||||
end
|
||||
end
|
||||
|
||||
Actor.Teleport = function(actor, location)
|
||||
actor:QueueActivity(OpenRA.New("SimpleTeleport", { location }))
|
||||
end
|
||||
|
||||
Actor.AttackMove = function(actor, location)
|
||||
Internal.AttackMove(actor, location)
|
||||
end
|
||||
|
||||
Actor.HeliFly = function(actor, position)
|
||||
actor:QueueActivity(OpenRA.New("HeliFly", { position }))
|
||||
end
|
||||
@@ -119,6 +135,10 @@ Actor.Facing = function(actor)
|
||||
return Actor.Trait(actor, "IFacing"):get_Facing()
|
||||
end
|
||||
|
||||
Actor.IsIdle = function(actor)
|
||||
return actor.IsIdle
|
||||
end
|
||||
|
||||
Actor.SetStance = function(actor, stance)
|
||||
Internal.SetUnitStance(actor, stance)
|
||||
end
|
||||
@@ -135,6 +155,14 @@ Actor.OnRemovedFromWorld = function(actor, eh)
|
||||
Actor.Trait(actor, "LuaScriptEvents").OnRemovedFromWorld:Add(eh)
|
||||
end
|
||||
|
||||
Actor.ActorsWithTrait = function(className)
|
||||
local ret = { }
|
||||
for item in Utils.Enumerate(Internal.ActorsWithTrait(className)) do
|
||||
table.insert(ret, item.Actor)
|
||||
end
|
||||
return ret
|
||||
end
|
||||
|
||||
Actor.HasTrait = function(actor, className)
|
||||
return Internal.HasTrait(actor, className)
|
||||
end
|
||||
@@ -145,16 +173,4 @@ end
|
||||
|
||||
Actor.Trait = function(actor, className)
|
||||
return Internal.Trait(actor, className)
|
||||
end
|
||||
|
||||
Actor.HasTraitInfo = function(actorType, className)
|
||||
return Internal.HasTraitInfo(actorType, className)
|
||||
end
|
||||
|
||||
Actor.TraitInfoOrDefault = function(actorType, className)
|
||||
return Internal.TraitInfoOrDefault(actorType, className)
|
||||
end
|
||||
|
||||
Actor.TraitInfo = function(actorType, className)
|
||||
return Internal.TraitInfo(actorType, className)
|
||||
end
|
||||
51
mods/common/lua/map.lua
Normal file
51
mods/common/lua/map.lua
Normal file
@@ -0,0 +1,51 @@
|
||||
Map = { }
|
||||
|
||||
Map.GetFacing = function(vec, currentFacing)
|
||||
return Internal.GetFacing(vec, currentFacing)
|
||||
end
|
||||
|
||||
Map.GetRandomCell = function()
|
||||
return Internal.GetRandomCell()
|
||||
end
|
||||
|
||||
Map.GetRandomEdgeCell = function()
|
||||
return Internal.GetRandomEdgeCell()
|
||||
end
|
||||
|
||||
Map.GetNamedActor = function(actorName)
|
||||
return Internal.GetNamedActor(actorName)
|
||||
end
|
||||
|
||||
CPos.New = function(x, y)
|
||||
return OpenRA.New("CPos", { { x, "Int32" }, { y, "Int32" } })
|
||||
end
|
||||
|
||||
WPos.New = function(x, y, z)
|
||||
if z == nil then
|
||||
z = 0
|
||||
end
|
||||
return OpenRA.New("WPos", { { x, "Int32" }, { y, "Int32" }, { z, "Int32" } })
|
||||
end
|
||||
|
||||
WPos.FromCPos = function(location)
|
||||
return WPos.New(location.X * 1024, location.Y * 1024, 0)
|
||||
end
|
||||
|
||||
CVec.New = function(x, y)
|
||||
return OpenRA.New("CVec", { { x, "Int32" }, { y, "Int32" } })
|
||||
end
|
||||
|
||||
WVec.New = function(x, y, z)
|
||||
if z == nil then
|
||||
z = 0
|
||||
end
|
||||
return OpenRA.New("WVec", { { x, "Int32" }, { y, "Int32" }, { z, "Int32" } })
|
||||
end
|
||||
|
||||
WRange.New = function(r)
|
||||
return OpenRA.New("WRange", { { r, "Int32" } })
|
||||
end
|
||||
|
||||
WRange.FromCells = function(cells)
|
||||
return WRange.New(cells * 1024)
|
||||
end
|
||||
@@ -23,8 +23,8 @@ Mission.MissionOver = function(winners, losers, setWinStates)
|
||||
end
|
||||
|
||||
Mission.GetGroundAttackersOf = function(player)
|
||||
return Utils.EnumerableWhere(World.Actors, function(actor)
|
||||
return not Actor.IsDead(actor) and Actor.IsInWorld(actor) and Actor.Owner(actor) == player and Actor.HasTrait(actor, "AttackBase") and Actor.HasTrait(actor, "Mobile")
|
||||
return Utils.Where(Actor.ActorsWithTrait("AttackBase"), function(actor)
|
||||
return not Actor.IsDead(actor) and Actor.IsInWorld(actor) and Actor.Owner(actor) == player and Actor.HasTrait(actor, "Mobile")
|
||||
end)
|
||||
end
|
||||
|
||||
@@ -33,10 +33,18 @@ OpenRA.GetPlayer = function(internalName)
|
||||
return Utils.EnumerableFirstOrNil(World.Players, function(p) return p.InternalName == internalName end)
|
||||
end
|
||||
|
||||
OpenRA.GetPlayers = function(func)
|
||||
return Utils.EnumerableWhere(World.Players, func)
|
||||
end
|
||||
|
||||
OpenRA.SetWinState = function(player, winState)
|
||||
Internal.SetWinState(player, winState)
|
||||
end
|
||||
|
||||
OpenRA.GetRandomInteger = function(low, high)
|
||||
return Internal.GetRandomInteger(low, high)
|
||||
end
|
||||
|
||||
OpenRA.TakeOre = function(player, amount)
|
||||
Actor.Trait(player.PlayerActor, "PlayerResources"):TakeOre(amount)
|
||||
end
|
||||
@@ -67,4 +75,4 @@ end
|
||||
|
||||
OpenRA.GetCash = function(player)
|
||||
return Actor.Trait(player.PlayerActor, "PlayerResources").Cash
|
||||
end
|
||||
end
|
||||
58
mods/common/lua/reinforcements.lua
Normal file
58
mods/common/lua/reinforcements.lua
Normal file
@@ -0,0 +1,58 @@
|
||||
Reinforcements = { }
|
||||
|
||||
Reinforcements.Insert = function(owner, transportName, passengerNames, enterPath, exitPath)
|
||||
local facing = { Map.GetFacing(CPos.op_Subtraction(enterPath[2], enterPath[1]), 0), "Int32" }
|
||||
local altitude = { Rules.InitialAltitude(transportName), "Int32" }
|
||||
local transport = Actor.Create(transportName, { Owner = owner, Location = enterPath[1], Facing = facing, Altitude = altitude })
|
||||
local cargo = Actor.Trait(transport, "Cargo")
|
||||
local passengers = { }
|
||||
|
||||
for i, passengerName in ipairs(passengerNames) do
|
||||
local passenger = Actor.Create(passengerName, { AddToWorld = false, Owner = owner })
|
||||
passengers[i] = passenger
|
||||
cargo:Load(transport, passenger)
|
||||
end
|
||||
|
||||
Utils.Do(Utils.Skip(enterPath, 1), function(l) Actor.ScriptedMove(transport, l) end)
|
||||
Actor.AfterMove(transport)
|
||||
Actor.UnloadCargo(transport, true)
|
||||
Actor.Wait(transport, 25)
|
||||
Utils.Do(exitPath, function(l) Actor.ScriptedMove(transport, l) end)
|
||||
Actor.RemoveSelf(transport)
|
||||
return transport, passengers
|
||||
end
|
||||
|
||||
Reinforcements.Extract = function(owner, transportName, passengerNames, enterPath, exitPath)
|
||||
local facing = { Map.GetFacing(CPos.op_Subtraction(enterPath[2], enterPath[1]), 0), "Int32" }
|
||||
local altitude = { Rules.InitialAltitude(transportName), "Int32" }
|
||||
local transport = Actor.Create(transportName, { Owner = owner, Location = enterPath[1], Facing = facing, Altitude = altitude })
|
||||
local cargo = Actor.Trait(transport, "Cargo")
|
||||
|
||||
Utils.Do(Utils.Skip(enterPath, 1), function(l) Actor.ScriptedMove(transport, l) end)
|
||||
Actor.AfterMove(transport)
|
||||
Actor.WaitFor(transport, function()
|
||||
return Utils.All(passengerNames, function(passenger) return cargo.Passengers:Contains(passenger) end)
|
||||
end)
|
||||
|
||||
Actor.Wait(transport, 125)
|
||||
Utils.Do(exitPath, function(l) Actor.ScriptedMove(transport, l) end)
|
||||
Actor.RemoveSelf(transport)
|
||||
return transport
|
||||
end
|
||||
|
||||
Reinforcements.Reinforce = function(owner, reinforcementNames, enterLocation, rallyPointLocation, interval, onCreateFunc)
|
||||
local facing = { Map.GetFacing(CPos.op_Subtraction(rallyPointLocation, enterLocation), 0), "Int32" }
|
||||
local reinforcements = { }
|
||||
for i, reinforcementName in ipairs(reinforcementNames) do
|
||||
local reinforcement = Actor.Create(reinforcementName, { AddToWorld = false, Owner = owner, Location = enterLocation, Facing = facing })
|
||||
reinforcements[i] = reinforcement
|
||||
OpenRA.RunAfterDelay((i - 1) * interval, function()
|
||||
World:Add(reinforcement)
|
||||
Actor.MoveNear(reinforcement, rallyPointLocation, 2)
|
||||
if onCreateFunc ~= nil then
|
||||
onCreateFunc(reinforcement)
|
||||
end
|
||||
end)
|
||||
end
|
||||
return reinforcements
|
||||
end
|
||||
21
mods/common/lua/rules.lua
Normal file
21
mods/common/lua/rules.lua
Normal file
@@ -0,0 +1,21 @@
|
||||
Rules = { }
|
||||
|
||||
Rules.HasTraitInfo = function(actorType, className)
|
||||
return Internal.HasTraitInfo(actorType, className)
|
||||
end
|
||||
|
||||
Rules.TraitInfoOrDefault = function(actorType, className)
|
||||
return Internal.TraitInfoOrDefault(actorType, className)
|
||||
end
|
||||
|
||||
Rules.TraitInfo = function(actorType, className)
|
||||
return Internal.TraitInfo(actorType, className)
|
||||
end
|
||||
|
||||
Rules.InitialAltitude = function(actorType)
|
||||
local ai = Rules.TraitInfoOrDefault(actorType, "AircraftInfo")
|
||||
if ai ~= nil then
|
||||
return ai.CruiseAltitude
|
||||
end
|
||||
return 0
|
||||
end
|
||||
@@ -1,8 +1,8 @@
|
||||
SupportPowers = { }
|
||||
|
||||
SupportPowers.Parabomb = function(owner, planeName, enterLocation, bombLocation)
|
||||
SupportPowers.Airstrike = function(owner, planeName, enterLocation, bombLocation)
|
||||
local facing = { Map.GetFacing(CPos.op_Subtraction(bombLocation, enterLocation), 0), "Int32" }
|
||||
local altitude = { Actor.TraitInfo(planeName, "AircraftInfo").CruiseAltitude, "Int32" }
|
||||
local altitude = { Rules.TraitInfo(planeName, "AircraftInfo").CruiseAltitude, "Int32" }
|
||||
local plane = Actor.Create(planeName, { Location = enterLocation, Owner = owner, Facing = facing, Altitude = altitude })
|
||||
Actor.Trait(plane, "AttackBomber"):SetTarget(bombLocation.CenterPosition)
|
||||
Actor.Fly(plane, bombLocation.CenterPosition)
|
||||
@@ -13,7 +13,7 @@ end
|
||||
|
||||
SupportPowers.Paradrop = function(owner, planeName, passengerNames, enterLocation, dropLocation)
|
||||
local facing = { Map.GetFacing(CPos.op_Subtraction(dropLocation, enterLocation), 0), "Int32" }
|
||||
local altitude = { Actor.TraitInfo(planeName, "AircraftInfo").CruiseAltitude, "Int32" }
|
||||
local altitude = { Rules.TraitInfo(planeName, "AircraftInfo").CruiseAltitude, "Int32" }
|
||||
local plane = Actor.Create(planeName, { Location = enterLocation, Owner = owner, Facing = facing, Altitude = altitude })
|
||||
Actor.FlyAttackCell(plane, dropLocation)
|
||||
Actor.Trait(plane, "ParaDrop"):SetLZ(dropLocation)
|
||||
@@ -1,6 +1,6 @@
|
||||
Team = { }
|
||||
|
||||
Team.Create = function(actors)
|
||||
Team.New = function(actors)
|
||||
local team = { }
|
||||
team.Actors = actors
|
||||
team.OnAllKilled = { }
|
||||
@@ -57,5 +57,5 @@ Team.Contains = function(team, actor)
|
||||
end
|
||||
|
||||
Team.Do = function(team, func)
|
||||
Utils.ForEach(team.Actors, func)
|
||||
Utils.Do(team.Actors, func)
|
||||
end
|
||||
@@ -56,12 +56,22 @@ Utils.Any = function(array, func)
|
||||
return false
|
||||
end
|
||||
|
||||
Utils.ForEach = function(array, func)
|
||||
Utils.Do = function(array, func)
|
||||
for i, item in ipairs(array) do
|
||||
func(item)
|
||||
end
|
||||
end
|
||||
|
||||
Utils.Skip = function(array, n)
|
||||
local ret = { }
|
||||
for i, item in ipairs(array) do
|
||||
if i > n then
|
||||
table.insert(ret, item)
|
||||
end
|
||||
end
|
||||
return ret
|
||||
end
|
||||
|
||||
Utils.TableToArray = function(luaTable)
|
||||
return Internal.TableToArray(luaTable)
|
||||
end
|
||||
@@ -145,12 +145,13 @@ Fonts:
|
||||
Size:10
|
||||
|
||||
LuaScripts:
|
||||
mods/ra/lua/utils.lua
|
||||
mods/ra/lua/openra.lua
|
||||
mods/ra/lua/map.lua
|
||||
mods/ra/lua/actor.lua
|
||||
mods/ra/lua/team.lua
|
||||
mods/ra/lua/media.lua
|
||||
mods/ra/lua/mission.lua
|
||||
mods/ra/lua/reinforcements.lua
|
||||
mods/ra/lua/supportpowers.lua
|
||||
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
|
||||
|
||||
@@ -1,9 +0,0 @@
|
||||
Map = { }
|
||||
|
||||
Map.GetFacing = function(vec, currentFacing)
|
||||
return Internal.GetFacing(vec, currentFacing)
|
||||
end
|
||||
|
||||
Map.GetWRangeFromCells = function(cells)
|
||||
return Internal.GetWRangeFromCells(cells)
|
||||
end
|
||||
@@ -1,56 +0,0 @@
|
||||
Reinforcements = { }
|
||||
|
||||
Reinforcements.PerformHelicopterInsertion = function(owner, helicopterName, passengerNames, enterPosition, unloadPosition, exitPosition)
|
||||
local facing = { Map.GetFacing(WPos.op_Subtraction(unloadPosition, enterPosition), 0), "Int32" }
|
||||
local altitude = { Actor.TraitInfo(helicopterName, "AircraftInfo").CruiseAltitude, "Int32" }
|
||||
local heli = Actor.Create(helicopterName, { Owner = owner, CenterPosition = enterPosition, Facing = facing, Altitude = altitude })
|
||||
local cargo = Actor.Trait(heli, "Cargo")
|
||||
local passengers = { }
|
||||
for i, passengerName in ipairs(passengerNames) do
|
||||
local passenger = Actor.Create(passengerName, { AddToWorld = false, Owner = owner })
|
||||
cargo:Load(heli, passenger)
|
||||
passengers[i] = passenger
|
||||
end
|
||||
Actor.HeliFly(heli, unloadPosition)
|
||||
Actor.Turn(heli, 0)
|
||||
Actor.HeliLand(heli, true)
|
||||
Actor.UnloadCargo(heli, true)
|
||||
Actor.Wait(heli, 125)
|
||||
Actor.HeliFly(heli, exitPosition)
|
||||
Actor.RemoveSelf(heli)
|
||||
return heli, passengers
|
||||
end
|
||||
|
||||
Reinforcements.PerformHelicopterExtraction = function(owner, helicopterName, passengers, enterPosition, loadPosition, exitPosition)
|
||||
local facing = { Map.GetFacing(WPos.op_Subtraction(loadPosition, enterPosition), 0), "Int32" }
|
||||
local altitude = { Actor.TraitInfo(helicopterName, "AircraftInfo").CruiseAltitude, "Int32" }
|
||||
local heli = Actor.Create(helicopterName, { Owner = owner, CenterPosition = enterPosition, Facing = facing, Altitude = altitude })
|
||||
local cargo = Actor.Trait(heli, "Cargo")
|
||||
Actor.HeliFly(heli, loadPosition)
|
||||
Actor.Turn(heli, 0)
|
||||
Actor.HeliLand(heli, true)
|
||||
Actor.WaitFor(heli, function()
|
||||
return Utils.All(passengers, function(passenger) return cargo.Passengers:Contains(passenger) end)
|
||||
end)
|
||||
Actor.Wait(heli, 125)
|
||||
Actor.HeliFly(heli, exitPosition)
|
||||
Actor.RemoveSelf(heli)
|
||||
return heli
|
||||
end
|
||||
|
||||
Reinforcements.Reinforce = function(owner, reinforcementNames, enterLocation, rallyPointLocation, interval, onCreateFunc)
|
||||
local facing = { Map.GetFacing(CPos.op_Subtraction(rallyPointLocation, enterLocation), 0), "Int32" }
|
||||
local reinforcements = { }
|
||||
for i, reinforcementName in ipairs(reinforcementNames) do
|
||||
local reinforcement = Actor.Create(reinforcementName, { AddToWorld = false, Owner = owner, Location = enterLocation, Facing = facing })
|
||||
reinforcements[i] = reinforcement
|
||||
OpenRA.RunAfterDelay((i - 1) * interval, function()
|
||||
World:Add(reinforcement)
|
||||
Actor.MoveNear(reinforcement, rallyPointLocation, 2)
|
||||
if onCreateFunc ~= nil then
|
||||
onCreateFunc(reinforcement)
|
||||
end
|
||||
end)
|
||||
end
|
||||
return reinforcements
|
||||
end
|
||||
@@ -13,8 +13,8 @@ CivilianWait = 150
|
||||
BaseAlertDelay = 300
|
||||
|
||||
SendInsertionHelicopter = function()
|
||||
local heli, passengers = Reinforcements.PerformHelicopterInsertion(player, InsertionHelicopterType, { TanyaType },
|
||||
InsertionEntry.CenterPosition, InsertionLZ.CenterPosition, InsertionEntry.CenterPosition)
|
||||
local heli, passengers = Reinforcements.Insert(player, InsertionHelicopterType, { TanyaType },
|
||||
{ InsertionEntry.Location, InsertionLZ.Location }, { InsertionEntry.Location })
|
||||
tanya = passengers[1]
|
||||
Actor.OnKilled(tanya, TanyaKilled)
|
||||
end
|
||||
@@ -59,8 +59,8 @@ LabGuardsKilled = function()
|
||||
end
|
||||
|
||||
SendExtractionHelicopter = function()
|
||||
local heli = Reinforcements.PerformHelicopterExtraction(player, ExtractionHelicopterType, { einstein },
|
||||
SouthReinforcementsPoint.CenterPosition, ExtractionLZ.CenterPosition, ExtractionExitPoint.CenterPosition)
|
||||
local heli = Reinforcements.Extract(player, ExtractionHelicopterType, { einstein },
|
||||
{ SouthReinforcementsPoint.Location, ExtractionLZ.Location }, { ExtractionExitPoint.Location })
|
||||
Actor.OnKilled(heli, HelicopterDestroyed)
|
||||
Actor.OnRemovedFromWorld(heli, HelicopterExtractionCompleted)
|
||||
end
|
||||
@@ -72,7 +72,7 @@ end
|
||||
SendCruisers = function()
|
||||
for i, cruiser in ipairs(Cruisers) do
|
||||
local ca = Actor.Create(cruiser, { Owner = england, Location = SouthReinforcementsPoint.Location })
|
||||
Actor.Move(ca, _G["CruiserPoint" .. i].Location)
|
||||
Actor.Move(ca, Map.GetNamedActor("CruiserPoint" .. i).Location)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -134,10 +134,10 @@ WorldLoaded = function()
|
||||
Actor.OnKilled(Lab, LabDestroyed)
|
||||
Actor.OnKilled(OilPump, OilPumpDestroyed)
|
||||
|
||||
labGuardsTeam = Team.Create({ LabGuard1, LabGuard2, LabGuard3 })
|
||||
labGuardsTeam = Team.New({ LabGuard1, LabGuard2, LabGuard3 })
|
||||
Team.AddEventHandler(labGuardsTeam.OnAllKilled, LabGuardsKilled)
|
||||
|
||||
civiliansTeam = Team.Create({ Civilian1, Civilian2 })
|
||||
civiliansTeam = Team.New({ Civilian1, Civilian2 })
|
||||
|
||||
RunInitialActivities()
|
||||
|
||||
|
||||
@@ -54,7 +54,7 @@ SendTrucks = function()
|
||||
Actor.Move(truck, TruckExitPoint.Location)
|
||||
Actor.RemoveSelf(truck)
|
||||
end)
|
||||
local trucksTeam = Team.Create(trucks)
|
||||
local trucksTeam = Team.New(trucks)
|
||||
Team.AddEventHandler(trucksTeam.OnAllRemovedFromWorld, MissionAccomplished)
|
||||
Team.AddEventHandler(trucksTeam.OnAnyKilled, MissionFailed)
|
||||
end)
|
||||
|
||||
@@ -165,12 +165,13 @@ Fonts:
|
||||
Size:10
|
||||
|
||||
LuaScripts:
|
||||
mods/ra/lua/utils.lua
|
||||
mods/ra/lua/openra.lua
|
||||
mods/ra/lua/map.lua
|
||||
mods/ra/lua/actor.lua
|
||||
mods/ra/lua/team.lua
|
||||
mods/ra/lua/media.lua
|
||||
mods/ra/lua/mission.lua
|
||||
mods/ra/lua/reinforcements.lua
|
||||
mods/ra/lua/supportpowers.lua
|
||||
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
|
||||
|
||||
@@ -186,12 +186,13 @@ Fonts:
|
||||
Size:10
|
||||
|
||||
LuaScripts:
|
||||
mods/ra/lua/utils.lua
|
||||
mods/ra/lua/openra.lua
|
||||
mods/ra/lua/map.lua
|
||||
mods/ra/lua/actor.lua
|
||||
mods/ra/lua/team.lua
|
||||
mods/ra/lua/media.lua
|
||||
mods/ra/lua/mission.lua
|
||||
mods/ra/lua/reinforcements.lua
|
||||
mods/ra/lua/supportpowers.lua
|
||||
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
|
||||
|
||||
@@ -29,7 +29,7 @@ markdown DOCUMENTATION.md > DOCUMENTATION.html
|
||||
FILES=('OpenRA.Game.exe' 'OpenRA.Editor.exe' 'OpenRA.Utility.exe' \
|
||||
'OpenRA.FileFormats.dll' 'OpenRA.Renderer.SdlCommon.dll' 'OpenRA.Renderer.Sdl2.dll' 'OpenRA.Renderer.Cg.dll' 'OpenRA.Renderer.Gl.dll' 'OpenRA.Renderer.Null.dll' 'OpenRA.Irc.dll' \
|
||||
'FreeSans.ttf' 'FreeSansBold.ttf' \
|
||||
'cg' 'glsl' 'mods/ra' 'mods/cnc' 'mods/d2k' \
|
||||
'cg' 'glsl' 'mods/common' 'mods/ra' 'mods/cnc' 'mods/d2k' \
|
||||
'AUTHORS' 'CHANGELOG' 'COPYING' \
|
||||
'README.html' 'CONTRIBUTING.html' 'DOCUMENTATION.html' \
|
||||
'global mix database.dat' 'GeoIP.dll' 'GeoIP.dat')
|
||||
|
||||
@@ -58,6 +58,7 @@ SectionEnd
|
||||
Section "Game" GAME
|
||||
RMDir /r "$INSTDIR\mods"
|
||||
SetOutPath "$INSTDIR\mods"
|
||||
File /r "${SRCDIR}\mods\common"
|
||||
File /r "${SRCDIR}\mods\cnc"
|
||||
File /r "${SRCDIR}\mods\d2k"
|
||||
File /r "${SRCDIR}\mods\ra"
|
||||
|
||||
BIN
thirdparty/KopiLua.dll
vendored
BIN
thirdparty/KopiLua.dll
vendored
Binary file not shown.
BIN
thirdparty/NLua.dll
vendored
BIN
thirdparty/NLua.dll
vendored
Binary file not shown.
Reference in New Issue
Block a user