Allies share sight

This commit is contained in:
Paul Chote
2010-07-27 11:34:28 +12:00
parent 9fe6671ace
commit a91ebb4eda
3 changed files with 11 additions and 3 deletions

View File

@@ -59,7 +59,7 @@ namespace OpenRA.Traits
public interface IRadarVisibilityModifier { bool VisibleOnRadar(Actor self); } public interface IRadarVisibilityModifier { bool VisibleOnRadar(Actor self); }
public interface IRadarColorModifier { Color RadarColorOverride(Actor self); } public interface IRadarColorModifier { Color RadarColorOverride(Actor self); }
public interface IRevealShroud {}
public interface IOccupySpace public interface IOccupySpace
{ {
int2 TopLeft { get; } int2 TopLeft { get; }

View File

@@ -14,6 +14,7 @@ using System.Drawing;
using System.Linq; using System.Linq;
using OpenRA.FileFormats; using OpenRA.FileFormats;
using OpenRA.GameRules; using OpenRA.GameRules;
using OpenRA.Traits;
namespace OpenRA.Traits namespace OpenRA.Traits
{ {
@@ -63,7 +64,14 @@ namespace OpenRA.Traits
void AddActor(Actor a) void AddActor(Actor a)
{ {
if (a.Owner == null || a.Owner != a.Owner.World.LocalPlayer) return; if (a.traits.WithInterface<IRevealShroud>().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)) if (vis.ContainsKey(a))
{ {

View File

@@ -14,7 +14,7 @@ namespace OpenRA.Mods.RA
{ {
class RevealsShroudInfo : TraitInfo<RevealsShroud> { } class RevealsShroudInfo : TraitInfo<RevealsShroud> { }
class RevealsShroud : ITick class RevealsShroud : ITick, IRevealShroud
{ {
int2 previousLocation; int2 previousLocation;