HasSight -> RevealsShroud and used everywhere

This commit is contained in:
Chris Forbes
2010-04-19 20:49:32 +12:00
parent 95ede55179
commit 595dd57b6f
8 changed files with 22 additions and 15 deletions

View File

@@ -82,7 +82,7 @@
<Compile Include="Orders\GenericSelectTarget.cs" />
<Compile Include="Traits\AI\EmitInfantryOnSell.cs" />
<Compile Include="Traits\AI\ReturnOnIdle.cs" />
<Compile Include="Traits\HasSight.cs" />
<Compile Include="Traits\RevealsShroud.cs" />
<Compile Include="Traits\Player\VictoryConditions.cs" />
<Compile Include="Traits\Modifiers\HiddenUnderFog.cs" />
<Compile Include="Traits\Render\RenderFlare.cs" />

View File

@@ -53,7 +53,6 @@ namespace OpenRA.Traits
{
self.World.WorldActor.traits.Get<UnitInfluence>().Remove(self, this);
self.Location = value;
self.World.WorldActor.traits.Get<Shroud>().UpdateActor(self);
}
self.World.WorldActor.traits.Get<UnitInfluence>().Add(self, this);
}

View File

@@ -20,16 +20,19 @@
namespace OpenRA.Traits
{
class HasSightInfo : TraitInfo<HasSight> { }
class RevealsShroudInfo : TraitInfo<RevealsShroud> { }
// for random non-mobile movers
class HasSight : ITick
class RevealsShroud : ITick
{
int2 previousLocation;
public void Tick(Actor self)
{
if (!self.IsIdle)
if (!self.IsIdle && previousLocation != self.Location)
{
previousLocation = self.Location;
self.World.WorldActor.traits.Get<Shroud>().UpdateActor(self);
}
}
}
}

View File

@@ -87,6 +87,8 @@ namespace OpenRA.Traits
vis = GetVisOrigins(a).ToArray()
};
if (v.range == 0) return; // don't bother for things that can't see
foreach (var p in v.vis)
{
foreach (var q in FindVisibleTiles(a.World, p, v.range))