Give EngineerRepair(able) more generic names
This commit is contained in:
committed by
abcdefg30
parent
9b2e291a46
commit
f67b6f6cad
@@ -14,15 +14,15 @@ using OpenRA.Traits;
|
|||||||
|
|
||||||
namespace OpenRA.Mods.Common.Activities
|
namespace OpenRA.Mods.Common.Activities
|
||||||
{
|
{
|
||||||
class RepairBuilding : Enter
|
class InstantRepair : Enter
|
||||||
{
|
{
|
||||||
readonly EngineerRepairInfo info;
|
readonly InstantlyRepairsInfo info;
|
||||||
|
|
||||||
Actor enterActor;
|
Actor enterActor;
|
||||||
IHealth enterHealth;
|
IHealth enterHealth;
|
||||||
EngineerRepairable enterEngineerRepariable;
|
InstantlyRepairable enterInstantlyRepariable;
|
||||||
|
|
||||||
public RepairBuilding(Actor self, in Target target, EngineerRepairInfo info)
|
public InstantRepair(Actor self, in Target target, InstantlyRepairsInfo info)
|
||||||
: base(self, target, info.TargetLineColor)
|
: base(self, target, info.TargetLineColor)
|
||||||
{
|
{
|
||||||
this.info = info;
|
this.info = info;
|
||||||
@@ -32,12 +32,12 @@ namespace OpenRA.Mods.Common.Activities
|
|||||||
{
|
{
|
||||||
enterActor = targetActor;
|
enterActor = targetActor;
|
||||||
enterHealth = targetActor.TraitOrDefault<IHealth>();
|
enterHealth = targetActor.TraitOrDefault<IHealth>();
|
||||||
enterEngineerRepariable = targetActor.TraitOrDefault<EngineerRepairable>();
|
enterInstantlyRepariable = targetActor.TraitOrDefault<InstantlyRepairable>();
|
||||||
|
|
||||||
// Make sure we can still repair the target before entering
|
// Make sure we can still repair the target before entering
|
||||||
// (but not before, because this may stop the actor in the middle of nowhere)
|
// (but not before, because this may stop the actor in the middle of nowhere)
|
||||||
var stance = self.Owner.RelationshipWith(enterActor.Owner);
|
var stance = self.Owner.RelationshipWith(enterActor.Owner);
|
||||||
if (enterHealth == null || enterHealth.DamageState == DamageState.Undamaged || enterEngineerRepariable == null || enterEngineerRepariable.IsTraitDisabled || !info.ValidRelationships.HasRelationship(stance))
|
if (enterHealth == null || enterHealth.DamageState == DamageState.Undamaged || enterInstantlyRepariable == null || enterInstantlyRepariable.IsTraitDisabled || !info.ValidRelationships.HasRelationship(stance))
|
||||||
{
|
{
|
||||||
Cancel(self, true);
|
Cancel(self, true);
|
||||||
return false;
|
return false;
|
||||||
@@ -53,7 +53,7 @@ namespace OpenRA.Mods.Common.Activities
|
|||||||
if (targetActor != enterActor)
|
if (targetActor != enterActor)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (enterEngineerRepariable.IsTraitDisabled)
|
if (enterInstantlyRepariable.IsTraitDisabled)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (enterHealth.DamageState == DamageState.Undamaged)
|
if (enterHealth.DamageState == DamageState.Undamaged)
|
||||||
@@ -13,20 +13,20 @@ using OpenRA.Primitives;
|
|||||||
|
|
||||||
namespace OpenRA.Mods.Common.Traits
|
namespace OpenRA.Mods.Common.Traits
|
||||||
{
|
{
|
||||||
public class EngineerRepairType { }
|
public class InstantlyRepairType { }
|
||||||
|
|
||||||
[Desc("Eligible for instant repair.")]
|
[Desc("Eligible for instant repair.")]
|
||||||
public class EngineerRepairableInfo : ConditionalTraitInfo
|
public class InstantlyRepairableInfo : ConditionalTraitInfo
|
||||||
{
|
{
|
||||||
[Desc("Actors with these Types under EngineerRepair trait can repair me.")]
|
[Desc("Actors with these Types under EngineerRepair trait can repair me.")]
|
||||||
public readonly BitSet<EngineerRepairType> Types = default;
|
public readonly BitSet<InstantlyRepairType> Types = default;
|
||||||
|
|
||||||
public override object Create(ActorInitializer init) { return new EngineerRepairable(this); }
|
public override object Create(ActorInitializer init) { return new InstantlyRepairable(this); }
|
||||||
}
|
}
|
||||||
|
|
||||||
public class EngineerRepairable : ConditionalTrait<EngineerRepairableInfo>
|
public class InstantlyRepairable : ConditionalTrait<InstantlyRepairableInfo>
|
||||||
{
|
{
|
||||||
public EngineerRepairable(EngineerRepairableInfo info)
|
public InstantlyRepairable(InstantlyRepairableInfo info)
|
||||||
: base(info) { }
|
: base(info) { }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -18,10 +18,10 @@ using OpenRA.Traits;
|
|||||||
namespace OpenRA.Mods.Common.Traits
|
namespace OpenRA.Mods.Common.Traits
|
||||||
{
|
{
|
||||||
[Desc("Can instantly repair other actors, but gets consumed afterwards.")]
|
[Desc("Can instantly repair other actors, but gets consumed afterwards.")]
|
||||||
public class EngineerRepairInfo : ConditionalTraitInfo
|
public class InstantlyRepairsInfo : ConditionalTraitInfo
|
||||||
{
|
{
|
||||||
[Desc("Uses the \"EngineerRepairable\" trait to determine repairability.")]
|
[Desc("Uses the " + nameof(InstantlyRepairable) + " trait to determine repairability.")]
|
||||||
public readonly BitSet<EngineerRepairType> Types = default;
|
public readonly BitSet<InstantlyRepairType> Types = default;
|
||||||
|
|
||||||
[VoiceReference]
|
[VoiceReference]
|
||||||
public readonly string Voice = "Action";
|
public readonly string Voice = "Action";
|
||||||
@@ -47,12 +47,12 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
[Desc("Cursor to display when target actor has full health so it can't be repaired.")]
|
[Desc("Cursor to display when target actor has full health so it can't be repaired.")]
|
||||||
public readonly string RepairBlockedCursor = "goldwrench-blocked";
|
public readonly string RepairBlockedCursor = "goldwrench-blocked";
|
||||||
|
|
||||||
public override object Create(ActorInitializer init) { return new EngineerRepair(this); }
|
public override object Create(ActorInitializer init) { return new InstantlyRepairs(this); }
|
||||||
}
|
}
|
||||||
|
|
||||||
public class EngineerRepair : ConditionalTrait<EngineerRepairInfo>, IIssueOrder, IResolveOrder, IOrderVoice
|
public class InstantlyRepairs : ConditionalTrait<InstantlyRepairsInfo>, IIssueOrder, IResolveOrder, IOrderVoice
|
||||||
{
|
{
|
||||||
public EngineerRepair(EngineerRepairInfo info)
|
public InstantlyRepairs(InstantlyRepairsInfo info)
|
||||||
: base(info) { }
|
: base(info) { }
|
||||||
|
|
||||||
public IEnumerable<IOrderTargeter> Orders
|
public IEnumerable<IOrderTargeter> Orders
|
||||||
@@ -62,13 +62,13 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
if (IsTraitDisabled)
|
if (IsTraitDisabled)
|
||||||
yield break;
|
yield break;
|
||||||
|
|
||||||
yield return new EngineerRepairOrderTargeter(Info);
|
yield return new InstantRepairOrderTargeter(Info);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public Order IssueOrder(Actor self, IOrderTargeter order, in Target target, bool queued)
|
public Order IssueOrder(Actor self, IOrderTargeter order, in Target target, bool queued)
|
||||||
{
|
{
|
||||||
if (order.OrderID != "EngineerRepair")
|
if (order.OrderID != "InstantRepair")
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
return new Order(order.OrderID, self, target, queued);
|
return new Order(order.OrderID, self, target, queued);
|
||||||
@@ -87,36 +87,36 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
|
|
||||||
public string VoicePhraseForOrder(Actor self, Order order)
|
public string VoicePhraseForOrder(Actor self, Order order)
|
||||||
{
|
{
|
||||||
return order.OrderString == "EngineerRepair" && IsValidOrder(order)
|
return order.OrderString == "InstantRepair" && IsValidOrder(order)
|
||||||
? Info.Voice : null;
|
? Info.Voice : null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void ResolveOrder(Actor self, Order order)
|
public void ResolveOrder(Actor self, Order order)
|
||||||
{
|
{
|
||||||
if (order.OrderString != "EngineerRepair" || !IsValidOrder(order))
|
if (order.OrderString != "InstantRepair" || !IsValidOrder(order))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
self.QueueActivity(order.Queued, new RepairBuilding(self, order.Target, Info));
|
self.QueueActivity(order.Queued, new InstantRepair(self, order.Target, Info));
|
||||||
self.ShowTargetLines();
|
self.ShowTargetLines();
|
||||||
}
|
}
|
||||||
|
|
||||||
class EngineerRepairOrderTargeter : UnitOrderTargeter
|
class InstantRepairOrderTargeter : UnitOrderTargeter
|
||||||
{
|
{
|
||||||
readonly EngineerRepairInfo info;
|
readonly InstantlyRepairsInfo info;
|
||||||
|
|
||||||
public EngineerRepairOrderTargeter(EngineerRepairInfo info)
|
public InstantRepairOrderTargeter(InstantlyRepairsInfo info)
|
||||||
: base("EngineerRepair", 6, info.Cursor, true, true)
|
: base("InstantRepair", 6, info.Cursor, true, true)
|
||||||
{
|
{
|
||||||
this.info = info;
|
this.info = info;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override bool CanTargetActor(Actor self, Actor target, TargetModifiers modifiers, ref string cursor)
|
public override bool CanTargetActor(Actor self, Actor target, TargetModifiers modifiers, ref string cursor)
|
||||||
{
|
{
|
||||||
var engineerRepairable = target.TraitOrDefault<EngineerRepairable>();
|
var instantlyRepairable = target.TraitOrDefault<InstantlyRepairable>();
|
||||||
if (engineerRepairable == null || engineerRepairable.IsTraitDisabled)
|
if (instantlyRepairable == null || instantlyRepairable.IsTraitDisabled)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (!engineerRepairable.Info.Types.IsEmpty && !engineerRepairable.Info.Types.Overlaps(info.Types))
|
if (!instantlyRepairable.Info.Types.IsEmpty && !instantlyRepairable.Info.Types.Overlaps(info.Types))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (!info.ValidRelationships.HasRelationship(target.Owner.RelationshipWith(self.Owner)))
|
if (!info.ValidRelationships.HasRelationship(target.Owner.RelationshipWith(self.Owner)))
|
||||||
@@ -131,14 +131,14 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
public override bool CanTargetFrozenActor(Actor self, FrozenActor target, TargetModifiers modifiers, ref string cursor)
|
public override bool CanTargetFrozenActor(Actor self, FrozenActor target, TargetModifiers modifiers, ref string cursor)
|
||||||
{
|
{
|
||||||
// TODO: FrozenActors don't yet have a way of caching conditions, so we can't filter disabled traits
|
// TODO: FrozenActors don't yet have a way of caching conditions, so we can't filter disabled traits
|
||||||
// This therefore assumes that all EngineerRepairable traits are enabled, which is probably wrong.
|
// This therefore assumes that all InstantlyRepairable traits are enabled, which is probably wrong.
|
||||||
// Actors with FrozenUnderFog should therefore not disable the EngineerRepairable trait if
|
// Actors with FrozenUnderFog should therefore not disable the InstantlyRepairable trait if
|
||||||
// ValidStances includes Enemy actors.
|
// ValidStances includes Enemy actors.
|
||||||
var engineerRepairable = target.Info.TraitInfoOrDefault<EngineerRepairableInfo>();
|
var instantlyRepairable = target.Info.TraitInfoOrDefault<InstantlyRepairableInfo>();
|
||||||
if (engineerRepairable == null)
|
if (instantlyRepairable == null)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (!engineerRepairable.Types.IsEmpty && !engineerRepairable.Types.Overlaps(info.Types))
|
if (!instantlyRepairable.Types.IsEmpty && !instantlyRepairable.Types.Overlaps(info.Types))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (!info.ValidRelationships.HasRelationship(target.Owner.RelationshipWith(self.Owner)))
|
if (!info.ValidRelationships.HasRelationship(target.Owner.RelationshipWith(self.Owner)))
|
||||||
@@ -0,0 +1,31 @@
|
|||||||
|
#region Copyright & License Information
|
||||||
|
/*
|
||||||
|
* Copyright (c) The OpenRA Developers and Contributors
|
||||||
|
* This file is part of OpenRA, which is free software. It is made
|
||||||
|
* available to you under the terms of the GNU General Public License
|
||||||
|
* as published by the Free Software Foundation, either version 3 of
|
||||||
|
* the License, or (at your option) any later version. For more
|
||||||
|
* information, see COPYING.
|
||||||
|
*/
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
|
namespace OpenRA.Mods.Common.UpdateRules.Rules
|
||||||
|
{
|
||||||
|
public class RenameEngineerRepair : UpdateRule
|
||||||
|
{
|
||||||
|
public override string Name => "Traits revolving around instant (building) repairs were renamed.";
|
||||||
|
|
||||||
|
public override string Description =>
|
||||||
|
"'EngineerRepair' was renamed to 'InstantlyRepairs' " +
|
||||||
|
"and 'EngineerRepairable' to 'InstantlyRepairable'.";
|
||||||
|
|
||||||
|
public override IEnumerable<string> UpdateActorNode(ModData modData, MiniYamlNode actorNode)
|
||||||
|
{
|
||||||
|
actorNode.RenameChildrenMatching("EngineerRepair", "InstantlyRepairs");
|
||||||
|
actorNode.RenameChildrenMatching("EngineerRepairable", "InstantlyRepairable");
|
||||||
|
yield break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -104,6 +104,7 @@ namespace OpenRA.Mods.Common.UpdateRules
|
|||||||
{
|
{
|
||||||
new TextNotificationsDisplayWidgetRemoveTime(),
|
new TextNotificationsDisplayWidgetRemoveTime(),
|
||||||
new ExplicitSequenceFilenames(),
|
new ExplicitSequenceFilenames(),
|
||||||
|
new RenameEngineerRepair(),
|
||||||
})
|
})
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -745,7 +745,7 @@
|
|||||||
SpawnActorsOnSell:
|
SpawnActorsOnSell:
|
||||||
ActorTypes: e6,e1,e1,e1
|
ActorTypes: e6,e1,e1,e1
|
||||||
GuaranteedActorTypes: e1
|
GuaranteedActorTypes: e1
|
||||||
EngineerRepairable:
|
InstantlyRepairable:
|
||||||
Demolishable:
|
Demolishable:
|
||||||
Condition: being-demolished
|
Condition: being-demolished
|
||||||
Sellable:
|
Sellable:
|
||||||
@@ -806,7 +806,7 @@
|
|||||||
RepairStep: 1400
|
RepairStep: 1400
|
||||||
PlayerExperience: 5
|
PlayerExperience: 5
|
||||||
RepairingNotification: Repairing
|
RepairingNotification: Repairing
|
||||||
EngineerRepairable:
|
InstantlyRepairable:
|
||||||
RevealsShroud:
|
RevealsShroud:
|
||||||
Range: 3c0
|
Range: 3c0
|
||||||
Tooltip:
|
Tooltip:
|
||||||
|
|||||||
@@ -205,7 +205,7 @@ E6:
|
|||||||
HP: 3000
|
HP: 3000
|
||||||
Passenger:
|
Passenger:
|
||||||
CustomPipType: yellow
|
CustomPipType: yellow
|
||||||
EngineerRepair:
|
InstantlyRepairs:
|
||||||
RepairsBridges:
|
RepairsBridges:
|
||||||
CaptureManager:
|
CaptureManager:
|
||||||
Captures@SABOTAGE:
|
Captures@SABOTAGE:
|
||||||
|
|||||||
@@ -48,7 +48,7 @@ engineer:
|
|||||||
Range: 2c768
|
Range: 2c768
|
||||||
Mobile:
|
Mobile:
|
||||||
Speed: 31
|
Speed: 31
|
||||||
EngineerRepair:
|
InstantlyRepairs:
|
||||||
CaptureManager:
|
CaptureManager:
|
||||||
Captures:
|
Captures:
|
||||||
CaptureTypes: building
|
CaptureTypes: building
|
||||||
|
|||||||
@@ -165,7 +165,7 @@ FCOM:
|
|||||||
BaseProvider:
|
BaseProvider:
|
||||||
PauseOnCondition: being-captured
|
PauseOnCondition: being-captured
|
||||||
Range: 8c0
|
Range: 8c0
|
||||||
EngineerRepairable:
|
InstantlyRepairable:
|
||||||
Power:
|
Power:
|
||||||
Amount: 0
|
Amount: 0
|
||||||
ProvidesPrerequisite@buildingname:
|
ProvidesPrerequisite@buildingname:
|
||||||
@@ -191,7 +191,7 @@ HOSP:
|
|||||||
Types: building
|
Types: building
|
||||||
CapturableProgressBar:
|
CapturableProgressBar:
|
||||||
CapturableProgressBlink:
|
CapturableProgressBlink:
|
||||||
EngineerRepairable:
|
InstantlyRepairable:
|
||||||
Tooltip:
|
Tooltip:
|
||||||
Name: Hospital
|
Name: Hospital
|
||||||
TooltipDescription@ally:
|
TooltipDescription@ally:
|
||||||
@@ -472,7 +472,7 @@ MISS:
|
|||||||
Types: building
|
Types: building
|
||||||
CapturableProgressBar:
|
CapturableProgressBar:
|
||||||
CapturableProgressBlink:
|
CapturableProgressBlink:
|
||||||
EngineerRepairable:
|
InstantlyRepairable:
|
||||||
WithDeathAnimation:
|
WithDeathAnimation:
|
||||||
DeathSequence: dead
|
DeathSequence: dead
|
||||||
UseDeathTypeSuffix: false
|
UseDeathTypeSuffix: false
|
||||||
@@ -498,7 +498,7 @@ BIO:
|
|||||||
Capturable:
|
Capturable:
|
||||||
Types: building
|
Types: building
|
||||||
CapturableProgressBar:
|
CapturableProgressBar:
|
||||||
EngineerRepairable:
|
InstantlyRepairable:
|
||||||
Tooltip:
|
Tooltip:
|
||||||
Name: Biological Lab
|
Name: Biological Lab
|
||||||
TooltipDescription@ally:
|
TooltipDescription@ally:
|
||||||
@@ -538,7 +538,7 @@ OILB:
|
|||||||
Types: building
|
Types: building
|
||||||
CapturableProgressBar:
|
CapturableProgressBar:
|
||||||
CapturableProgressBlink:
|
CapturableProgressBlink:
|
||||||
EngineerRepairable:
|
InstantlyRepairable:
|
||||||
CashTrickler:
|
CashTrickler:
|
||||||
Interval: 375
|
Interval: 375
|
||||||
Amount: 100
|
Amount: 100
|
||||||
|
|||||||
@@ -703,7 +703,7 @@
|
|||||||
RepairStep: 700
|
RepairStep: 700
|
||||||
PlayerExperience: 5
|
PlayerExperience: 5
|
||||||
RepairingNotification: Repairing
|
RepairingNotification: Repairing
|
||||||
EngineerRepairable:
|
InstantlyRepairable:
|
||||||
AcceptsDeliveredCash:
|
AcceptsDeliveredCash:
|
||||||
WithMakeAnimation:
|
WithMakeAnimation:
|
||||||
Condition: build-incomplete
|
Condition: build-incomplete
|
||||||
|
|||||||
@@ -297,7 +297,7 @@ E6:
|
|||||||
IsPlayerPalette: true
|
IsPlayerPalette: true
|
||||||
Passenger:
|
Passenger:
|
||||||
CustomPipType: yellow
|
CustomPipType: yellow
|
||||||
EngineerRepair:
|
InstantlyRepairs:
|
||||||
RepairsBridges:
|
RepairsBridges:
|
||||||
CaptureManager:
|
CaptureManager:
|
||||||
GrantConditionOnPrerequisite@GLOBALREUSABLEENGINEER:
|
GrantConditionOnPrerequisite@GLOBALREUSABLEENGINEER:
|
||||||
|
|||||||
@@ -732,7 +732,7 @@ PBOX:
|
|||||||
-QuantizeFacingsFromSequence:
|
-QuantizeFacingsFromSequence:
|
||||||
BodyOrientation:
|
BodyOrientation:
|
||||||
QuantizedFacings: 8
|
QuantizedFacings: 8
|
||||||
EngineerRepairable:
|
InstantlyRepairable:
|
||||||
RequiresCondition: damaged
|
RequiresCondition: damaged
|
||||||
GrantConditionOnDamageState@DAMAGED:
|
GrantConditionOnDamageState@DAMAGED:
|
||||||
Condition: damaged
|
Condition: damaged
|
||||||
@@ -794,7 +794,7 @@ HBOX:
|
|||||||
-QuantizeFacingsFromSequence:
|
-QuantizeFacingsFromSequence:
|
||||||
BodyOrientation:
|
BodyOrientation:
|
||||||
QuantizedFacings: 8
|
QuantizedFacings: 8
|
||||||
EngineerRepairable:
|
InstantlyRepairable:
|
||||||
RequiresCondition: damaged
|
RequiresCondition: damaged
|
||||||
GrantConditionOnDamageState@DAMAGED:
|
GrantConditionOnDamageState@DAMAGED:
|
||||||
Condition: damaged
|
Condition: damaged
|
||||||
|
|||||||
@@ -344,7 +344,7 @@
|
|||||||
Weapon: BuildingExplosions
|
Weapon: BuildingExplosions
|
||||||
EmptyWeapon: BuildingExplosions
|
EmptyWeapon: BuildingExplosions
|
||||||
Type: Footprint
|
Type: Footprint
|
||||||
EngineerRepairable:
|
InstantlyRepairable:
|
||||||
ShakeOnDeath:
|
ShakeOnDeath:
|
||||||
Guardable:
|
Guardable:
|
||||||
Range: 3c0
|
Range: 3c0
|
||||||
|
|||||||
@@ -70,7 +70,7 @@ ENGINEER:
|
|||||||
HP: 10000
|
HP: 10000
|
||||||
Passenger:
|
Passenger:
|
||||||
CustomPipType: yellow
|
CustomPipType: yellow
|
||||||
EngineerRepair:
|
InstantlyRepairs:
|
||||||
RepairsBridges:
|
RepairsBridges:
|
||||||
RepairNotification: BridgeRepaired
|
RepairNotification: BridgeRepaired
|
||||||
RepairTextNotification: Bridge repaired.
|
RepairTextNotification: Bridge repaired.
|
||||||
|
|||||||
Reference in New Issue
Block a user