Add new trait interface INotifyTransformed and use it in Allies 04 to make the transport remove its cargo capacity after it unloads its passengers
This commit is contained in:
@@ -68,6 +68,9 @@ namespace OpenRA.Mods.RA.Activities
|
||||
|
||||
var a = w.CreateActor( ToActor, init );
|
||||
|
||||
foreach (var nt in self.TraitsImplementing<INotifyTransformed>())
|
||||
nt.OnTransformed(a);
|
||||
|
||||
if (selected)
|
||||
w.Selection.Add(w, a);
|
||||
});
|
||||
|
||||
@@ -278,10 +278,14 @@ namespace OpenRA.Mods.RA.Missions
|
||||
allies2.PlayerActor.Trait<PlayerResources>().GiveCash(2500);
|
||||
}));
|
||||
|
||||
lst.AddTrait(new Allies04TransformedAction(self =>
|
||||
{
|
||||
self.QueueActivity(new Wait(10));
|
||||
self.QueueActivity(new Move.Move(reinforcementsEntryPoint.Location));
|
||||
self.QueueActivity(new RemoveSelf());
|
||||
}));
|
||||
lst.QueueActivity(new UnloadCargo(true));
|
||||
lst.QueueActivity(new Wait(10));
|
||||
lst.QueueActivity(new Move.Move(reinforcementsEntryPoint.Location));
|
||||
lst.QueueActivity(new RemoveSelf());
|
||||
lst.QueueActivity(new Transform(lst, "lst.unselectable.nocargo"));
|
||||
}
|
||||
|
||||
class Patrol
|
||||
@@ -329,12 +333,16 @@ namespace OpenRA.Mods.RA.Missions
|
||||
lst.Trait<Cargo>().Load(lst, allies2Spy);
|
||||
}
|
||||
|
||||
lst.AddTrait(new Allies04TransformedAction(self =>
|
||||
{
|
||||
self.QueueActivity(new Wait(10));
|
||||
self.QueueActivity(new Move.Move(spyReinforcementsExitPoint.Location));
|
||||
self.QueueActivity(new RemoveSelf());
|
||||
}));
|
||||
lst.QueueActivity(new Move.Move(spyReinforcementsUnloadPoint.Location));
|
||||
lst.QueueActivity(new Wait(10));
|
||||
lst.QueueActivity(new UnloadCargo(true));
|
||||
lst.QueueActivity(new Wait(10));
|
||||
lst.QueueActivity(new Move.Move(spyReinforcementsExitPoint.Location));
|
||||
lst.QueueActivity(new RemoveSelf());
|
||||
lst.QueueActivity(new Transform(lst, "lst.unselectable.nocargo"));
|
||||
}
|
||||
|
||||
void SetupSubStances()
|
||||
@@ -412,7 +420,7 @@ namespace OpenRA.Mods.RA.Missions
|
||||
patrols = new List<Patrol>
|
||||
{
|
||||
new Patrol(world, new[] { "e1", "e1", "e1", "e1", "e1" }, soviets, patrolPoints1, 0),
|
||||
new Patrol(world, new[] { "e1", "dog.patrol", "dog.patrol" }, soviets, patrolPoints2, 4),
|
||||
new Patrol(world, new[] { "e1", "dog.patrol", "dog.patrol" }, soviets, patrolPoints2, 2),
|
||||
new Patrol(world, new[] { "e1", "dog.patrol", "dog.patrol" }, soviets, patrolPoints4, 0),
|
||||
new Patrol(world, new[] { "e1", "dog.patrol", "dog.patrol" }, soviets, patrolPoints5, 0),
|
||||
};
|
||||
@@ -553,4 +561,19 @@ namespace OpenRA.Mods.RA.Missions
|
||||
}
|
||||
|
||||
class Allies04TransformOnLabInfiltrate { }
|
||||
|
||||
class Allies04TransformedAction : INotifyTransformed
|
||||
{
|
||||
Action<Actor> a;
|
||||
|
||||
public Allies04TransformedAction(Action<Actor> a)
|
||||
{
|
||||
this.a = a;
|
||||
}
|
||||
|
||||
public void OnTransformed(Actor toActor)
|
||||
{
|
||||
a(toActor);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -45,4 +45,5 @@ namespace OpenRA.Mods.RA
|
||||
|
||||
public interface INotifyParachuteLanded { void OnLanded(); }
|
||||
public interface INotifyTransform { void OnTransform(Actor self); }
|
||||
public interface INotifyTransformed { void OnTransformed(Actor toActor); }
|
||||
}
|
||||
|
||||
@@ -1089,9 +1089,6 @@ Actors:
|
||||
Actor349: v14
|
||||
Location: 66,83
|
||||
Owner: Neutral
|
||||
Actor350: v12
|
||||
Location: 64,82
|
||||
Owner: Neutral
|
||||
Actor351: t11
|
||||
Location: 62,100
|
||||
Owner: Neutral
|
||||
@@ -1848,31 +1845,17 @@ Rules:
|
||||
Allies04TransformOnLabInfiltrate:
|
||||
ToActor: SPEN
|
||||
LST.Unselectable:
|
||||
Inherits: ^Ship
|
||||
Valued:
|
||||
Cost: 700
|
||||
Tooltip:
|
||||
Name: Transport
|
||||
Health:
|
||||
HP: 350
|
||||
Armor:
|
||||
Type: Heavy
|
||||
Mobile:
|
||||
ROT: 10
|
||||
Speed: 8
|
||||
RevealsShroud:
|
||||
Range: 6
|
||||
Inherits: LST
|
||||
RenderUnit:
|
||||
Image: LST
|
||||
Cargo:
|
||||
Types: Infantry, Vehicle
|
||||
MaxWeight: 5
|
||||
PipCount: 5
|
||||
IronCurtainable:
|
||||
RepairableNear:
|
||||
AttackMove:
|
||||
JustMove: true
|
||||
Tooltip:
|
||||
Icon: lsticon
|
||||
-Selectable:
|
||||
LST.Unselectable.NoCargo:
|
||||
Inherits: LST.Unselectable
|
||||
Cargo:
|
||||
MaxWeight: 0
|
||||
PipCount: 0
|
||||
SPY.Strong:
|
||||
Inherits: ^Infantry
|
||||
RevealsShroud:
|
||||
|
||||
Reference in New Issue
Block a user