Merge pull request #7686 from reaperrr/custom-visibility-update
Skip visibility updates when fog & shroud are disabled via lobby
This commit is contained in:
@@ -15,22 +15,28 @@ namespace OpenRA.Traits
|
||||
public class CreatesShroudInfo : ITraitInfo
|
||||
{
|
||||
public readonly WRange Range = WRange.Zero;
|
||||
public object Create(ActorInitializer init) { return new CreatesShroud(this); }
|
||||
|
||||
public object Create(ActorInitializer init) { return new CreatesShroud(init.Self, this); }
|
||||
}
|
||||
|
||||
public class CreatesShroud : ITick, ISync
|
||||
{
|
||||
readonly CreatesShroudInfo info;
|
||||
readonly bool lobbyShroudFogDisabled;
|
||||
[Sync] CPos cachedLocation;
|
||||
[Sync] bool cachedDisabled;
|
||||
|
||||
public CreatesShroud(CreatesShroudInfo info)
|
||||
public CreatesShroud(Actor self, CreatesShroudInfo info)
|
||||
{
|
||||
this.info = info;
|
||||
lobbyShroudFogDisabled = !self.World.LobbyInfo.GlobalSettings.Shroud && !self.World.LobbyInfo.GlobalSettings.Fog;
|
||||
}
|
||||
|
||||
public void Tick(Actor self)
|
||||
{
|
||||
if (lobbyShroudFogDisabled)
|
||||
return;
|
||||
|
||||
var disabled = self.TraitsImplementing<IDisable>().Any(d => d.Disabled);
|
||||
if (cachedLocation != self.Location || cachedDisabled != disabled)
|
||||
{
|
||||
|
||||
@@ -15,21 +15,27 @@ namespace OpenRA.Traits
|
||||
public class RevealsShroudInfo : ITraitInfo
|
||||
{
|
||||
public readonly WRange Range = WRange.Zero;
|
||||
public object Create(ActorInitializer init) { return new RevealsShroud(this); }
|
||||
|
||||
public object Create(ActorInitializer init) { return new RevealsShroud(init.Self, this); }
|
||||
}
|
||||
|
||||
public class RevealsShroud : ITick, ISync
|
||||
{
|
||||
readonly RevealsShroudInfo info;
|
||||
readonly bool lobbyShroudFogDisabled;
|
||||
[Sync] CPos cachedLocation;
|
||||
|
||||
public RevealsShroud(RevealsShroudInfo info)
|
||||
public RevealsShroud(Actor self, RevealsShroudInfo info)
|
||||
{
|
||||
this.info = info;
|
||||
lobbyShroudFogDisabled = !self.World.LobbyInfo.GlobalSettings.Shroud && !self.World.LobbyInfo.GlobalSettings.Fog;
|
||||
}
|
||||
|
||||
public void Tick(Actor self)
|
||||
{
|
||||
if (lobbyShroudFogDisabled)
|
||||
return;
|
||||
|
||||
if (cachedLocation != self.Location)
|
||||
{
|
||||
cachedLocation = self.Location;
|
||||
|
||||
Reference in New Issue
Block a user