Only allow spice blooms to grow on certain terrain types

This commit is contained in:
reaperrr
2015-11-04 23:32:24 +01:00
parent 39fa74a013
commit 64b1aea065

View File

@@ -34,6 +34,9 @@ namespace OpenRA.Mods.D2k.Traits
public readonly string ResourceType = "Spice"; public readonly string ResourceType = "Spice";
[Desc("Spice blooms only grow on these terrain types.")]
public readonly HashSet<string> GrowthTerrainTypes = new HashSet<string>();
[Desc("The weapon to use for spice creation.")] [Desc("The weapon to use for spice creation.")]
[WeaponReference] [WeaponReference]
public readonly string Weapon = "SpiceExplosion"; public readonly string Weapon = "SpiceExplosion";
@@ -78,6 +81,12 @@ namespace OpenRA.Mods.D2k.Traits
public void Tick(Actor self) public void Tick(Actor self)
{ {
if (!self.World.Map.Contains(self.Location))
return;
if (info.GrowthTerrainTypes.Count > 0 && !info.GrowthTerrainTypes.Contains(self.World.Map.GetTerrainInfo(self.Location).Type))
return;
ticks++; ticks++;
if (ticks >= growTicks) if (ticks >= growTicks)