Add enter behaviour customisation to C4Demolition.
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();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user