Merge pull request #6836 from pchote/polish-gdi0102
Closes #6757 Closes #6834
This commit is contained in:
@@ -64,7 +64,8 @@ namespace OpenRA.Mods.Cnc
|
|||||||
var cargoPassenger = c.Trait<Passenger>();
|
var cargoPassenger = c.Trait<Passenger>();
|
||||||
if (cargoInfo.DisplayTypes.Contains(cargoPassenger.Info.CargoType))
|
if (cargoInfo.DisplayTypes.Contains(cargoPassenger.Info.CargoType))
|
||||||
{
|
{
|
||||||
var offset = pos - c.CenterPosition + body.LocalToWorld(cargoInfo.LocalOffset[i++ % cargoInfo.LocalOffset.Length].Rotate(bodyOrientation));
|
var localOffset = cargo.PassengerCount > 1 ? cargoInfo.LocalOffset[i++ % cargoInfo.LocalOffset.Length] : WVec.Zero;
|
||||||
|
var offset = pos - c.CenterPosition + body.LocalToWorld(localOffset.Rotate(bodyOrientation));
|
||||||
foreach (var cr in c.Render(wr))
|
foreach (var cr in c.Render(wr))
|
||||||
yield return cr.OffsetBy(offset).WithZOffset(1);
|
yield return cr.OffsetBy(offset).WithZOffset(1);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -45,6 +45,7 @@ namespace OpenRA.Mods.RA
|
|||||||
public IEnumerable<CPos> CurrentAdjacentCells { get; private set; }
|
public IEnumerable<CPos> CurrentAdjacentCells { get; private set; }
|
||||||
public bool Unloading { get; internal set; }
|
public bool Unloading { get; internal set; }
|
||||||
public IEnumerable<Actor> Passengers { get { return cargo; } }
|
public IEnumerable<Actor> Passengers { get { return cargo; } }
|
||||||
|
public int PassengerCount { get { return cargo.Count; } }
|
||||||
|
|
||||||
public Cargo(ActorInitializer init, CargoInfo info)
|
public Cargo(ActorInitializer init, CargoInfo info)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -39,11 +39,12 @@ namespace OpenRA.Scripting
|
|||||||
var genericType = initType.GetInterfaces()
|
var genericType = initType.GetInterfaces()
|
||||||
.First(x => x.IsGenericType && x.GetGenericTypeDefinition() == typeof(IActorInit<>));
|
.First(x => x.IsGenericType && x.GetGenericTypeDefinition() == typeof(IActorInit<>));
|
||||||
var innerType = genericType.GetGenericArguments().First();
|
var innerType = genericType.GetGenericArguments().First();
|
||||||
|
var valueType = innerType.IsEnum ? typeof(int) : innerType;
|
||||||
|
|
||||||
// Try and coerce the table value to the required type
|
// Try and coerce the table value to the required type
|
||||||
object value;
|
object value;
|
||||||
if (!kv.Value.TryGetClrValue(innerType, out value))
|
if (!kv.Value.TryGetClrValue(valueType, out value))
|
||||||
throw new LuaException("Invalid data type for '{0}' (expected '{1}')".F(typeName, innerType.Name));
|
throw new LuaException("Invalid data type for '{0}' (expected '{1}')".F(typeName, valueType.Name));
|
||||||
|
|
||||||
// Construct the ActorInit. Phew!
|
// Construct the ActorInit. Phew!
|
||||||
var test = initType.GetConstructor(new[] { innerType }).Invoke(new[] { value });
|
var test = initType.GetConstructor(new[] { innerType }).Invoke(new[] { value });
|
||||||
|
|||||||
@@ -117,7 +117,7 @@ namespace OpenRA.Mods.RA.Scripting
|
|||||||
{
|
{
|
||||||
foreach (var cargoType in cargoTypes)
|
foreach (var cargoType in cargoTypes)
|
||||||
{
|
{
|
||||||
var passenger = CreateActor(owner, cargoType, false);
|
var passenger = CreateActor(owner, cargoType, false, entryPath[0]);
|
||||||
passengers.Add(passenger);
|
passengers.Add(passenger);
|
||||||
cargo.Load(transport, passenger);
|
cargo.Load(transport, passenger);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,8 +17,13 @@ namespace OpenRA.Mods.RA.Scripting
|
|||||||
[ScriptPropertyGroup("Movement")]
|
[ScriptPropertyGroup("Movement")]
|
||||||
public class MobileProperties : ScriptActorProperties, Requires<MobileInfo>
|
public class MobileProperties : ScriptActorProperties, Requires<MobileInfo>
|
||||||
{
|
{
|
||||||
|
readonly Mobile mobile;
|
||||||
|
|
||||||
public MobileProperties(ScriptContext context, Actor self)
|
public MobileProperties(ScriptContext context, Actor self)
|
||||||
: base(context, self) { }
|
: base(context, self)
|
||||||
|
{
|
||||||
|
mobile = self.Trait<Mobile>();
|
||||||
|
}
|
||||||
|
|
||||||
[ScriptActorPropertyActivity]
|
[ScriptActorPropertyActivity]
|
||||||
[Desc("Moves within the cell grid. closeEnough defines an optional range " +
|
[Desc("Moves within the cell grid. closeEnough defines an optional range " +
|
||||||
@@ -35,6 +40,13 @@ namespace OpenRA.Mods.RA.Scripting
|
|||||||
self.QueueActivity(new Move.Move(self, cell));
|
self.QueueActivity(new Move.Move(self, cell));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[ScriptActorPropertyActivity]
|
||||||
|
[Desc("Moves from outside the world into the cell grid")]
|
||||||
|
public void MoveIntoWorld(CPos cell)
|
||||||
|
{
|
||||||
|
self.QueueActivity(mobile.MoveIntoWorld(self, cell, mobile.toSubCell));
|
||||||
|
}
|
||||||
|
|
||||||
[ScriptActorPropertyActivity]
|
[ScriptActorPropertyActivity]
|
||||||
[Desc("Leave the current position in a random direction.")]
|
[Desc("Leave the current position in a random direction.")]
|
||||||
public void Scatter()
|
public void Scatter()
|
||||||
|
|||||||
@@ -33,6 +33,9 @@ namespace OpenRA.Mods.RA.Scripting
|
|||||||
[Desc("Teleport an existing actor inside this transport.")]
|
[Desc("Teleport an existing actor inside this transport.")]
|
||||||
public void LoadPassenger(Actor a) { cargo.Load(self, a); }
|
public void LoadPassenger(Actor a) { cargo.Load(self, a); }
|
||||||
|
|
||||||
|
[Desc("Remove the first actor from the transport. This actor is not added to the world.")]
|
||||||
|
public Actor UnloadPassenger() { return cargo.Unload(self); }
|
||||||
|
|
||||||
[ScriptActorPropertyActivity]
|
[ScriptActorPropertyActivity]
|
||||||
[Desc("Command transport to unload passengers.")]
|
[Desc("Command transport to unload passengers.")]
|
||||||
public void UnloadPassengers()
|
public void UnloadPassengers()
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
MCVReinforcements = { "mcv" }
|
||||||
InfantryReinforcements = { "e1", "e1", "e1" }
|
InfantryReinforcements = { "e1", "e1", "e1" }
|
||||||
VehicleReinforcements = { "jeep" }
|
VehicleReinforcements = { "jeep" }
|
||||||
NodPatrol = { "e1", "e1" }
|
NodPatrol = { "e1", "e1" }
|
||||||
@@ -15,9 +16,36 @@ SetGunboatPath = function(gunboat)
|
|||||||
gunboat.AttackMove(gunboatRight.Location)
|
gunboat.AttackMove(gunboatRight.Location)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
ReinforceWithLandingCraft = function(units, transportStart, transportUnload, rallypoint)
|
||||||
|
local transport = Actor.Create("oldlst", true, { Owner = player, Facing = 0, Location = transportStart })
|
||||||
|
local subcell = 0
|
||||||
|
Utils.Do(units, function(a)
|
||||||
|
transport.LoadPassenger(Actor.Create(a, false, { Owner = transport.Owner, Facing = transport.Facing, Location = transportUnload, SubCell = subcell }))
|
||||||
|
subcell = subcell + 1
|
||||||
|
end)
|
||||||
|
|
||||||
|
transport.ScriptedMove(transportUnload)
|
||||||
|
|
||||||
|
transport.CallFunc(function()
|
||||||
|
Utils.Do(units, function()
|
||||||
|
local a = transport.UnloadPassenger()
|
||||||
|
a.IsInWorld = true
|
||||||
|
a.MoveIntoWorld(transport.Location - CVec.New(0, 1))
|
||||||
|
|
||||||
|
if rallypoint ~= nil then
|
||||||
|
a.Move(rallypoint)
|
||||||
|
end
|
||||||
|
end)
|
||||||
|
end)
|
||||||
|
|
||||||
|
transport.Wait(5)
|
||||||
|
transport.ScriptedMove(transportStart)
|
||||||
|
transport.Destroy()
|
||||||
|
end
|
||||||
|
|
||||||
Reinforce = function(units)
|
Reinforce = function(units)
|
||||||
Media.PlaySpeechNotification(player, "Reinforce")
|
Media.PlaySpeechNotification(player, "Reinforce")
|
||||||
Reinforcements.ReinforceWithTransport(player, "oldlst", units, { lstStart.Location, lstEnd.Location }, { lstStart.Location })
|
ReinforceWithLandingCraft(units, lstStart.Location, lstEnd.Location, reinforcementsTarget.Location)
|
||||||
end
|
end
|
||||||
|
|
||||||
triggerAdded = false
|
triggerAdded = false
|
||||||
@@ -39,7 +67,6 @@ CheckForBase = function()
|
|||||||
end
|
end
|
||||||
|
|
||||||
WorldLoaded = function()
|
WorldLoaded = function()
|
||||||
Media.PlayMovieFullscreen("landing.vqa")
|
|
||||||
|
|
||||||
player = Player.GetPlayer("GDI")
|
player = Player.GetPlayer("GDI")
|
||||||
enemy = Player.GetPlayer("Nod")
|
enemy = Player.GetPlayer("Nod")
|
||||||
@@ -68,17 +95,20 @@ WorldLoaded = function()
|
|||||||
end)
|
end)
|
||||||
end)
|
end)
|
||||||
|
|
||||||
nodObjective = enemy.AddPrimaryObjective("Destroy all GDI troops")
|
Media.PlayMovieFullscreen("landing.vqa", function()
|
||||||
gdiObjective1 = player.AddPrimaryObjective("Eliminate all Nod forces in the area")
|
nodObjective = enemy.AddPrimaryObjective("Destroy all GDI troops")
|
||||||
gdiObjective2 = player.AddSecondaryObjective("Establish a beachhead")
|
gdiObjective1 = player.AddPrimaryObjective("Eliminate all Nod forces in the area")
|
||||||
|
gdiObjective2 = player.AddSecondaryObjective("Establish a beachhead")
|
||||||
|
|
||||||
|
ReinforceWithLandingCraft(MCVReinforcements, lstStart.Location + CVec.New(2, 0), lstEnd.Location + CVec.New(2, 0), mcvTarget.Location)
|
||||||
|
Reinforce(InfantryReinforcements)
|
||||||
|
end)
|
||||||
|
|
||||||
Trigger.OnIdle(Gunboat, function() SetGunboatPath(Gunboat) end)
|
Trigger.OnIdle(Gunboat, function() SetGunboatPath(Gunboat) end)
|
||||||
|
|
||||||
SendNodPatrol()
|
SendNodPatrol()
|
||||||
|
|
||||||
Trigger.AfterDelay(DateTime.Seconds(5), function() Reinforce(InfantryReinforcements) end)
|
Trigger.AfterDelay(DateTime.Seconds(10), 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)
|
Trigger.AfterDelay(DateTime.Seconds(60), function() Reinforce(VehicleReinforcements) end)
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -90,7 +120,7 @@ Tick = function()
|
|||||||
player.MarkCompletedObjective(gdiObjective1)
|
player.MarkCompletedObjective(gdiObjective1)
|
||||||
end
|
end
|
||||||
|
|
||||||
if player.HasNoRequiredUnits() then
|
if tick > DateTime.Seconds(5) and player.HasNoRequiredUnits() then
|
||||||
enemy.MarkCompletedObjective(nodObjective)
|
enemy.MarkCompletedObjective(nodObjective)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -327,40 +327,11 @@ Actors:
|
|||||||
Owner: Nod
|
Owner: Nod
|
||||||
Health: 0.1875
|
Health: 0.1875
|
||||||
Facing: 160
|
Facing: 160
|
||||||
mcv: mcv
|
|
||||||
Location: 56,53
|
|
||||||
Owner: GDI
|
|
||||||
Health: 1
|
|
||||||
Facing: 0
|
|
||||||
Gunboat: boat
|
Gunboat: boat
|
||||||
Location: 53,59
|
Location: 51,59
|
||||||
Owner: GDI
|
Owner: GDI
|
||||||
Health: 1
|
Health: 1
|
||||||
Facing: 64
|
Facing: 64
|
||||||
Actor88: e1
|
|
||||||
Location: 56,55
|
|
||||||
Owner: GDI
|
|
||||||
Health: 1
|
|
||||||
Facing: 0
|
|
||||||
SubCell: 2
|
|
||||||
Actor89: e1
|
|
||||||
Location: 56,55
|
|
||||||
Owner: GDI
|
|
||||||
Health: 1
|
|
||||||
Facing: 0
|
|
||||||
SubCell: 4
|
|
||||||
Actor90: e1
|
|
||||||
Location: 56,55
|
|
||||||
Owner: GDI
|
|
||||||
Health: 1
|
|
||||||
Facing: 0
|
|
||||||
SubCell: 3
|
|
||||||
Actor91: e1
|
|
||||||
Location: 56,55
|
|
||||||
Owner: GDI
|
|
||||||
Health: 1
|
|
||||||
Facing: 0
|
|
||||||
SubCell: 1
|
|
||||||
Actor92: e1
|
Actor92: e1
|
||||||
Location: 57,45
|
Location: 57,45
|
||||||
Owner: Nod
|
Owner: Nod
|
||||||
@@ -448,6 +419,12 @@ Actors:
|
|||||||
lstEnd: waypoint
|
lstEnd: waypoint
|
||||||
Location: 54,57
|
Location: 54,57
|
||||||
Owner: Neutral
|
Owner: Neutral
|
||||||
|
mcvTarget: waypoint
|
||||||
|
Location: 56,53
|
||||||
|
Owner: Neutral
|
||||||
|
reinforcementsTarget: waypoint
|
||||||
|
Location: 54,53
|
||||||
|
Owner: Neutral
|
||||||
|
|
||||||
Smudges:
|
Smudges:
|
||||||
|
|
||||||
@@ -545,6 +522,9 @@ Rules:
|
|||||||
ATWR:
|
ATWR:
|
||||||
Buildable:
|
Buildable:
|
||||||
Prerequisites: ~disabled
|
Prerequisites: ~disabled
|
||||||
|
BRIK:
|
||||||
|
Buildable:
|
||||||
|
Prerequisites: ~disabled
|
||||||
E2:
|
E2:
|
||||||
Buildable:
|
Buildable:
|
||||||
Prerequisites: ~disabled
|
Prerequisites: ~disabled
|
||||||
@@ -575,9 +555,7 @@ Sequences:
|
|||||||
idle: lst
|
idle: lst
|
||||||
Start: 0
|
Start: 0
|
||||||
Facings: 1
|
Facings: 1
|
||||||
unload: lst
|
ZOffset: -1024
|
||||||
Start: 0
|
|
||||||
Facings: 1
|
|
||||||
|
|
||||||
VoxelSequences:
|
VoxelSequences:
|
||||||
|
|
||||||
|
|||||||
@@ -5,9 +5,36 @@ VehicleReinforcements = { "jeep" }
|
|||||||
|
|
||||||
AttackerSquadSize = 3
|
AttackerSquadSize = 3
|
||||||
|
|
||||||
Reinforce = function(passengers)
|
ReinforceWithLandingCraft = function(units, transportStart, transportUnload, rallypoint)
|
||||||
Reinforcements.ReinforceWithTransport(player, "oldlst", passengers, { lstStart.Location, lstEnd.Location }, { lstStart.Location })
|
local transport = Actor.Create("oldlst", true, { Owner = player, Facing = 0, Location = transportStart })
|
||||||
|
local subcell = 0
|
||||||
|
Utils.Do(units, function(a)
|
||||||
|
transport.LoadPassenger(Actor.Create(a, false, { Owner = transport.Owner, Facing = transport.Facing, Location = transportUnload, SubCell = subcell }))
|
||||||
|
subcell = subcell + 1
|
||||||
|
end)
|
||||||
|
|
||||||
|
transport.ScriptedMove(transportUnload)
|
||||||
|
|
||||||
|
transport.CallFunc(function()
|
||||||
|
Utils.Do(units, function()
|
||||||
|
local a = transport.UnloadPassenger()
|
||||||
|
a.IsInWorld = true
|
||||||
|
a.MoveIntoWorld(transport.Location - CVec.New(0, 1))
|
||||||
|
|
||||||
|
if rallypoint ~= nil then
|
||||||
|
a.Move(rallypoint)
|
||||||
|
end
|
||||||
|
end)
|
||||||
|
end)
|
||||||
|
|
||||||
|
transport.Wait(5)
|
||||||
|
transport.ScriptedMove(transportStart)
|
||||||
|
transport.Destroy()
|
||||||
|
end
|
||||||
|
|
||||||
|
Reinforce = function(units)
|
||||||
Media.PlaySpeechNotification(player, "Reinforce")
|
Media.PlaySpeechNotification(player, "Reinforce")
|
||||||
|
ReinforceWithLandingCraft(units, lstStart.Location, lstEnd.Location)
|
||||||
end
|
end
|
||||||
|
|
||||||
BridgeheadSecured = function()
|
BridgeheadSecured = function()
|
||||||
@@ -61,6 +88,15 @@ WorldLoaded = function()
|
|||||||
gdiObjective1 = player.AddPrimaryObjective("Eliminate all Nod forces in the area")
|
gdiObjective1 = player.AddPrimaryObjective("Eliminate all Nod forces in the area")
|
||||||
gdiObjective2 = player.AddSecondaryObjective("Capture the Tiberium Refinery")
|
gdiObjective2 = player.AddSecondaryObjective("Capture the Tiberium Refinery")
|
||||||
|
|
||||||
|
-- Work around limitations with the yaml merger that prevent MustBeDestroyed from working on the silos
|
||||||
|
siloARemoved = false
|
||||||
|
Trigger.OnCapture(SiloA, function() siloARemoved = true end)
|
||||||
|
Trigger.OnKilled(SiloA, function() siloARemoved = true end)
|
||||||
|
|
||||||
|
siloBRemoved = false
|
||||||
|
Trigger.OnCapture(SiloB, function() siloBRemoved = true end)
|
||||||
|
Trigger.OnKilled(SiloB, function() siloBRemoved = true end)
|
||||||
|
|
||||||
Trigger.OnCapture(NodRefinery, function() player.MarkCompletedObjective(gdiObjective2) end)
|
Trigger.OnCapture(NodRefinery, function() player.MarkCompletedObjective(gdiObjective2) end)
|
||||||
Trigger.OnKilled(NodRefinery, function() player.MarkFailedObjective(gdiObjective2) end)
|
Trigger.OnKilled(NodRefinery, function() player.MarkFailedObjective(gdiObjective2) end)
|
||||||
|
|
||||||
@@ -71,7 +107,7 @@ Tick = function()
|
|||||||
if player.HasNoRequiredUnits() then
|
if player.HasNoRequiredUnits() then
|
||||||
enemy.MarkCompletedObjective(nodObjective)
|
enemy.MarkCompletedObjective(nodObjective)
|
||||||
end
|
end
|
||||||
if enemy.HasNoRequiredUnits() then
|
if enemy.HasNoRequiredUnits() and siloARemoved and siloBRemoved then
|
||||||
player.MarkCompletedObjective(gdiObjective1)
|
player.MarkCompletedObjective(gdiObjective1)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -302,12 +302,12 @@ Actors:
|
|||||||
Owner: GDI
|
Owner: GDI
|
||||||
Health: 0.34375
|
Health: 0.34375
|
||||||
Facing: 0
|
Facing: 0
|
||||||
Actor79: silo
|
SiloA: silo
|
||||||
Location: 57,32
|
Location: 57,32
|
||||||
Owner: Nod
|
Owner: Nod
|
||||||
Health: 1
|
Health: 1
|
||||||
Facing: 0
|
Facing: 0
|
||||||
Actor80: silo
|
SiloB: silo
|
||||||
Location: 59,32
|
Location: 59,32
|
||||||
Owner: Nod
|
Owner: Nod
|
||||||
Health: 1
|
Health: 1
|
||||||
@@ -800,6 +800,7 @@ Rules:
|
|||||||
Buildable:
|
Buildable:
|
||||||
Prerequisites: ~disabled
|
Prerequisites: ~disabled
|
||||||
SILO:
|
SILO:
|
||||||
|
MustBeDestroyed:
|
||||||
Buildable:
|
Buildable:
|
||||||
Prerequisites: ~disabled
|
Prerequisites: ~disabled
|
||||||
WEAP:
|
WEAP:
|
||||||
@@ -873,9 +874,7 @@ Sequences:
|
|||||||
idle: lst
|
idle: lst
|
||||||
Start: 0
|
Start: 0
|
||||||
Facings: 1
|
Facings: 1
|
||||||
unload: lst
|
ZOffset: -1024
|
||||||
Start: 0
|
|
||||||
Facings: 1
|
|
||||||
|
|
||||||
VoxelSequences:
|
VoxelSequences:
|
||||||
|
|
||||||
|
|||||||
@@ -64,7 +64,7 @@ LST:
|
|||||||
WithRoof:
|
WithRoof:
|
||||||
WithCargo:
|
WithCargo:
|
||||||
DisplayTypes: Infantry, Vehicle
|
DisplayTypes: Infantry, Vehicle
|
||||||
LocalOffset: 0,0,0, -390,-256,0, 390,-256,0, -390,256,0, 390,256,0
|
LocalOffset: 390,-256,0, 390,256,0, 0,0,0, -390,-256,0, -390,256,0
|
||||||
Cargo:
|
Cargo:
|
||||||
Types: Infantry, Vehicle
|
Types: Infantry, Vehicle
|
||||||
MaxWeight: 5
|
MaxWeight: 5
|
||||||
|
|||||||
Reference in New Issue
Block a user