From a91ebb4eda64dbc7c475d3fd4bdaddbef5add874 Mon Sep 17 00:00:00 2001 From: Paul Chote Date: Tue, 27 Jul 2010 11:34:28 +1200 Subject: [PATCH] Allies share sight --- OpenRA.Game/Traits/TraitsInterfaces.cs | 2 +- OpenRA.Game/Traits/World/Shroud.cs | 10 +++++++++- OpenRA.Mods.RA/RevealsShroud.cs | 2 +- 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/OpenRA.Game/Traits/TraitsInterfaces.cs b/OpenRA.Game/Traits/TraitsInterfaces.cs index 9ae96f8f76..442aab89a3 100644 --- a/OpenRA.Game/Traits/TraitsInterfaces.cs +++ b/OpenRA.Game/Traits/TraitsInterfaces.cs @@ -59,7 +59,7 @@ namespace OpenRA.Traits public interface IRadarVisibilityModifier { bool VisibleOnRadar(Actor self); } public interface IRadarColorModifier { Color RadarColorOverride(Actor self); } - + public interface IRevealShroud {} public interface IOccupySpace { int2 TopLeft { get; } diff --git a/OpenRA.Game/Traits/World/Shroud.cs b/OpenRA.Game/Traits/World/Shroud.cs index 4ba5e12db4..45fe0a6ca2 100644 --- a/OpenRA.Game/Traits/World/Shroud.cs +++ b/OpenRA.Game/Traits/World/Shroud.cs @@ -14,6 +14,7 @@ using System.Drawing; using System.Linq; using OpenRA.FileFormats; using OpenRA.GameRules; +using OpenRA.Traits; namespace OpenRA.Traits { @@ -63,7 +64,14 @@ namespace OpenRA.Traits void AddActor(Actor a) { - if (a.Owner == null || a.Owner != a.Owner.World.LocalPlayer) return; + if (a.traits.WithInterface().Count() == 0) + return; + + bool shareShroud = true; // Todo: make this a server flag + + if (a.Owner == null || a.Owner.World.LocalPlayer == null + || a.Owner.Stances[a.Owner.World.LocalPlayer] != Stance.Ally) return; + if (!shareShroud && a.Owner != a.Owner.World.LocalPlayer) return; if (vis.ContainsKey(a)) { diff --git a/OpenRA.Mods.RA/RevealsShroud.cs b/OpenRA.Mods.RA/RevealsShroud.cs index cb16ccac3f..77f66d5967 100644 --- a/OpenRA.Mods.RA/RevealsShroud.cs +++ b/OpenRA.Mods.RA/RevealsShroud.cs @@ -14,7 +14,7 @@ namespace OpenRA.Mods.RA { class RevealsShroudInfo : TraitInfo { } - class RevealsShroud : ITick + class RevealsShroud : ITick, IRevealShroud { int2 previousLocation;