Make RepairsUnits pausable-conditional

This commit is contained in:
atlimit8
2017-03-11 12:42:36 -06:00
parent 748afad45e
commit 6075569659
4 changed files with 11 additions and 5 deletions

View File

@@ -9,11 +9,9 @@
*/
#endregion
using OpenRA.Traits;
namespace OpenRA.Mods.Common.Traits
{
public class RepairsUnitsInfo : TraitInfo<RepairsUnits>
public class RepairsUnitsInfo : PausableConditionalTraitInfo
{
[Desc("Cost in % of the unit value to fully repair the unit.")]
public readonly int ValuePercentage = 20;
@@ -30,7 +28,12 @@ namespace OpenRA.Mods.Common.Traits
[Desc("Experience gained by the player owning this actor for repairing an allied unit.")]
public readonly int PlayerExperience = 0;
public override object Create(ActorInitializer init) { return new RepairsUnits(this); }
}
public class RepairsUnits { }
public class RepairsUnits : PausableConditionalTrait<RepairsUnitsInfo>
{
public RepairsUnits(RepairsUnitsInfo info) : base(info) { }
}
}

View File

@@ -105,7 +105,7 @@ namespace OpenRA.Mods.Common.Traits
void AfterReachActivities(Actor self, Order order, IMove movement)
{
if (!order.TargetActor.IsInWorld || order.TargetActor.IsDead || order.TargetActor.IsDisabled())
if (!order.TargetActor.IsInWorld || order.TargetActor.IsDead || order.TargetActor.TraitsImplementing<RepairsUnits>().All(r => r.IsTraitDisabled))
return;
// TODO: This is hacky, but almost every single component affected

View File

@@ -211,6 +211,7 @@ GAHPAD:
PrimaryCondition: primary
Reservable:
RepairsUnits:
PauseOnCondition: empdisable
PlayerExperience: 15
ProductionBar:
WithIdleOverlay@PLATFORM:
@@ -258,6 +259,7 @@ GADEPT:
MaxHeightDelta: 3
Reservable:
RepairsUnits:
PauseOnCondition: empdisable
PlayerExperience: 15
RallyPoint:
Palette: mouse

View File

@@ -222,6 +222,7 @@ NAHPAD:
PrimaryCondition: primary
Reservable:
RepairsUnits:
PauseOnCondition: empdisable
PlayerExperience: 15
ProductionBar:
WithIdleOverlay@PLATFORM: