Modify Cargo trait to support initial passengers

This commit is contained in:
Curtis Shmyr
2012-03-06 19:58:36 -07:00
committed by Chris Forbes
parent 22d3709967
commit fdef80c53a

View File

@@ -23,6 +23,7 @@ namespace OpenRA.Mods.RA
public readonly int PipCount = 0; public readonly int PipCount = 0;
public readonly string[] Types = { }; public readonly string[] Types = { };
public readonly int UnloadFacing = 0; public readonly int UnloadFacing = 0;
public readonly string[] InitialUnits = { };
public object Create( ActorInitializer init ) { return new Cargo( init, this ); } public object Create( ActorInitializer init ) { return new Cargo( init, this ); }
} }
@@ -46,6 +47,17 @@ namespace OpenRA.Mods.RA
cargo = init.Get<CargoInit,Actor[]>().ToList(); cargo = init.Get<CargoInit,Actor[]>().ToList();
totalWeight = cargo.Sum( c => GetWeight(c) ); 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<IOrderTargeter> Orders public IEnumerable<IOrderTargeter> Orders