Gap generators

This commit is contained in:
Paul Chote
2010-01-12 00:03:00 +13:00
parent b86f76ce8c
commit bf1e7b86e1
6 changed files with 65 additions and 6 deletions

View File

@@ -0,0 +1,29 @@
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 GeneratesGap
{
Actor self;
public GeneratesGap(Actor self)
{
this.self = self;
}
public IEnumerable<int2>GetShroudedTiles()
{
// Gap Generator building; powered down
if (self.traits.Contains<Building>() && self.traits.Get<Building>().Disabled)
yield break;
// It won't let me return Game.FindTilesInCircle directly...?
foreach (var t in Game.FindTilesInCircle(self.Location, Rules.General.GapRadius))
yield return t;
}
}
}