From 17f7aac35c8326334a3912da6f2e8a6a5bf36c98 Mon Sep 17 00:00:00 2001 From: abcdefg30 Date: Thu, 13 Jul 2017 23:46:06 +0200 Subject: [PATCH] Add more RevealDisguiseOn types --- OpenRA.Mods.Cnc/Traits/Disguise.cs | 29 ++++++++++++++++++++++++++--- 1 file changed, 26 insertions(+), 3 deletions(-) diff --git a/OpenRA.Mods.Cnc/Traits/Disguise.cs b/OpenRA.Mods.Cnc/Traits/Disguise.cs index aa433d9266..2f331b784b 100644 --- a/OpenRA.Mods.Cnc/Traits/Disguise.cs +++ b/OpenRA.Mods.Cnc/Traits/Disguise.cs @@ -64,7 +64,10 @@ namespace OpenRA.Mods.Cnc.Traits { None = 0, Attack = 1, - Damaged = 2 + Damaged = 2, + Unload = 4, + Infiltrate = 8, + Demolish = 16 } [Desc("Provides access to the disguise command, which makes the actor appear to be another player's actor.")] @@ -76,13 +79,15 @@ namespace OpenRA.Mods.Cnc.Traits [Desc("The condition to grant to self while disguised.")] public readonly string DisguisedCondition = null; - [Desc("Triggers which cause the actor to drop it's disguise. Possible values: None, Attack, Damaged.")] + [Desc("Triggers which cause the actor to drop it's disguise. Possible values: None, Attack, Damaged,", + "Unload, Infiltrate, Demolish.")] public readonly RevealDisguiseType RevealDisguiseOn = RevealDisguiseType.Attack; public object Create(ActorInitializer init) { return new Disguise(init.Self, this); } } - class Disguise : INotifyCreated, IEffectiveOwner, IIssueOrder, IResolveOrder, IOrderVoice, IRadarColorModifier, INotifyAttack, INotifyDamage + class Disguise : INotifyCreated, IEffectiveOwner, IIssueOrder, IResolveOrder, IOrderVoice, IRadarColorModifier, INotifyAttack, + INotifyDamage, INotifyUnload, INotifyDemolition, INotifyInfiltration { public Player AsPlayer { get; private set; } public string AsSprite { get; private set; } @@ -220,5 +225,23 @@ namespace OpenRA.Mods.Cnc.Traits if (info.RevealDisguiseOn.HasFlag(RevealDisguiseType.Damaged) && e.Damage.Value > 0) DisguiseAs(null); } + + void INotifyUnload.Unloading(Actor self) + { + if (info.RevealDisguiseOn.HasFlag(RevealDisguiseType.Unload)) + DisguiseAs(null); + } + + void INotifyDemolition.Demolishing(Actor self) + { + if (info.RevealDisguiseOn.HasFlag(RevealDisguiseType.Demolish)) + DisguiseAs(null); + } + + void INotifyInfiltration.Infiltrating(Actor self) + { + if (info.RevealDisguiseOn.HasFlag(RevealDisguiseType.Infiltrate)) + DisguiseAs(null); + } } }