Refactored Health usage to IHealth.

This commit is contained in:
Andre Mohren
2018-09-27 02:02:08 +02:00
committed by reaperrr
parent 83cd7cf485
commit 640078a2b1
30 changed files with 68 additions and 61 deletions

View File

@@ -18,7 +18,7 @@ using OpenRA.Traits;
namespace OpenRA.Mods.Common.Traits
{
[Desc("Bridge actor that can't be passed underneath.")]
class GroundLevelBridgeInfo : ITraitInfo, IRulesetLoaded, Requires<BuildingInfo>, Requires<HealthInfo>
class GroundLevelBridgeInfo : ITraitInfo, IRulesetLoaded, Requires<BuildingInfo>, Requires<IHealthInfo>
{
public readonly string TerrainType = "Bridge";
@@ -53,13 +53,13 @@ namespace OpenRA.Mods.Common.Traits
readonly Actor self;
readonly BridgeLayer bridgeLayer;
readonly IEnumerable<CPos> cells;
readonly Health health;
readonly IHealth health;
public GroundLevelBridge(Actor self, GroundLevelBridgeInfo info)
{
Info = info;
this.self = self;
health = self.Trait<Health>();
health = self.Trait<IHealth>();
bridgeLayer = self.World.WorldActor.Trait<BridgeLayer>();
var buildingInfo = self.Info.TraitInfo<BuildingInfo>();

View File

@@ -18,7 +18,7 @@ using OpenRA.Traits;
namespace OpenRA.Mods.Common.Traits
{
[Desc("Building can be repaired by the repair button.")]
public class RepairableBuildingInfo : ConditionalTraitInfo, Requires<HealthInfo>
public class RepairableBuildingInfo : ConditionalTraitInfo, Requires<IHealthInfo>
{
[Desc("Cost to fully repair the actor as a percent of its value.")]
public readonly int RepairPercent = 20;
@@ -51,7 +51,7 @@ namespace OpenRA.Mods.Common.Traits
public class RepairableBuilding : ConditionalTrait<RepairableBuildingInfo>, ITick
{
readonly Health health;
readonly IHealth health;
readonly Predicate<Player> isNotActiveAlly;
readonly Stack<int> repairTokens = new Stack<int>();
ConditionManager conditionManager;
@@ -63,7 +63,7 @@ namespace OpenRA.Mods.Common.Traits
public RepairableBuilding(Actor self, RepairableBuildingInfo info)
: base(info)
{
health = self.Trait<Health>();
health = self.Trait<IHealth>();
isNotActiveAlly = player => player.WinState != WinState.Undefined || player.Stances[self.Owner] != Stance.Ally;
}