diff --git a/OpenRA.Mods.RA/Crates/GiveUnitCrateAction.cs b/OpenRA.Mods.RA/Crates/GiveUnitCrateAction.cs index 23bdda30a9..53b1274b04 100644 --- a/OpenRA.Mods.RA/Crates/GiveUnitCrateAction.cs +++ b/OpenRA.Mods.RA/Crates/GiveUnitCrateAction.cs @@ -19,9 +19,15 @@ namespace OpenRA.Mods.RA.Crates class GiveUnitCrateActionInfo : CrateActionInfo { [ActorReference] + [Desc("Unit to give")] public readonly string Unit = null; + + [Desc("Override the owner of the newly spawned unit: e.g Creeps or Neutral")] public readonly string Owner = null; + [Desc("Races that are allowed to trigger this action")] + public readonly string[] Race = null; + public override object Create(ActorInitializer init) { return new GiveUnitCrateAction(init.self, this); } } @@ -34,14 +40,12 @@ namespace OpenRA.Mods.RA.Crates public bool CanGiveTo(Actor collector) { - var bi = self.World.Map.Rules.Actors[Info.Unit].Traits.GetOrDefault(); - - // this unit is not buildable by the collector's country, so - // don't give them free ones either. - if (Info.Owner == null && bi != null && !bi.Owner.Contains(collector.Owner.Country.Race)) return false; + if (Info.Race != null && !Info.Race.Contains(collector.Owner.Country.Race)) + return false; // avoid dumping tanks in the sea, and ships on dry land. - if (!GetSuitableCells(collector.Location).Any()) return false; + if (!GetSuitableCells(collector.Location).Any()) + return false; return true; } diff --git a/mods/ra/maps/drop-zone-battle-of-tikiaki/map.yaml b/mods/ra/maps/drop-zone-battle-of-tikiaki/map.yaml index e7f981b318..bb3e1e50b8 100644 --- a/mods/ra/maps/drop-zone-battle-of-tikiaki/map.yaml +++ b/mods/ra/maps/drop-zone-battle-of-tikiaki/map.yaml @@ -321,6 +321,15 @@ Rules: GiveUnitCrateAction@dog: SelectionShares: 1 Unit: dog + ^Infantry: + GivesBounty: + Percentage: 0 + ^Tank: + GivesBounty: + Percentage: 0 + ^Vehicle: + GivesBounty: + Percentage: 0 APC: Health: HP: 1000 @@ -334,9 +343,10 @@ Rules: Description: Explodes like a damn nuke! Health: HP: 100 - Explodes: - Weapon: CrateNuke - EmptyWeapon: + Explodes: + Weapon: CrateNuke + EmptyWeapon: CrateNuke + DemoTruck: SHOK: Health: HP: 800 diff --git a/mods/ra/maps/drop-zone/map.yaml b/mods/ra/maps/drop-zone/map.yaml index f00ab9bfdc..447e6bb86e 100644 --- a/mods/ra/maps/drop-zone/map.yaml +++ b/mods/ra/maps/drop-zone/map.yaml @@ -216,6 +216,15 @@ Rules: GiveUnitCrateAction@dog: SelectionShares: 1 Unit: dog + ^Infantry: + GivesBounty: + Percentage: 0 + ^Tank: + GivesBounty: + Percentage: 0 + ^Vehicle: + GivesBounty: + Percentage: 0 APC: Health: HP: 1000 @@ -229,9 +238,10 @@ Rules: Description: Explodes like a damn nuke! Health: HP: 100 - Explodes: - Weapon: CrateNuke - EmptyWeapon: + Explodes: + Weapon: CrateNuke + EmptyWeapon: CrateNuke + DemoTruck: SHOK: Health: HP: 800