Rename LegacyCapture related traits to Capture
This commit is contained in:
@@ -15,11 +15,11 @@ using OpenRA.Traits;
|
|||||||
|
|
||||||
namespace OpenRA.Mods.RA.Activities
|
namespace OpenRA.Mods.RA.Activities
|
||||||
{
|
{
|
||||||
class LegacyCaptureActor : Activity
|
class CaptureActor : Activity
|
||||||
{
|
{
|
||||||
Target target;
|
Target target;
|
||||||
|
|
||||||
public LegacyCaptureActor(Target target) { this.target = target; }
|
public CaptureActor(Target target) { this.target = target; }
|
||||||
|
|
||||||
public override Activity Tick(Actor self)
|
public override Activity Tick(Actor self)
|
||||||
{
|
{
|
||||||
@@ -34,8 +34,8 @@ namespace OpenRA.Mods.RA.Activities
|
|||||||
if (b != null && b.Locked)
|
if (b != null && b.Locked)
|
||||||
return NextActivity;
|
return NextActivity;
|
||||||
|
|
||||||
var capturesInfo = self.Info.Traits.Get<LegacyCapturesInfo>();
|
var capturesInfo = self.Info.Traits.Get<CapturesInfo>();
|
||||||
var capturableInfo = actor.Info.Traits.Get<LegacyCapturableInfo>();
|
var capturableInfo = actor.Info.Traits.Get<CapturableInfo>();
|
||||||
|
|
||||||
var health = actor.Trait<Health>();
|
var health = actor.Trait<Health>();
|
||||||
|
|
||||||
@@ -14,10 +14,10 @@ using OpenRA.FileFormats;
|
|||||||
|
|
||||||
namespace OpenRA.Mods.RA
|
namespace OpenRA.Mods.RA
|
||||||
{
|
{
|
||||||
[Desc("This actor can be captured by a unit with LegacyCaptures: trait.")]
|
[Desc("This actor can be captured by a unit with Captures: trait.")]
|
||||||
class LegacyCapturableInfo : TraitInfo<LegacyCapturable>
|
class CapturableInfo : TraitInfo<Capturable>
|
||||||
{
|
{
|
||||||
[Desc("Type of actor (the LegacyCaptures: trait defines what Types it can capture).")]
|
[Desc("Type of actor (the Captures: trait defines what Types it can capture).")]
|
||||||
public readonly string Type = "building";
|
public readonly string Type = "building";
|
||||||
public readonly bool AllowAllies = false;
|
public readonly bool AllowAllies = false;
|
||||||
public readonly bool AllowNeutral = true;
|
public readonly bool AllowNeutral = true;
|
||||||
@@ -27,7 +27,7 @@ namespace OpenRA.Mods.RA
|
|||||||
|
|
||||||
public bool CanBeTargetedBy(Actor captor, Player owner)
|
public bool CanBeTargetedBy(Actor captor, Player owner)
|
||||||
{
|
{
|
||||||
var c = captor.TraitOrDefault<LegacyCaptures>();
|
var c = captor.TraitOrDefault<Captures>();
|
||||||
if (c == null)
|
if (c == null)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
@@ -48,5 +48,5 @@ namespace OpenRA.Mods.RA
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class LegacyCapturable { }
|
class Capturable { }
|
||||||
}
|
}
|
||||||
@@ -20,24 +20,24 @@ using OpenRA.Traits;
|
|||||||
|
|
||||||
namespace OpenRA.Mods.RA
|
namespace OpenRA.Mods.RA
|
||||||
{
|
{
|
||||||
[Desc("This actor can capture other actors which have the LegacyCapturable: trait.")]
|
[Desc("This actor can capture other actors which have the Capturable: trait.")]
|
||||||
class LegacyCapturesInfo : ITraitInfo
|
class CapturesInfo : ITraitInfo
|
||||||
{
|
{
|
||||||
[Desc("Types of actors that it can capture, as long as the type also exists in the LegacyCapturable Type: trait.")]
|
[Desc("Types of actors that it can capture, as long as the type also exists in the Capturable Type: trait.")]
|
||||||
public readonly string[] CaptureTypes = { "building" };
|
public readonly string[] CaptureTypes = { "building" };
|
||||||
[Desc("Unit will do damage to the actor instead of capturing it. Unit is destroyed when sabotaging.")]
|
[Desc("Unit will do damage to the actor instead of capturing it. Unit is destroyed when sabotaging.")]
|
||||||
public readonly bool Sabotage = true;
|
public readonly bool Sabotage = true;
|
||||||
[Desc("Only used if Sabotage=true. Sabotage damage expressed as a percentage of enemy health removed.")]
|
[Desc("Only used if Sabotage=true. Sabotage damage expressed as a percentage of enemy health removed.")]
|
||||||
public readonly float SabotageHPRemoval = 0.5f;
|
public readonly float SabotageHPRemoval = 0.5f;
|
||||||
|
|
||||||
public object Create(ActorInitializer init) { return new LegacyCaptures(init.self, this); }
|
public object Create(ActorInitializer init) { return new Captures(init.self, this); }
|
||||||
}
|
}
|
||||||
|
|
||||||
class LegacyCaptures : IIssueOrder, IResolveOrder, IOrderVoice
|
class Captures : IIssueOrder, IResolveOrder, IOrderVoice
|
||||||
{
|
{
|
||||||
public readonly LegacyCapturesInfo Info;
|
public readonly CapturesInfo Info;
|
||||||
|
|
||||||
public LegacyCaptures(Actor self, LegacyCapturesInfo info)
|
public Captures(Actor self, CapturesInfo info)
|
||||||
{
|
{
|
||||||
Info = info;
|
Info = info;
|
||||||
}
|
}
|
||||||
@@ -46,13 +46,13 @@ namespace OpenRA.Mods.RA
|
|||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
yield return new LegacyCaptureOrderTargeter(Info.Sabotage);
|
yield return new CaptureOrderTargeter(Info.Sabotage);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public Order IssueOrder(Actor self, IOrderTargeter order, Target target, bool queued)
|
public Order IssueOrder(Actor self, IOrderTargeter order, Target target, bool queued)
|
||||||
{
|
{
|
||||||
if (order.OrderID != "LegacyCaptureActor")
|
if (order.OrderID != "CaptureActor")
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
if (target.Type == TargetType.FrozenActor)
|
if (target.Type == TargetType.FrozenActor)
|
||||||
@@ -63,12 +63,12 @@ namespace OpenRA.Mods.RA
|
|||||||
|
|
||||||
public string VoicePhraseForOrder(Actor self, Order order)
|
public string VoicePhraseForOrder(Actor self, Order order)
|
||||||
{
|
{
|
||||||
return order.OrderString == "LegacyCaptureActor" ? "Attack" : null;
|
return order.OrderString == "CaptureActor" ? "Attack" : null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void ResolveOrder(Actor self, Order order)
|
public void ResolveOrder(Actor self, Order order)
|
||||||
{
|
{
|
||||||
if (order.OrderString != "LegacyCaptureActor")
|
if (order.OrderString != "CaptureActor")
|
||||||
return;
|
return;
|
||||||
|
|
||||||
var target = self.ResolveFrozenActorOrder(order, Color.Red);
|
var target = self.ResolveFrozenActorOrder(order, Color.Red);
|
||||||
@@ -79,22 +79,22 @@ namespace OpenRA.Mods.RA
|
|||||||
self.CancelActivity();
|
self.CancelActivity();
|
||||||
|
|
||||||
self.SetTargetLine(target, Color.Red);
|
self.SetTargetLine(target, Color.Red);
|
||||||
self.QueueActivity(new Enter(target.Actor, new LegacyCaptureActor(target)));
|
self.QueueActivity(new Enter(target.Actor, new CaptureActor(target)));
|
||||||
}
|
}
|
||||||
|
|
||||||
class LegacyCaptureOrderTargeter : UnitOrderTargeter
|
class CaptureOrderTargeter : UnitOrderTargeter
|
||||||
{
|
{
|
||||||
readonly bool sabotage;
|
readonly bool sabotage;
|
||||||
|
|
||||||
public LegacyCaptureOrderTargeter(bool sabotage)
|
public CaptureOrderTargeter(bool sabotage)
|
||||||
: base("LegacyCaptureActor", 6, "enter", true, true)
|
: base("CaptureActor", 6, "enter", true, true)
|
||||||
{
|
{
|
||||||
this.sabotage = sabotage;
|
this.sabotage = sabotage;
|
||||||
}
|
}
|
||||||
|
|
||||||
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 c = target.Info.Traits.GetOrDefault<LegacyCapturableInfo>();
|
var c = target.Info.Traits.GetOrDefault<CapturableInfo>();
|
||||||
if (c == null || !c.CanBeTargetedBy(self, target.Owner))
|
if (c == null || !c.CanBeTargetedBy(self, target.Owner))
|
||||||
{
|
{
|
||||||
cursor = "enter-blocked";
|
cursor = "enter-blocked";
|
||||||
@@ -111,7 +111,7 @@ namespace OpenRA.Mods.RA
|
|||||||
|
|
||||||
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)
|
||||||
{
|
{
|
||||||
var c = target.Info.Traits.GetOrDefault<LegacyCapturableInfo>();
|
var c = target.Info.Traits.GetOrDefault<CapturableInfo>();
|
||||||
if (c == null || !c.CanBeTargetedBy(self, target.Owner))
|
if (c == null || !c.CanBeTargetedBy(self, target.Owner))
|
||||||
{
|
{
|
||||||
cursor = "enter-blocked";
|
cursor = "enter-blocked";
|
||||||
@@ -80,7 +80,7 @@
|
|||||||
</Reference>
|
</Reference>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Compile Include="Activities\LegacyCaptureActor.cs" />
|
<Compile Include="Activities\CaptureActor.cs" />
|
||||||
<Compile Include="AI\AttackOrFleeFuzzy.cs" />
|
<Compile Include="AI\AttackOrFleeFuzzy.cs" />
|
||||||
<Compile Include="AI\BaseBuilder.cs" />
|
<Compile Include="AI\BaseBuilder.cs" />
|
||||||
<Compile Include="AI\HackyAI.cs" />
|
<Compile Include="AI\HackyAI.cs" />
|
||||||
@@ -176,7 +176,7 @@
|
|||||||
<Compile Include="C4Demolition.cs" />
|
<Compile Include="C4Demolition.cs" />
|
||||||
<Compile Include="ExternalCapturable.cs" />
|
<Compile Include="ExternalCapturable.cs" />
|
||||||
<Compile Include="ExternalCapturableBar.cs" />
|
<Compile Include="ExternalCapturableBar.cs" />
|
||||||
<Compile Include="LegacyCapturable.cs" />
|
<Compile Include="Capturable.cs" />
|
||||||
<Compile Include="ExternalCaptures.cs" />
|
<Compile Include="ExternalCaptures.cs" />
|
||||||
<Compile Include="Cargo.cs" />
|
<Compile Include="Cargo.cs" />
|
||||||
<Compile Include="CarpetBomb.cs" />
|
<Compile Include="CarpetBomb.cs" />
|
||||||
@@ -244,7 +244,7 @@
|
|||||||
<Compile Include="IronCurtainable.cs" />
|
<Compile Include="IronCurtainable.cs" />
|
||||||
<Compile Include="JamsMissiles.cs" />
|
<Compile Include="JamsMissiles.cs" />
|
||||||
<Compile Include="LeavesHusk.cs" />
|
<Compile Include="LeavesHusk.cs" />
|
||||||
<Compile Include="LegacyCaptures.cs" />
|
<Compile Include="Captures.cs" />
|
||||||
<Compile Include="LightPaletteRotator.cs" />
|
<Compile Include="LightPaletteRotator.cs" />
|
||||||
<Compile Include="LimitedAmmo.cs" />
|
<Compile Include="LimitedAmmo.cs" />
|
||||||
<Compile Include="Lint\CheckActorReferences.cs" />
|
<Compile Include="Lint\CheckActorReferences.cs" />
|
||||||
|
|||||||
@@ -328,7 +328,7 @@
|
|||||||
RelativeToTopLeft: yes
|
RelativeToTopLeft: yes
|
||||||
ShakeOnDeath:
|
ShakeOnDeath:
|
||||||
Sellable:
|
Sellable:
|
||||||
LegacyCapturable:
|
Capturable:
|
||||||
CombatDebugOverlay:
|
CombatDebugOverlay:
|
||||||
Guardable:
|
Guardable:
|
||||||
Range: 3
|
Range: 3
|
||||||
@@ -351,7 +351,7 @@
|
|||||||
RenderBuilding:
|
RenderBuilding:
|
||||||
WithBuildingExplosion:
|
WithBuildingExplosion:
|
||||||
-RepairableBuilding:
|
-RepairableBuilding:
|
||||||
-LegacyCapturable:
|
-Capturable:
|
||||||
-Sellable:
|
-Sellable:
|
||||||
Tooltip:
|
Tooltip:
|
||||||
Name: Civilian Building
|
Name: Civilian Building
|
||||||
@@ -374,7 +374,7 @@
|
|||||||
|
|
||||||
^TechBuilding:
|
^TechBuilding:
|
||||||
Inherits: ^CivBuilding
|
Inherits: ^CivBuilding
|
||||||
LegacyCapturable:
|
Capturable:
|
||||||
RepairableBuilding:
|
RepairableBuilding:
|
||||||
EngineerRepairable:
|
EngineerRepairable:
|
||||||
RevealsShroud:
|
RevealsShroud:
|
||||||
|
|||||||
@@ -166,7 +166,7 @@ E6:
|
|||||||
PipType: Yellow
|
PipType: Yellow
|
||||||
EngineerRepair:
|
EngineerRepair:
|
||||||
RepairsBridges:
|
RepairsBridges:
|
||||||
LegacyCaptures:
|
Captures:
|
||||||
CaptureTypes: building, husk
|
CaptureTypes: building, husk
|
||||||
-AutoTarget:
|
-AutoTarget:
|
||||||
AttackMove:
|
AttackMove:
|
||||||
|
|||||||
@@ -101,7 +101,7 @@ V01:
|
|||||||
TransformOnCapture:
|
TransformOnCapture:
|
||||||
IntoActor: v01.sniper
|
IntoActor: v01.sniper
|
||||||
SkipMakeAnims: true
|
SkipMakeAnims: true
|
||||||
LegacyCapturable:
|
Capturable:
|
||||||
Type: CivilianBuilding
|
Type: CivilianBuilding
|
||||||
CaptureThreshold: 1
|
CaptureThreshold: 1
|
||||||
EditorTilesetFilter:
|
EditorTilesetFilter:
|
||||||
@@ -129,7 +129,7 @@ V01.SNIPER:
|
|||||||
OnExit: v01
|
OnExit: v01
|
||||||
SkipMakeAnims: true
|
SkipMakeAnims: true
|
||||||
BecomeNeutral: true
|
BecomeNeutral: true
|
||||||
-LegacyCapturable:
|
-Capturable:
|
||||||
EditorTilesetFilter:
|
EditorTilesetFilter:
|
||||||
ExcludeTilesets: DESERT
|
ExcludeTilesets: DESERT
|
||||||
|
|
||||||
|
|||||||
@@ -489,7 +489,7 @@ SNIPER:
|
|||||||
CloakSound:
|
CloakSound:
|
||||||
UncloakSound:
|
UncloakSound:
|
||||||
UncloakOnMove: yes
|
UncloakOnMove: yes
|
||||||
LegacyCaptures:
|
Captures:
|
||||||
CaptureTypes: CivilianBuilding
|
CaptureTypes: CivilianBuilding
|
||||||
Sabotage: no
|
Sabotage: no
|
||||||
SabotageHPRemoval: 0
|
SabotageHPRemoval: 0
|
||||||
|
|||||||
@@ -163,7 +163,7 @@ ENGINEER:
|
|||||||
PipType: Yellow
|
PipType: Yellow
|
||||||
EngineerRepair:
|
EngineerRepair:
|
||||||
RepairsBridges:
|
RepairsBridges:
|
||||||
LegacyCaptures:
|
Captures:
|
||||||
CaptureTypes: building
|
CaptureTypes: building
|
||||||
-AutoTarget:
|
-AutoTarget:
|
||||||
AttackMove:
|
AttackMove:
|
||||||
|
|||||||
Reference in New Issue
Block a user