Refactored Health usage to IHealth.
This commit is contained in:
@@ -22,7 +22,7 @@ namespace OpenRA.Mods.Common.Activities
|
||||
readonly Building building;
|
||||
readonly Capturable capturable;
|
||||
readonly Captures[] captures;
|
||||
readonly Health health;
|
||||
readonly IHealth health;
|
||||
|
||||
public CaptureActor(Actor self, Actor target)
|
||||
: base(self, target, EnterBehaviour.Dispose)
|
||||
@@ -31,7 +31,7 @@ namespace OpenRA.Mods.Common.Activities
|
||||
building = actor.TraitOrDefault<Building>();
|
||||
captures = self.TraitsImplementing<Captures>().ToArray();
|
||||
capturable = target.Trait<Capturable>();
|
||||
health = actor.Trait<Health>();
|
||||
health = actor.Trait<IHealth>();
|
||||
}
|
||||
|
||||
protected override bool CanReserve(Actor self)
|
||||
|
||||
@@ -19,7 +19,7 @@ namespace OpenRA.Mods.Common.Activities
|
||||
{
|
||||
public class Repair : Activity
|
||||
{
|
||||
readonly Health health;
|
||||
readonly IHealth health;
|
||||
readonly RepairsUnits[] allRepairsUnits;
|
||||
readonly Target host;
|
||||
readonly WDist closeEnough;
|
||||
@@ -33,7 +33,7 @@ namespace OpenRA.Mods.Common.Activities
|
||||
this.host = Target.FromActor(host);
|
||||
this.closeEnough = closeEnough;
|
||||
allRepairsUnits = host.TraitsImplementing<RepairsUnits>().ToArray();
|
||||
health = self.TraitOrDefault<Health>();
|
||||
health = self.TraitOrDefault<IHealth>();
|
||||
repairable = self.TraitOrDefault<Repairable>();
|
||||
}
|
||||
|
||||
|
||||
@@ -17,7 +17,7 @@ namespace OpenRA.Mods.Common.Activities
|
||||
class RepairBuilding : Enter
|
||||
{
|
||||
readonly Actor target;
|
||||
readonly Health health;
|
||||
readonly IHealth health;
|
||||
readonly Stance validStances;
|
||||
|
||||
public RepairBuilding(Actor self, Actor target, EnterBehaviour enterBehaviour, Stance validStances)
|
||||
@@ -25,7 +25,7 @@ namespace OpenRA.Mods.Common.Activities
|
||||
{
|
||||
this.target = target;
|
||||
this.validStances = validStances;
|
||||
health = target.Trait<Health>();
|
||||
health = target.Trait<IHealth>();
|
||||
}
|
||||
|
||||
protected override bool CanReserve(Actor self)
|
||||
|
||||
@@ -18,7 +18,7 @@ namespace OpenRA.Mods.Common.Activities
|
||||
{
|
||||
class Sell : Activity
|
||||
{
|
||||
readonly Health health;
|
||||
readonly IHealth health;
|
||||
readonly SellableInfo sellableInfo;
|
||||
readonly PlayerResources playerResources;
|
||||
bool showTicks;
|
||||
@@ -26,7 +26,7 @@ namespace OpenRA.Mods.Common.Activities
|
||||
public Sell(Actor self, bool showTicks)
|
||||
{
|
||||
this.showTicks = showTicks;
|
||||
health = self.TraitOrDefault<Health>();
|
||||
health = self.TraitOrDefault<IHealth>();
|
||||
sellableInfo = self.Info.TraitInfo<SellableInfo>();
|
||||
playerResources = self.Owner.PlayerActor.Trait<PlayerResources>();
|
||||
IsInterruptible = false;
|
||||
|
||||
@@ -119,7 +119,7 @@ namespace OpenRA.Mods.Common.Activities
|
||||
if (Faction != null)
|
||||
init.Add(new FactionInit(Faction));
|
||||
|
||||
var health = self.TraitOrDefault<Health>();
|
||||
var health = self.TraitOrDefault<IHealth>();
|
||||
if (health != null)
|
||||
{
|
||||
// Cast to long to avoid overflow when multiplying by the health
|
||||
|
||||
Reference in New Issue
Block a user