Make RevealsShroud and CreatesShroud use stances
Instead of hardcoded (!)IsAlliedWith checks.
This commit is contained in:
@@ -9,21 +9,30 @@
|
|||||||
*/
|
*/
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
using OpenRA.Traits;
|
||||||
|
|
||||||
namespace OpenRA.Mods.Common.Traits
|
namespace OpenRA.Mods.Common.Traits
|
||||||
{
|
{
|
||||||
public class CreatesShroudInfo : AffectsShroudInfo
|
public class CreatesShroudInfo : AffectsShroudInfo
|
||||||
{
|
{
|
||||||
|
[Desc("Stance the watching player needs to see the generated shroud.")]
|
||||||
|
public readonly Stance ValidStances = Stance.Neutral | Stance.Enemy;
|
||||||
|
|
||||||
public override object Create(ActorInitializer init) { return new CreatesShroud(init.Self, this); }
|
public override object Create(ActorInitializer init) { return new CreatesShroud(init.Self, this); }
|
||||||
}
|
}
|
||||||
|
|
||||||
public class CreatesShroud : AffectsShroud
|
public class CreatesShroud : AffectsShroud
|
||||||
{
|
{
|
||||||
|
readonly CreatesShroudInfo info;
|
||||||
|
|
||||||
public CreatesShroud(Actor self, CreatesShroudInfo info)
|
public CreatesShroud(Actor self, CreatesShroudInfo info)
|
||||||
: base(self, info) { }
|
: base(self, info) { this.info = info; }
|
||||||
|
|
||||||
protected override void AddCellsToPlayerShroud(Actor self, Player p, PPos[] uv)
|
protected override void AddCellsToPlayerShroud(Actor self, Player p, PPos[] uv)
|
||||||
{
|
{
|
||||||
if (!self.Owner.IsAlliedWith(p))
|
if (!info.ValidStances.HasStance(p.Stances[self.Owner]))
|
||||||
|
return;
|
||||||
|
|
||||||
p.Shroud.AddProjectedShroudGeneration(this, uv);
|
p.Shroud.AddProjectedShroudGeneration(this, uv);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -9,21 +9,30 @@
|
|||||||
*/
|
*/
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
using OpenRA.Traits;
|
||||||
|
|
||||||
namespace OpenRA.Mods.Common.Traits
|
namespace OpenRA.Mods.Common.Traits
|
||||||
{
|
{
|
||||||
public class RevealsShroudInfo : AffectsShroudInfo
|
public class RevealsShroudInfo : AffectsShroudInfo
|
||||||
{
|
{
|
||||||
|
[Desc("Stance the watching player needs to see the shroud removed.")]
|
||||||
|
public readonly Stance ValidStances = Stance.Ally;
|
||||||
|
|
||||||
public override object Create(ActorInitializer init) { return new RevealsShroud(init.Self, this); }
|
public override object Create(ActorInitializer init) { return new RevealsShroud(init.Self, this); }
|
||||||
}
|
}
|
||||||
|
|
||||||
public class RevealsShroud : AffectsShroud
|
public class RevealsShroud : AffectsShroud
|
||||||
{
|
{
|
||||||
|
readonly RevealsShroudInfo info;
|
||||||
|
|
||||||
public RevealsShroud(Actor self, RevealsShroudInfo info)
|
public RevealsShroud(Actor self, RevealsShroudInfo info)
|
||||||
: base(self, info) { }
|
: base(self, info) { this.info = info; }
|
||||||
|
|
||||||
protected override void AddCellsToPlayerShroud(Actor self, Player p, PPos[] uv)
|
protected override void AddCellsToPlayerShroud(Actor self, Player p, PPos[] uv)
|
||||||
{
|
{
|
||||||
if (self.Owner.IsAlliedWith(p))
|
if (!info.ValidStances.HasStance(p.Stances[self.Owner]))
|
||||||
|
return;
|
||||||
|
|
||||||
p.Shroud.AddProjectedVisibility(this, uv);
|
p.Shroud.AddProjectedVisibility(this, uv);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user