Prevent frozen actors leaking through shroud.
This commit is contained in:
@@ -41,6 +41,7 @@ namespace OpenRA.Traits
|
|||||||
public DamageState DamageState;
|
public DamageState DamageState;
|
||||||
|
|
||||||
public bool Visible = true;
|
public bool Visible = true;
|
||||||
|
public bool Shrouded { get; private set; }
|
||||||
public bool NeedRenderables { get; private set; }
|
public bool NeedRenderables { get; private set; }
|
||||||
public bool IsRendering { get; private set; }
|
public bool IsRendering { get; private set; }
|
||||||
|
|
||||||
@@ -84,6 +85,7 @@ namespace OpenRA.Traits
|
|||||||
void UpdateVisibility()
|
void UpdateVisibility()
|
||||||
{
|
{
|
||||||
var wasVisible = Visible;
|
var wasVisible = Visible;
|
||||||
|
Shrouded = true;
|
||||||
|
|
||||||
// We are doing the following LINQ manually for performance since this is a hot path.
|
// We are doing the following LINQ manually for performance since this is a hot path.
|
||||||
// Visible = !Footprint.Any(shroud.IsVisible);
|
// Visible = !Footprint.Any(shroud.IsVisible);
|
||||||
@@ -93,8 +95,12 @@ namespace OpenRA.Traits
|
|||||||
if (shroud.IsVisible(puv))
|
if (shroud.IsVisible(puv))
|
||||||
{
|
{
|
||||||
Visible = false;
|
Visible = false;
|
||||||
|
Shrouded = false;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (Shrouded && shroud.IsExplored(puv))
|
||||||
|
Shrouded = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Visible && !wasVisible)
|
if (Visible && !wasVisible)
|
||||||
@@ -119,6 +125,9 @@ namespace OpenRA.Traits
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (Shrouded)
|
||||||
|
return NoRenderables;
|
||||||
|
|
||||||
if (flashTicks > 0 && flashTicks % 2 == 0)
|
if (flashTicks > 0 && flashTicks % 2 == 0)
|
||||||
{
|
{
|
||||||
var highlight = wr.Palette("highlight");
|
var highlight = wr.Palette("highlight");
|
||||||
@@ -129,7 +138,7 @@ namespace OpenRA.Traits
|
|||||||
return renderables;
|
return renderables;
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool HasRenderables { get { return renderables.Any(); } }
|
public bool HasRenderables { get { return !Shrouded && renderables.Any(); } }
|
||||||
|
|
||||||
public bool ShouldBeRemoved(Player owner)
|
public bool ShouldBeRemoved(Player owner)
|
||||||
{
|
{
|
||||||
@@ -175,6 +184,8 @@ namespace OpenRA.Traits
|
|||||||
VisibilityHash = 0;
|
VisibilityHash = 0;
|
||||||
FrozenHash = 0;
|
FrozenHash = 0;
|
||||||
|
|
||||||
|
// TODO: Track shroud updates using Shroud.CellsChanged
|
||||||
|
// and then only tick FrozenActors that might have changed
|
||||||
foreach (var kvp in frozen)
|
foreach (var kvp in frozen)
|
||||||
{
|
{
|
||||||
var hash = (int)kvp.Key;
|
var hash = (int)kvp.Key;
|
||||||
|
|||||||
Reference in New Issue
Block a user