Merge pull request #10092 from pchote/saboteur-suicide
Implement suicide bomb for D2K Saboteur
This commit is contained in:
@@ -20,6 +20,7 @@ namespace OpenRA.Mods.Common.Activities
|
||||
{
|
||||
readonly Actor target;
|
||||
readonly IDemolishable[] demolishables;
|
||||
readonly EnterBehaviour enterBehaviour;
|
||||
readonly int delay;
|
||||
readonly int flashes;
|
||||
readonly int flashesDelay;
|
||||
@@ -28,11 +29,13 @@ namespace OpenRA.Mods.Common.Activities
|
||||
|
||||
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, EnterBehaviour enterBehaviour, int delay,
|
||||
int flashes, int flashesDelay, int flashInterval, int flashDuration)
|
||||
: base(self, target)
|
||||
{
|
||||
this.target = target;
|
||||
demolishables = target.TraitsImplementing<IDemolishable>().ToArray();
|
||||
this.enterBehaviour = enterBehaviour;
|
||||
this.delay = delay;
|
||||
this.flashes = flashes;
|
||||
this.flashesDelay = flashesDelay;
|
||||
@@ -72,6 +75,11 @@ namespace OpenRA.Mods.Common.Activities
|
||||
if (Util.ApplyPercentageModifiers(100, modifiers) > 0)
|
||||
demolishables.Do(d => d.Demolish(target, self));
|
||||
}));
|
||||
|
||||
if (enterBehaviour == EnterBehaviour.Suicide)
|
||||
self.Kill(self);
|
||||
else if (enterBehaviour == EnterBehaviour.Dispose)
|
||||
self.Dispose();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,6 +15,8 @@ using OpenRA.Traits;
|
||||
|
||||
namespace OpenRA.Mods.Common.Activities
|
||||
{
|
||||
public enum EnterBehaviour { Exit, Suicide, Dispose }
|
||||
|
||||
public abstract class Enter : Activity
|
||||
{
|
||||
public enum ReserveStatus { None, TooFar, Pending, Ready }
|
||||
|
||||
@@ -34,8 +34,8 @@ namespace OpenRA.Mods.Common.Scripting
|
||||
[Desc("Demolish the target actor.")]
|
||||
public void Demolish(Actor target)
|
||||
{
|
||||
Self.QueueActivity(new Demolish(Self, target, info.C4Delay, info.Flashes,
|
||||
info.FlashesDelay, info.FlashInterval, info.FlashDuration));
|
||||
Self.QueueActivity(new Demolish(Self, target, info.EnterBehaviour, info.C4Delay,
|
||||
info.Flashes, info.FlashesDelay, info.FlashInterval, info.FlashDuration));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,18 +23,22 @@ namespace OpenRA.Mods.Common.Traits
|
||||
"Measured in game ticks. Default is 1.8 seconds.")]
|
||||
public readonly int C4Delay = 45;
|
||||
|
||||
[Desc("Number of times to flash the target")]
|
||||
[Desc("Number of times to flash the target.")]
|
||||
public readonly int Flashes = 3;
|
||||
|
||||
[Desc("Delay before the flashing starts")]
|
||||
[Desc("Delay before the flashing starts.")]
|
||||
public readonly int FlashesDelay = 4;
|
||||
|
||||
[Desc("Interval between each flash")]
|
||||
[Desc("Interval between each flash.")]
|
||||
public readonly int FlashInterval = 4;
|
||||
|
||||
[Desc("Duration of each flash")]
|
||||
[Desc("Duration of each flash.")]
|
||||
public readonly int FlashDuration = 3;
|
||||
|
||||
[Desc("Behaviour when entering the structure.",
|
||||
"Possible values are Exit, Suicide, Dispose.")]
|
||||
public readonly EnterBehaviour EnterBehaviour = EnterBehaviour.Exit;
|
||||
|
||||
[Desc("Voice string when planting explosive charges.")]
|
||||
[VoiceReference] public readonly string Voice = "Action";
|
||||
|
||||
@@ -83,8 +87,8 @@ namespace OpenRA.Mods.Common.Traits
|
||||
self.CancelActivity();
|
||||
|
||||
self.SetTargetLine(target, Color.Red);
|
||||
self.QueueActivity(new Demolish(self,
|
||||
target.Actor, info.C4Delay, info.Flashes, info.FlashesDelay, info.FlashInterval, info.FlashDuration));
|
||||
self.QueueActivity(new Demolish(self, target.Actor, info.EnterBehaviour, info.C4Delay,
|
||||
info.Flashes, info.FlashesDelay, info.FlashInterval, info.FlashDuration));
|
||||
}
|
||||
|
||||
public string VoicePhraseForOrder(Actor self, Order order)
|
||||
|
||||
@@ -243,7 +243,9 @@ saboteur:
|
||||
Mobile:
|
||||
Speed: 43
|
||||
C4Demolition:
|
||||
C4Delay: 45
|
||||
C4Delay: 0
|
||||
Flashes: 0
|
||||
EnterBehaviour: Suicide
|
||||
-AutoTarget:
|
||||
Cloak:
|
||||
InitialDelay: 85
|
||||
|
||||
Reference in New Issue
Block a user