internals for #919

This commit is contained in:
Chris Forbes
2011-08-02 11:09:13 +12:00
parent b6560e6026
commit aff3111eac

View File

@@ -20,6 +20,7 @@ namespace OpenRA.Mods.RA.Crates
{ {
[ActorReference] [ActorReference]
public readonly string Unit = null; public readonly string Unit = null;
public readonly string Owner = null;
public override object Create(ActorInitializer init) { return new GiveUnitCrateAction(init.self, this); } public override object Create(ActorInitializer init) { return new GiveUnitCrateAction(init.self, this); }
} }
@@ -36,7 +37,7 @@ namespace OpenRA.Mods.RA.Crates
// this unit is not buildable by the collector's country, so // this unit is not buildable by the collector's country, so
// don't give them free ones either. // don't give them free ones either.
if (bi != null && !bi.Owner.Contains(collector.Owner.Country.Race)) return 0; if (Info.Owner == null && bi != null && !bi.Owner.Contains(collector.Owner.Country.Race)) return 0;
// avoid dumping tanks in the sea, and ships on dry land. // avoid dumping tanks in the sea, and ships on dry land.
if (!GetSuitableCells(collector.Location).Any()) return 0; if (!GetSuitableCells(collector.Location).Any()) return 0;
@@ -52,7 +53,7 @@ namespace OpenRA.Mods.RA.Crates
w => w.CreateActor(Info.Unit, new TypeDictionary w => w.CreateActor(Info.Unit, new TypeDictionary
{ {
new LocationInit( location.Value ), new LocationInit( location.Value ),
new OwnerInit( collector.Owner ) new OwnerInit( Info.Owner ?? collector.Owner.InternalName )
})); }));
base.Activate(collector); base.Activate(collector);