Simply the localplayer hack, and prevent vis dirtying when shroud is disabled.
This commit is contained in:
@@ -31,13 +31,13 @@ namespace OpenRA.Traits
|
|||||||
bool disabled = false;
|
bool disabled = false;
|
||||||
public bool Disabled
|
public bool Disabled
|
||||||
{
|
{
|
||||||
get { return disabled; }
|
get { return disabled || world.LocalPlayer == null; }
|
||||||
set { disabled = value; Dirty(); }
|
set { disabled = value; Dirty(); }
|
||||||
}
|
}
|
||||||
|
|
||||||
public Rectangle? Bounds
|
public Rectangle? Bounds
|
||||||
{
|
{
|
||||||
get { return !disabled ? exploredBounds : null; }
|
get { return Disabled ? null : exploredBounds; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public event Action Dirty = () => { };
|
public event Action Dirty = () => { };
|
||||||
@@ -108,7 +108,8 @@ namespace OpenRA.Traits
|
|||||||
|
|
||||||
vis[a] = v;
|
vis[a] = v;
|
||||||
|
|
||||||
Dirty();
|
if (!Disabled)
|
||||||
|
Dirty();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void UpdatePlayerStance(World w, Player player, Stance oldStance, Stance newStance)
|
public void UpdatePlayerStance(World w, Player player, Stance oldStance, Stance newStance)
|
||||||
@@ -151,8 +152,9 @@ namespace OpenRA.Traits
|
|||||||
--visibleCells[q.X, q.Y];
|
--visibleCells[q.X, q.Y];
|
||||||
|
|
||||||
vis.Remove(a);
|
vis.Remove(a);
|
||||||
|
|
||||||
Dirty();
|
if (!Disabled)
|
||||||
|
Dirty();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void UpdateActor(Actor a)
|
public void UpdateActor(Actor a)
|
||||||
@@ -171,7 +173,8 @@ namespace OpenRA.Traits
|
|||||||
var box = new Rectangle(center.X - range, center.Y - range, 2 * range + 1, 2 * range + 1);
|
var box = new Rectangle(center.X - range, center.Y - range, 2 * range + 1, 2 * range + 1);
|
||||||
exploredBounds = (exploredBounds.HasValue) ? Rectangle.Union(exploredBounds.Value, box) : box;
|
exploredBounds = (exploredBounds.HasValue) ? Rectangle.Union(exploredBounds.Value, box) : box;
|
||||||
|
|
||||||
Dirty();
|
if (!Disabled)
|
||||||
|
Dirty();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void ExploreAll(World world)
|
public void ExploreAll(World world)
|
||||||
@@ -181,7 +184,8 @@ namespace OpenRA.Traits
|
|||||||
exploredCells[i, j] = true;
|
exploredCells[i, j] = true;
|
||||||
exploredBounds = world.Map.Bounds;
|
exploredBounds = world.Map.Bounds;
|
||||||
|
|
||||||
Dirty();
|
if (!Disabled)
|
||||||
|
Dirty();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void ResetExploration() // for `hide map` crate
|
public void ResetExploration() // for `hide map` crate
|
||||||
@@ -190,7 +194,8 @@ namespace OpenRA.Traits
|
|||||||
for (var i = 0; i <= exploredCells.GetUpperBound(0); i++)
|
for (var i = 0; i <= exploredCells.GetUpperBound(0); i++)
|
||||||
exploredCells[i, j] = visibleCells[i, j] > 0;
|
exploredCells[i, j] = visibleCells[i, j] > 0;
|
||||||
|
|
||||||
Dirty();
|
if (!Disabled)
|
||||||
|
Dirty();
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool IsExplored(int2 xy) { return IsExplored(xy.X, xy.Y); }
|
public bool IsExplored(int2 xy) { return IsExplored(xy.X, xy.Y); }
|
||||||
@@ -199,7 +204,7 @@ namespace OpenRA.Traits
|
|||||||
if (!map.IsInMap(x, y))
|
if (!map.IsInMap(x, y))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (disabled || world.LocalPlayer == null)
|
if (Disabled)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
return exploredCells[x,y];
|
return exploredCells[x,y];
|
||||||
@@ -208,7 +213,7 @@ namespace OpenRA.Traits
|
|||||||
public bool IsVisible(int2 xy) { return IsVisible(xy.X, xy.Y); }
|
public bool IsVisible(int2 xy) { return IsVisible(xy.X, xy.Y); }
|
||||||
public bool IsVisible(int x, int y)
|
public bool IsVisible(int x, int y)
|
||||||
{
|
{
|
||||||
if (disabled || world.LocalPlayer == null)
|
if (Disabled)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
return visibleCells[x,y] != 0;
|
return visibleCells[x,y] != 0;
|
||||||
@@ -220,7 +225,7 @@ namespace OpenRA.Traits
|
|||||||
if (a.TraitsImplementing<IVisibilityModifier>().Any(t => !t.IsVisible(a)))
|
if (a.TraitsImplementing<IVisibilityModifier>().Any(t => !t.IsVisible(a)))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
return disabled || a.Owner == a.World.LocalPlayer || GetVisOrigins(a).Any(o => IsExplored(o));
|
return Disabled || a.Owner == a.World.LocalPlayer || GetVisOrigins(a).Any(o => IsExplored(o));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user