Make RepairsUnits pausable-conditional
This commit is contained in:
@@ -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) { }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -222,6 +222,7 @@ NAHPAD:
|
||||
PrimaryCondition: primary
|
||||
Reservable:
|
||||
RepairsUnits:
|
||||
PauseOnCondition: empdisable
|
||||
PlayerExperience: 15
|
||||
ProductionBar:
|
||||
WithIdleOverlay@PLATFORM:
|
||||
|
||||
Reference in New Issue
Block a user