diff --git a/OpenRA.Game/OpenRA.Game.csproj b/OpenRA.Game/OpenRA.Game.csproj index ac866bda11..ea15d2ac38 100755 --- a/OpenRA.Game/OpenRA.Game.csproj +++ b/OpenRA.Game/OpenRA.Game.csproj @@ -1,4 +1,4 @@ - + Debug @@ -150,6 +150,7 @@ + @@ -240,4 +241,4 @@ --> - + \ No newline at end of file diff --git a/OpenRA.Game/Traits/CreatesShroud.cs b/OpenRA.Game/Traits/CreatesShroud.cs new file mode 100644 index 0000000000..95e785d32a --- /dev/null +++ b/OpenRA.Game/Traits/CreatesShroud.cs @@ -0,0 +1,36 @@ +#region Copyright & License Information +/* + * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) + * This file is part of OpenRA, which is free software. It is made + * available to you under the terms of the GNU General Public License + * as published by the Free Software Foundation. For more information, + * see COPYING. + */ +#endregion + +using System.Linq; + +namespace OpenRA.Traits +{ + class CreatesShroudInfo : ITraitInfo + { + public readonly int Range = 0; + public object Create(ActorInitializer init) { return new CreatesShroud(this); } + } + + class CreatesShroud : ITick + { + CreatesShroudInfo Info; + + public CreatesShroud(CreatesShroudInfo info) + { + Info = info; + } + + public void Tick(Actor self) + { + if (!self.TraitsImplementing().Any(d => d.Disabled)) + self.World.WorldActor.Trait().HideActor(self, Info.Range); + } + } +} \ No newline at end of file diff --git a/OpenRA.Game/Traits/World/Shroud.cs b/OpenRA.Game/Traits/World/Shroud.cs index e2e3c13a08..e77e557fd2 100644 --- a/OpenRA.Game/Traits/World/Shroud.cs +++ b/OpenRA.Game/Traits/World/Shroud.cs @@ -112,6 +112,24 @@ namespace OpenRA.Traits Dirty(); } + public void HideActor(Actor a, int range) + { + if (a.Owner.World.LocalPlayer == null + || a.Owner.Stances[a.Owner.World.LocalPlayer] == Stance.Ally) return; + + var v = new ActorVisibility + { + vis = GetVisOrigins(a).ToArray() + }; + + foreach (var p in v.vis) + foreach (var q in FindVisibleTiles(a.World, p, range)) + exploredCells[q.X, q.Y] = visibleCells[q.X, q.Y] > 0; + + if (!Disabled) + Dirty(); + } + public void UpdatePlayerStance(World w, Player player, Stance oldStance, Stance newStance) { if (oldStance == newStance) diff --git a/mods/ra/rules/structures.yaml b/mods/ra/rules/structures.yaml index 60b84f8e67..ebd6bdb88e 100644 --- a/mods/ra/rules/structures.yaml +++ b/mods/ra/rules/structures.yaml @@ -42,15 +42,15 @@ GAP: RequiresPower: CanPowerDown: Valued: - Cost: 500 + Cost: 1000 Tooltip: Name: Gap Generator - Description: Regenerates the Fog of War nearby, \nobscuring the area.\n Unarmed -# Buildable: -# BuildPaletteOrder: 100 -# Prerequisites: atek -# Owner: allies -# Cost: 500 + Description: Regenerates the shroud nearby, \nobscuring the area.\n Unarmed + Buildable: + Queue: Defense + BuildPaletteOrder: 100 + Prerequisites: atek + Owner: allies Building: Power: -60 Footprint: _ x @@ -60,7 +60,9 @@ GAP: Armor: Type: Wood RevealsShroud: - Range: 10 + Range: 6 + CreatesShroud: + Range: 6 IronCurtainable: SPEN: