From fdef80c53ac13e59e1c8c97475bd04dc685e61f6 Mon Sep 17 00:00:00 2001 From: Curtis Shmyr Date: Tue, 6 Mar 2012 19:58:36 -0700 Subject: [PATCH] Modify Cargo trait to support initial passengers --- OpenRA.Mods.RA/Cargo.cs | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/OpenRA.Mods.RA/Cargo.cs b/OpenRA.Mods.RA/Cargo.cs index 338164558e..64269e2cda 100644 --- a/OpenRA.Mods.RA/Cargo.cs +++ b/OpenRA.Mods.RA/Cargo.cs @@ -23,6 +23,7 @@ namespace OpenRA.Mods.RA public readonly int PipCount = 0; public readonly string[] Types = { }; public readonly int UnloadFacing = 0; + public readonly string[] InitialUnits = { }; public object Create( ActorInitializer init ) { return new Cargo( init, this ); } } @@ -46,6 +47,17 @@ namespace OpenRA.Mods.RA cargo = init.Get().ToList(); totalWeight = cargo.Sum( c => GetWeight(c) ); } + else + { + foreach (var u in info.InitialUnits) + { + var unit = self.World.CreateActor(false, u.ToLowerInvariant(), + new TypeDictionary { new OwnerInit(self.Owner) }); + + if (CanLoad(self, unit)) + Load(self,unit); + } + } } public IEnumerable Orders