Fix landing craft reinforcements in GDI01 and GDI02.
This commit is contained in:
@@ -64,7 +64,8 @@ namespace OpenRA.Mods.Cnc
|
||||
var cargoPassenger = c.Trait<Passenger>();
|
||||
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))
|
||||
yield return cr.OffsetBy(offset).WithZOffset(1);
|
||||
}
|
||||
|
||||
@@ -45,6 +45,7 @@ namespace OpenRA.Mods.RA
|
||||
public IEnumerable<CPos> CurrentAdjacentCells { get; private set; }
|
||||
public bool Unloading { get; internal set; }
|
||||
public IEnumerable<Actor> Passengers { get { return cargo; } }
|
||||
public int PassengerCount { get { return cargo.Count; } }
|
||||
|
||||
public Cargo(ActorInitializer init, CargoInfo info)
|
||||
{
|
||||
|
||||
@@ -17,8 +17,13 @@ namespace OpenRA.Mods.RA.Scripting
|
||||
[ScriptPropertyGroup("Movement")]
|
||||
public class MobileProperties : ScriptActorProperties, Requires<MobileInfo>
|
||||
{
|
||||
readonly Mobile mobile;
|
||||
|
||||
public MobileProperties(ScriptContext context, Actor self)
|
||||
: base(context, self) { }
|
||||
: base(context, self)
|
||||
{
|
||||
mobile = self.Trait<Mobile>();
|
||||
}
|
||||
|
||||
[ScriptActorPropertyActivity]
|
||||
[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));
|
||||
}
|
||||
|
||||
[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]
|
||||
[Desc("Leave the current position in a random direction.")]
|
||||
public void Scatter()
|
||||
|
||||
@@ -33,6 +33,9 @@ namespace OpenRA.Mods.RA.Scripting
|
||||
[Desc("Teleport an existing actor inside this transport.")]
|
||||
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]
|
||||
[Desc("Command transport to unload passengers.")]
|
||||
public void UnloadPassengers()
|
||||
|
||||
@@ -15,9 +15,36 @@ SetGunboatPath = function(gunboat)
|
||||
gunboat.AttackMove(gunboatRight.Location)
|
||||
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)
|
||||
Media.PlaySpeechNotification(player, "Reinforce")
|
||||
Reinforcements.ReinforceWithTransport(player, "oldlst", units, { lstStart.Location, lstEnd.Location }, { lstStart.Location })
|
||||
ReinforceWithLandingCraft(units, lstStart.Location, lstEnd.Location)
|
||||
end
|
||||
|
||||
triggerAdded = false
|
||||
|
||||
@@ -5,9 +5,36 @@ VehicleReinforcements = { "jeep" }
|
||||
|
||||
AttackerSquadSize = 3
|
||||
|
||||
Reinforce = function(passengers)
|
||||
Reinforcements.ReinforceWithTransport(player, "oldlst", passengers, { lstStart.Location, lstEnd.Location }, { lstStart.Location })
|
||||
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)
|
||||
Media.PlaySpeechNotification(player, "Reinforce")
|
||||
ReinforceWithLandingCraft(units, lstStart.Location, lstEnd.Location)
|
||||
end
|
||||
|
||||
BridgeheadSecured = function()
|
||||
|
||||
@@ -64,7 +64,7 @@ LST:
|
||||
WithRoof:
|
||||
WithCargo:
|
||||
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:
|
||||
Types: Infantry, Vehicle
|
||||
MaxWeight: 5
|
||||
|
||||
Reference in New Issue
Block a user