Refactor AutoTarget scan and GPS interaction, and cache trait lookup for a slight performance boost

This commit is contained in:
ScottNZ
2014-06-07 02:05:10 +12:00
parent 5784444720
commit 7e6f7c51e1
10 changed files with 39 additions and 60 deletions

View File

@@ -21,7 +21,7 @@ namespace OpenRA.Mods.RA
public object Create (ActorInitializer init) { return new GpsWatcher(init.self.Owner); }
}
class GpsWatcher : ISync
class GpsWatcher : ISync, IFogVisibilityModifier
{
[Sync] bool Launched = false;
[Sync] public bool GrantedAllies = false;
@@ -73,6 +73,11 @@ namespace OpenRA.Mods.RA
if (Granted || GrantedAllies)
owner.Shroud.ExploreAll(owner.World);
}
public bool HasFogVisibility(Player byPlayer)
{
return Granted || GrantedAllies;
}
}
class GpsPowerInfo : SupportPowerInfo