HealUnitsCrateAction.Activate() use ActorsWithTrait<Health>()
This commit is contained in:
@@ -26,12 +26,9 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
|
|
||||||
public override void Activate(Actor collector)
|
public override void Activate(Actor collector)
|
||||||
{
|
{
|
||||||
foreach (var unit in collector.World.Actors.Where(a => a.Owner == collector.Owner))
|
foreach (var healable in collector.World.ActorsWithTrait<Health>().Where(tp => tp.Actor.Owner == collector.Owner))
|
||||||
{
|
if (!healable.Trait.IsDead)
|
||||||
var health = unit.TraitOrDefault<Health>();
|
healable.Trait.InflictDamage(healable.Actor, healable.Actor, -(healable.Trait.MaxHP - healable.Trait.HP), null, true);
|
||||||
if (health != null && !health.IsDead)
|
|
||||||
health.InflictDamage(unit, unit, -(health.MaxHP - health.HP), null, true);
|
|
||||||
}
|
|
||||||
|
|
||||||
base.Activate(collector);
|
base.Activate(collector);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user