diff --git a/OpenRA.Game/ShroudRenderer.cs b/OpenRA.Game/ShroudRenderer.cs index aabe46bb7c..ca9fb59cc8 100644 --- a/OpenRA.Game/ShroudRenderer.cs +++ b/OpenRA.Game/ShroudRenderer.cs @@ -46,6 +46,8 @@ namespace OpenRA sprites = new Sprite[map.MapSize, map.MapSize]; fogSprites = new Sprite[map.MapSize, map.MapSize]; + + shroud.Dirty += () => dirty = true; } public bool HasGPS diff --git a/OpenRA.Game/Traits/World/Shroud.cs b/OpenRA.Game/Traits/World/Shroud.cs index 73bfeea354..8cdb4c9b36 100644 --- a/OpenRA.Game/Traits/World/Shroud.cs +++ b/OpenRA.Game/Traits/World/Shroud.cs @@ -23,6 +23,7 @@ using System.Linq; using OpenRA.FileFormats; using OpenRA.GameRules; using System.Drawing; +using System; namespace OpenRA.Traits { @@ -38,6 +39,7 @@ namespace OpenRA.Traits public int[,] visibleCells; public bool[,] exploredCells; public Rectangle? exploredBounds; + public event Action Dirty = () => { }; public Shroud(Actor self, ShroudInfo info) { @@ -78,6 +80,8 @@ namespace OpenRA.Traits } vis[a] = v; + + Dirty(); } static IEnumerable GetVisOrigins(Actor a) @@ -107,6 +111,8 @@ namespace OpenRA.Traits --visibleCells[q.X, q.Y]; vis.Remove(a); + + Dirty(); } public void UpdateActor(Actor a) @@ -123,6 +129,8 @@ namespace OpenRA.Traits 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; + + Dirty(); } public void ResetExploration() // for `hide map` crate @@ -130,6 +138,8 @@ namespace OpenRA.Traits 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; + + Dirty(); } } } diff --git a/OpenRA.Mods.RA/SpyPlanePower.cs b/OpenRA.Mods.RA/SpyPlanePower.cs index 92cf2aa65f..305b6a5c80 100644 --- a/OpenRA.Mods.RA/SpyPlanePower.cs +++ b/OpenRA.Mods.RA/SpyPlanePower.cs @@ -26,7 +26,7 @@ namespace OpenRA.Mods.RA { class SpyPlanePowerInfo : SupportPowerInfo { - public readonly int Range = 10; + public readonly float RevealTime = .1f; // minutes public override object Create(Actor self) { return new SpyPlanePower(self,this); } } @@ -58,9 +58,13 @@ namespace OpenRA.Mods.RA plane.CancelActivity(); plane.QueueActivity(new Fly(Util.CenterOfCell(order.TargetLocation))); - plane.QueueActivity(new CallFunc( - () => Owner.Shroud.Explore(Owner.World, order.TargetLocation, - (Info as SpyPlanePowerInfo).Range))); + plane.QueueActivity(new CallFunc(() => plane.World.AddFrameEndTask( w => + { + + var camera = w.CreateActor("camera", order.TargetLocation, Owner); + camera.QueueActivity(new Wait((int)(25 * 60 * (Info as SpyPlanePowerInfo).RevealTime))); + camera.QueueActivity(new RemoveSelf()); + }))); plane.QueueActivity(new FlyOffMap { Interruptible = false }); plane.QueueActivity(new RemoveSelf()); } diff --git a/mods/ra/rules.yaml b/mods/ra/rules.yaml index 9ce54a0285..1dbf21a277 100755 --- a/mods/ra/rules.yaml +++ b/mods/ra/rules.yaml @@ -2651,3 +2651,8 @@ WOOD: Building: HP: 100 Armor: none + +CAMERA: + Unit: + HP:1000 + Sight: 10 \ No newline at end of file