Kill any units on a bridge piece when it dies. Todo: need to mask the death regions for cnc bridges
This commit is contained in:
@@ -152,6 +152,8 @@ namespace OpenRA.Mods.RA
|
|||||||
return b != null && b.self.IsInWorld && b.self.Health > 0;
|
return b != null && b.self.IsInWorld && b.self.Health > 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool dead = false;
|
||||||
void UpdateState()
|
void UpdateState()
|
||||||
{
|
{
|
||||||
var ds = self.GetDamageState();
|
var ds = self.GetDamageState();
|
||||||
@@ -165,6 +167,15 @@ namespace OpenRA.Mods.RA
|
|||||||
ds = DamageState.Dead;
|
ds = DamageState.Dead;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (ds == DamageState.Dead && !dead)
|
||||||
|
{
|
||||||
|
dead = true;
|
||||||
|
|
||||||
|
// Kill any units on the bridge
|
||||||
|
foreach (var c in TileSprites[currentTemplate].Keys)
|
||||||
|
self.World.WorldActor.traits.Get<UnitInfluence>().GetUnitsAt(c).Do(a => a.InflictDamage(self, a.Health, null));
|
||||||
|
}
|
||||||
|
|
||||||
currentTemplate = (ds == DamageState.Half && Info.DamagedTemplate > 0) ? Info.DamagedTemplate :
|
currentTemplate = (ds == DamageState.Half && Info.DamagedTemplate > 0) ? Info.DamagedTemplate :
|
||||||
(ds == DamageState.Dead && Info.DestroyedTemplate > 0) ? Info.DestroyedTemplate : Info.Template;
|
(ds == DamageState.Dead && Info.DestroyedTemplate > 0) ? Info.DestroyedTemplate : Info.Template;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user