Modify Cargo trait to support initial passengers
This commit is contained in:
committed by
Chris Forbes
parent
22d3709967
commit
fdef80c53a
@@ -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<CargoInit,Actor[]>().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<IOrderTargeter> Orders
|
||||
|
||||
Reference in New Issue
Block a user