From aff3111eacb23aa1dcdb00dc27598d9bae636e2c Mon Sep 17 00:00:00 2001 From: Chris Forbes Date: Tue, 2 Aug 2011 11:09:13 +1200 Subject: [PATCH] internals for #919 --- OpenRA.Mods.RA/Crates/GiveUnitCrateAction.cs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/OpenRA.Mods.RA/Crates/GiveUnitCrateAction.cs b/OpenRA.Mods.RA/Crates/GiveUnitCrateAction.cs index ed574a98dd..817bdfc03b 100644 --- a/OpenRA.Mods.RA/Crates/GiveUnitCrateAction.cs +++ b/OpenRA.Mods.RA/Crates/GiveUnitCrateAction.cs @@ -20,6 +20,7 @@ namespace OpenRA.Mods.RA.Crates { [ActorReference] public readonly string Unit = null; + public readonly string Owner = null; 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 // 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. if (!GetSuitableCells(collector.Location).Any()) return 0; @@ -52,7 +53,7 @@ namespace OpenRA.Mods.RA.Crates w => w.CreateActor(Info.Unit, new TypeDictionary { new LocationInit( location.Value ), - new OwnerInit( collector.Owner ) + new OwnerInit( Info.Owner ?? collector.Owner.InternalName ) })); base.Activate(collector);