merged pchote/master

This commit is contained in:
Chris Forbes
2010-01-15 17:30:37 +13:00
10 changed files with 175 additions and 54 deletions

View File

@@ -0,0 +1,36 @@
using System;
using System.Collections.Generic;
using System.Linq;
using OpenRa.FileFormats;
using OpenRa.Game.Support;
using OpenRa.Game.Traits;
namespace OpenRa.Game.Traits
{
class GeneratesGapInfo : ITraitInfo
{
public readonly int Range = 10;
public object Create(Actor self) { return new GeneratesGap(self); }
}
class GeneratesGap
{
Actor self;
public GeneratesGap(Actor self)
{
this.self = self;
}
public IEnumerable<int2> GetShroudedTiles()
{
int range = self.Info.Traits.Get<GeneratesGapInfo>().Range;
// Gap Generator building; powered down
if (self.traits.Contains<Building>() && self.traits.Get<Building>().Disabled)
yield break;
foreach (var t in Game.FindTilesInCircle(self.Location, range))
yield return t;
}
}
}