wire up hide-map crate properly
This commit is contained in:
@@ -58,8 +58,6 @@ namespace OpenRA
|
|||||||
bool IsExplored(int x, int y) { return shroud.exploredCells[x,y]; }
|
bool IsExplored(int x, int y) { return shroud.exploredCells[x,y]; }
|
||||||
|
|
||||||
public bool DisplayOnRadar(int x, int y) { return IsExplored(x, y); }
|
public bool DisplayOnRadar(int x, int y) { return IsExplored(x, y); }
|
||||||
|
|
||||||
public void ResetExplored() { } // todo
|
|
||||||
|
|
||||||
public void Explore(World w, int2 center, int range) { dirty = true; }
|
public void Explore(World w, int2 center, int range) { dirty = true; }
|
||||||
public void Explore(Actor a) { if (a.Owner == a.World.LocalPlayer) dirty = true; }
|
public void Explore(Actor a) { if (a.Owner == a.World.LocalPlayer) dirty = true; }
|
||||||
|
|||||||
@@ -26,12 +26,12 @@ using System.Drawing;
|
|||||||
|
|
||||||
namespace OpenRA.Traits
|
namespace OpenRA.Traits
|
||||||
{
|
{
|
||||||
class ShroudInfo : ITraitInfo
|
public class ShroudInfo : ITraitInfo
|
||||||
{
|
{
|
||||||
public object Create(Actor self) { return new Shroud(self, this); }
|
public object Create(Actor self) { return new Shroud(self, this); }
|
||||||
}
|
}
|
||||||
|
|
||||||
class Shroud
|
public class Shroud
|
||||||
{
|
{
|
||||||
Map map;
|
Map map;
|
||||||
|
|
||||||
@@ -124,5 +124,12 @@ namespace OpenRA.Traits
|
|||||||
exploredBounds = exploredBounds.HasValue ?
|
exploredBounds = exploredBounds.HasValue ?
|
||||||
Rectangle.Union(exploredBounds.Value, box) : box;
|
Rectangle.Union(exploredBounds.Value, box) : box;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void ResetExploration() // for `hide map` crate
|
||||||
|
{
|
||||||
|
for (var j = 0; j <= exploredCells.GetUpperBound(1); j++)
|
||||||
|
for (var i = 0; i <= exploredCells.GetUpperBound(0); i++)
|
||||||
|
exploredCells[i, j] = visibleCells[i, j] > 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -34,8 +34,9 @@ namespace OpenRA.Mods.RA
|
|||||||
|
|
||||||
public override void Activate(Actor collector)
|
public override void Activate(Actor collector)
|
||||||
{
|
{
|
||||||
collector.Owner.Shroud.ResetExplored();
|
|
||||||
base.Activate(collector);
|
base.Activate(collector);
|
||||||
|
if (collector.Owner == collector.World.LocalPlayer)
|
||||||
|
collector.World.WorldActor.traits.Get<Shroud>().ResetExploration();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user