Merge pull request #5974 from pchote/cratefix

Fix unit collection crates and drop-zone maps.
This commit is contained in:
Chris Forbes
2014-07-18 12:58:24 +12:00
3 changed files with 36 additions and 12 deletions

View File

@@ -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<BuildableInfo>();
// 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;
}

View File

@@ -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

View File

@@ -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