Remove Shroud.IsExplored(Actor) and IsVisible(Actor).
This commit is contained in:
@@ -149,6 +149,19 @@ namespace OpenRA
|
|||||||
nsc.Trait.StanceChanged(nsc.Actor, this, target, oldStance, s);
|
nsc.Trait.StanceChanged(nsc.Actor, this, target, oldStance, s);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public bool CanViewActor(Actor a)
|
||||||
|
{
|
||||||
|
if (a.TraitsImplementing<IVisibilityModifier>().Any(t => !t.IsVisible(a, this)))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
if (a.Owner.IsAlliedWith(this))
|
||||||
|
return true;
|
||||||
|
|
||||||
|
// Actors are hidden under shroud, but not under fog by default
|
||||||
|
// TODO: Shroud exploration should be implemented as an IVisibility modifier!
|
||||||
|
return Shroud.GetVisOrigins(a).Any(Shroud.IsExplored);
|
||||||
|
}
|
||||||
|
|
||||||
#region Scripting interface
|
#region Scripting interface
|
||||||
|
|
||||||
Lazy<ScriptPlayerInterface> luaInterface;
|
Lazy<ScriptPlayerInterface> luaInterface;
|
||||||
|
|||||||
@@ -342,11 +342,6 @@ namespace OpenRA.Traits
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool IsExplored(Actor a)
|
|
||||||
{
|
|
||||||
return GetVisOrigins(a).Any(IsExplored);
|
|
||||||
}
|
|
||||||
|
|
||||||
public bool IsVisible(WPos pos)
|
public bool IsVisible(WPos pos)
|
||||||
{
|
{
|
||||||
return IsVisible(map.CellContaining(pos));
|
return IsVisible(map.CellContaining(pos));
|
||||||
@@ -394,15 +389,6 @@ namespace OpenRA.Traits
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Actors are hidden under shroud, but not under fog by default
|
|
||||||
public bool IsVisible(Actor a)
|
|
||||||
{
|
|
||||||
if (a.TraitsImplementing<IVisibilityModifier>().Any(t => !t.IsVisible(a, self.Owner)))
|
|
||||||
return false;
|
|
||||||
|
|
||||||
return a.Owner.IsAlliedWith(self.Owner) || IsExplored(a);
|
|
||||||
}
|
|
||||||
|
|
||||||
public bool IsTargetable(Actor a)
|
public bool IsTargetable(Actor a)
|
||||||
{
|
{
|
||||||
if (HasFogVisibility())
|
if (HasFogVisibility())
|
||||||
|
|||||||
@@ -70,12 +70,9 @@ namespace OpenRA
|
|||||||
set { renderPlayer = value; }
|
set { renderPlayer = value; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool FogObscures(Actor a) { return RenderPlayer != null && !RenderPlayer.Shroud.IsVisible(a); }
|
public bool FogObscures(Actor a) { return RenderPlayer != null && !RenderPlayer.CanViewActor(a); }
|
||||||
public bool FogObscures(CPos p) { return RenderPlayer != null && !RenderPlayer.Shroud.IsVisible(p); }
|
public bool FogObscures(CPos p) { return RenderPlayer != null && !RenderPlayer.Shroud.IsVisible(p); }
|
||||||
public bool FogObscures(WPos pos) { return RenderPlayer != null && !RenderPlayer.Shroud.IsVisible(pos); }
|
public bool FogObscures(WPos pos) { return RenderPlayer != null && !RenderPlayer.Shroud.IsVisible(pos); }
|
||||||
public bool FogObscures(MPos uv) { return RenderPlayer != null && !RenderPlayer.Shroud.IsVisible(uv); }
|
|
||||||
|
|
||||||
public bool ShroudObscures(Actor a) { return RenderPlayer != null && !RenderPlayer.Shroud.IsExplored(a); }
|
|
||||||
public bool ShroudObscures(CPos p) { return RenderPlayer != null && !RenderPlayer.Shroud.IsExplored(p); }
|
public bool ShroudObscures(CPos p) { return RenderPlayer != null && !RenderPlayer.Shroud.IsExplored(p); }
|
||||||
public bool ShroudObscures(WPos pos) { return RenderPlayer != null && !RenderPlayer.Shroud.IsExplored(pos); }
|
public bool ShroudObscures(WPos pos) { return RenderPlayer != null && !RenderPlayer.Shroud.IsExplored(pos); }
|
||||||
public bool ShroudObscures(MPos uv) { return RenderPlayer != null && !RenderPlayer.Shroud.IsExplored(uv); }
|
public bool ShroudObscures(MPos uv) { return RenderPlayer != null && !RenderPlayer.Shroud.IsExplored(uv); }
|
||||||
|
|||||||
@@ -77,7 +77,7 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
// The actor is not currently visible
|
// The actor is not currently visible
|
||||||
if (!self.Owner.Shroud.IsVisible(actor.Actor))
|
if (!self.Owner.CanViewActor(actor.Actor))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
visibleActorIds.Add(actor.Actor.ActorID);
|
visibleActorIds.Add(actor.Actor.ActorID);
|
||||||
|
|||||||
Reference in New Issue
Block a user