Merge pull request #7138 from DavidARussell/bleed
Applys decloak to units activating a C4 demolition or infiltrate ability
This commit is contained in:
1
AUTHORS
1
AUTHORS
@@ -37,6 +37,7 @@ Also thanks to:
|
|||||||
* D2k Sardaukar
|
* D2k Sardaukar
|
||||||
* Daniel Derejvanik (Harisson)
|
* Daniel Derejvanik (Harisson)
|
||||||
* Danny Keary (Dan9550)
|
* Danny Keary (Dan9550)
|
||||||
|
* David Russell (DavidARussell)
|
||||||
* DeadlySurprise
|
* DeadlySurprise
|
||||||
* Erasmus Schroder (rasco)
|
* Erasmus Schroder (rasco)
|
||||||
* Eric Bajumpaa (SteelPhase)
|
* Eric Bajumpaa (SteelPhase)
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ using System.Linq;
|
|||||||
using OpenRA.Activities;
|
using OpenRA.Activities;
|
||||||
using OpenRA.Effects;
|
using OpenRA.Effects;
|
||||||
using OpenRA.Traits;
|
using OpenRA.Traits;
|
||||||
|
using OpenRA.Mods.RA.Traits;
|
||||||
|
|
||||||
namespace OpenRA.Mods.RA.Activities
|
namespace OpenRA.Mods.RA.Activities
|
||||||
{
|
{
|
||||||
@@ -26,6 +27,8 @@ namespace OpenRA.Mods.RA.Activities
|
|||||||
readonly int flashInterval;
|
readonly int flashInterval;
|
||||||
readonly int flashDuration;
|
readonly int flashDuration;
|
||||||
|
|
||||||
|
readonly Cloak cloak;
|
||||||
|
|
||||||
public Demolish(Actor self, Actor target, int delay, int flashes, int flashesDelay, int flashInterval, int flashDuration)
|
public Demolish(Actor self, Actor target, int delay, int flashes, int flashesDelay, int flashInterval, int flashDuration)
|
||||||
: base(self, target)
|
: base(self, target)
|
||||||
{
|
{
|
||||||
@@ -36,6 +39,7 @@ namespace OpenRA.Mods.RA.Activities
|
|||||||
this.flashesDelay = flashesDelay;
|
this.flashesDelay = flashesDelay;
|
||||||
this.flashInterval = flashInterval;
|
this.flashInterval = flashInterval;
|
||||||
this.flashDuration = flashDuration;
|
this.flashDuration = flashDuration;
|
||||||
|
cloak = self.TraitOrDefault<Cloak>();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override bool CanReserve(Actor self)
|
protected override bool CanReserve(Actor self)
|
||||||
@@ -50,6 +54,9 @@ namespace OpenRA.Mods.RA.Activities
|
|||||||
if (target.IsDead)
|
if (target.IsDead)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
if (cloak != null && cloak.Info.UncloakOnDemolish)
|
||||||
|
cloak.Uncloak();
|
||||||
|
|
||||||
for (var f = 0; f < flashes; f++)
|
for (var f = 0; f < flashes; f++)
|
||||||
w.Add(new DelayedAction(flashesDelay + f * flashInterval, () =>
|
w.Add(new DelayedAction(flashesDelay + f * flashInterval, () =>
|
||||||
w.Add(new FlashTarget(target, ticks: flashDuration))));
|
w.Add(new FlashTarget(target, ticks: flashDuration))));
|
||||||
|
|||||||
@@ -11,16 +11,22 @@
|
|||||||
using OpenRA.Activities;
|
using OpenRA.Activities;
|
||||||
using OpenRA.Mods.RA.Buildings;
|
using OpenRA.Mods.RA.Buildings;
|
||||||
using OpenRA.Traits;
|
using OpenRA.Traits;
|
||||||
|
using OpenRA.Mods.RA.Traits;
|
||||||
|
|
||||||
namespace OpenRA.Mods.RA.Activities
|
namespace OpenRA.Mods.RA.Activities
|
||||||
{
|
{
|
||||||
class Infiltrate : Enter
|
class Infiltrate : Enter
|
||||||
{
|
{
|
||||||
readonly Actor target;
|
readonly Actor target;
|
||||||
|
|
||||||
|
readonly Cloak cloak;
|
||||||
|
|
||||||
public Infiltrate(Actor self, Actor target)
|
public Infiltrate(Actor self, Actor target)
|
||||||
: base(self, target)
|
: base(self, target)
|
||||||
{
|
{
|
||||||
this.target = target;
|
this.target = target;
|
||||||
|
|
||||||
|
cloak = self.TraitOrDefault<Cloak>();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void OnInside(Actor self)
|
protected override void OnInside(Actor self)
|
||||||
@@ -28,6 +34,9 @@ namespace OpenRA.Mods.RA.Activities
|
|||||||
if (target.IsDead || target.Owner == self.Owner)
|
if (target.IsDead || target.Owner == self.Owner)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
if (cloak != null && cloak.Info.UncloakOnInfiltrate)
|
||||||
|
cloak.Uncloak();
|
||||||
|
|
||||||
foreach (var t in target.TraitsImplementing<INotifyInfiltrated>())
|
foreach (var t in target.TraitsImplementing<INotifyInfiltrated>())
|
||||||
t.Infiltrated(target, self);
|
t.Infiltrated(target, self);
|
||||||
|
|
||||||
|
|||||||
@@ -30,6 +30,8 @@ namespace OpenRA.Mods.RA.Traits
|
|||||||
public readonly bool UncloakOnAttack = true;
|
public readonly bool UncloakOnAttack = true;
|
||||||
public readonly bool UncloakOnMove = false;
|
public readonly bool UncloakOnMove = false;
|
||||||
public readonly bool UncloakOnUnload = true;
|
public readonly bool UncloakOnUnload = true;
|
||||||
|
public readonly bool UncloakOnInfiltrate = true;
|
||||||
|
public readonly bool UncloakOnDemolish = true;
|
||||||
|
|
||||||
public readonly string CloakSound = null;
|
public readonly string CloakSound = null;
|
||||||
public readonly string UncloakSound = null;
|
public readonly string UncloakSound = null;
|
||||||
|
|||||||
Reference in New Issue
Block a user