Add DamageTypes to Demolition
This commit is contained in:
committed by
abcdefg30
parent
54c4a05062
commit
8aeec24c9b
@@ -368,7 +368,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
return damage;
|
||||
}
|
||||
|
||||
public void Demolish(Actor saboteur, int direction)
|
||||
public void Demolish(Actor saboteur, int direction, BitSet<DamageType> damageTypes)
|
||||
{
|
||||
var initialDamage = health.DamageState;
|
||||
self.World.AddFrameEndTask(w =>
|
||||
@@ -376,7 +376,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
// Use .FromPos since this actor is killed. Cannot use Target.FromActor
|
||||
info.DemolishWeaponInfo.Impact(Target.FromPos(self.CenterPosition), saboteur);
|
||||
|
||||
self.Kill(saboteur);
|
||||
self.Kill(saboteur, damageTypes);
|
||||
});
|
||||
|
||||
// Destroy adjacent spans between (including) huts
|
||||
@@ -386,7 +386,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
0 : info.RepairPropagationDelay;
|
||||
|
||||
self.World.AddFrameEndTask(w => w.Add(new DelayedAction(delay, () =>
|
||||
neighbours[direction].Demolish(saboteur, direction))));
|
||||
neighbours[direction].Demolish(saboteur, direction, damageTypes))));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using OpenRA.Effects;
|
||||
using OpenRA.Primitives;
|
||||
using OpenRA.Traits;
|
||||
|
||||
namespace OpenRA.Mods.Common.Traits
|
||||
@@ -60,6 +61,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
int demolishStep;
|
||||
int demolishDelay;
|
||||
Actor demolishSaboteur;
|
||||
BitSet<DamageType> demolishDamageTypes;
|
||||
|
||||
public BridgeHut(World world, BridgeHutInfo info)
|
||||
{
|
||||
@@ -170,7 +172,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
return true;
|
||||
}
|
||||
|
||||
void IDemolishable.Demolish(Actor self, Actor saboteur, int delay)
|
||||
void IDemolishable.Demolish(Actor self, Actor saboteur, int delay, BitSet<DamageType> damageTypes)
|
||||
{
|
||||
// TODO: Handle using ITick
|
||||
self.World.Add(new DelayedAction(delay, () =>
|
||||
@@ -188,11 +190,12 @@ namespace OpenRA.Mods.Common.Traits
|
||||
{
|
||||
demolishStep = 0;
|
||||
demolishSaboteur = saboteur;
|
||||
demolishDamageTypes = damageTypes;
|
||||
DemolishStep();
|
||||
}
|
||||
else
|
||||
foreach (var s in segments.Values)
|
||||
s.Demolish(saboteur);
|
||||
s.Demolish(saboteur, damageTypes);
|
||||
}
|
||||
}));
|
||||
}
|
||||
@@ -214,7 +217,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
|
||||
if (demolishStep < segmentLocations.Count)
|
||||
foreach (var c in segmentLocations[demolishStep])
|
||||
segments[c].Demolish(demolishSaboteur);
|
||||
segments[c].Demolish(demolishSaboteur, demolishDamageTypes);
|
||||
|
||||
demolishDelay = Info.DemolishPropagationDelay;
|
||||
|
||||
|
||||
@@ -70,7 +70,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
});
|
||||
}
|
||||
|
||||
void IBridgeSegment.Demolish(Actor saboteur)
|
||||
void IBridgeSegment.Demolish(Actor saboteur, BitSet<DamageType> damageTypes)
|
||||
{
|
||||
// Do nothing
|
||||
}
|
||||
|
||||
@@ -104,7 +104,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
health.InflictDamage(self, repairer, new Damage(-health.MaxHP), true);
|
||||
}
|
||||
|
||||
void IBridgeSegment.Demolish(Actor saboteur)
|
||||
void IBridgeSegment.Demolish(Actor saboteur, BitSet<DamageType> damageTypes)
|
||||
{
|
||||
self.World.AddFrameEndTask(w =>
|
||||
{
|
||||
@@ -114,7 +114,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
// Use .FromPos since this actor is dead. Cannot use Target.FromActor
|
||||
Info.DemolishWeaponInfo.Impact(Target.FromPos(self.CenterPosition), saboteur);
|
||||
|
||||
self.Kill(saboteur);
|
||||
self.Kill(saboteur, damageTypes);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
|
||||
using System.Linq;
|
||||
using OpenRA.Effects;
|
||||
using OpenRA.Primitives;
|
||||
using OpenRA.Traits;
|
||||
|
||||
namespace OpenRA.Mods.Common.Traits
|
||||
@@ -53,7 +54,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
return BridgeDamageState != DamageState.Dead;
|
||||
}
|
||||
|
||||
void IDemolishable.Demolish(Actor self, Actor saboteur, int delay)
|
||||
void IDemolishable.Demolish(Actor self, Actor saboteur, int delay, BitSet<DamageType> damageTypes)
|
||||
{
|
||||
// TODO: Handle using ITick
|
||||
self.World.Add(new DelayedAction(delay, () =>
|
||||
@@ -66,7 +67,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
.Select(t => t.GetDamageModifier(self, null));
|
||||
|
||||
if (Util.ApplyPercentageModifiers(100, modifiers) > 0)
|
||||
Bridge.Do((b, d) => b.Demolish(saboteur, d));
|
||||
Bridge.Do((b, d) => b.Demolish(saboteur, d, damageTypes));
|
||||
}));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user