Track visibility modifiers on FrozenActors.
This commit is contained in:
committed by
Oliver Brakmann
parent
5f79c31a57
commit
224377f078
@@ -46,7 +46,17 @@ namespace OpenRA.Traits
|
||||
public DamageState DamageState { get; private set; }
|
||||
readonly IHealth health;
|
||||
|
||||
// The Visible flag is tied directly to the actor visibility under the fog.
|
||||
// If Visible is true, the actor is made invisible (via FrozenUnderFog/IDefaultVisibility)
|
||||
// and this FrozenActor is rendered instead.
|
||||
// The Hidden flag covers the edge case that occurs when the backing actor was last "seen"
|
||||
// to be cloaked or otherwise not CanBeViewedByPlayer()ed. Setting Visible to true when
|
||||
// the actor is hidden under the fog would leak the actors position via the tooltips and
|
||||
// AutoTargetability, and keeping Visible as false would cause the actor to be rendered
|
||||
// under the fog.
|
||||
public bool Visible = true;
|
||||
public bool Hidden = false;
|
||||
|
||||
public bool Shrouded { get; private set; }
|
||||
public bool NeedRenderables { get; set; }
|
||||
public IRenderable[] Renderables = NoRenderables;
|
||||
@@ -101,6 +111,7 @@ namespace OpenRA.Traits
|
||||
{
|
||||
Owner = actor.Owner;
|
||||
TargetTypes = actor.GetEnabledTargetTypes();
|
||||
Hidden = !actor.CanBeViewedByPlayer(viewer);
|
||||
|
||||
if (health != null)
|
||||
{
|
||||
@@ -145,6 +156,11 @@ namespace OpenRA.Traits
|
||||
NeedRenderables |= Visible && !wasVisible;
|
||||
}
|
||||
|
||||
public void Invalidate()
|
||||
{
|
||||
Owner = null;
|
||||
}
|
||||
|
||||
public void Flash()
|
||||
{
|
||||
flashTicks = 5;
|
||||
|
||||
Reference in New Issue
Block a user