Rename Capture related traits to ExternalCapture
This commit is contained in:
@@ -16,18 +16,18 @@ using OpenRA.Mods.RA.Buildings;
|
||||
|
||||
namespace OpenRA.Mods.RA.Activities
|
||||
{
|
||||
class CaptureActor : Activity
|
||||
class ExternalCaptureActor : Activity
|
||||
{
|
||||
Target target;
|
||||
|
||||
public CaptureActor(Target target) { this.target = target; }
|
||||
public ExternalCaptureActor(Target target) { this.target = target; }
|
||||
|
||||
public override Activity Tick(Actor self)
|
||||
{
|
||||
if (target.Type != TargetType.Actor)
|
||||
return NextActivity;
|
||||
|
||||
var capturable = target.Actor.Trait<Capturable>();
|
||||
var capturable = target.Actor.Trait<ExternalCapturable>();
|
||||
|
||||
if (IsCanceled || !self.IsInWorld || self.IsDead() || !target.IsValidFor(self))
|
||||
{
|
||||
@@ -57,7 +57,7 @@ namespace OpenRA.Mods.RA.Activities
|
||||
|
||||
if (capturable.CaptureProgressTime == capturable.Info.CaptureCompleteTime * 25)
|
||||
{
|
||||
var capturesInfo = self.Info.Traits.Get<CapturesInfo>();
|
||||
var capturesInfo = self.Info.Traits.Get<ExternalCapturesInfo>();
|
||||
|
||||
self.World.AddFrameEndTask(w =>
|
||||
{
|
||||
@@ -17,20 +17,20 @@ using OpenRA.Mods.RA.Buildings;
|
||||
|
||||
namespace OpenRA.Mods.RA
|
||||
{
|
||||
[Desc("This actor can be captured by a unit with Captures: trait.")]
|
||||
public class CapturableInfo : ITraitInfo
|
||||
[Desc("This actor can be captured by a unit with ExternalCaptures: trait.")]
|
||||
public class ExternalCapturableInfo : ITraitInfo
|
||||
{
|
||||
[Desc("Type of actor (the Captures: trait defines what Types it can capture).")]
|
||||
[Desc("Type of actor (the ExternalCaptures: trait defines what Types it can capture).")]
|
||||
public readonly string Type = "building";
|
||||
public readonly bool AllowAllies = false;
|
||||
public readonly bool AllowNeutral = true;
|
||||
public readonly bool AllowEnemies = true;
|
||||
[Desc("Seconds it takes to change the owner.", "You might want to add a CapturableBar: trait, too.")]
|
||||
[Desc("Seconds it takes to change the owner.", "You might want to add a ExternalCapturableBar: trait, too.")]
|
||||
public readonly int CaptureCompleteTime = 15;
|
||||
|
||||
public bool CanBeTargetedBy(Actor captor, Player owner)
|
||||
{
|
||||
var c = captor.TraitOrDefault<Captures>();
|
||||
var c = captor.TraitOrDefault<ExternalCaptures>();
|
||||
if (c == null)
|
||||
return false;
|
||||
|
||||
@@ -50,18 +50,18 @@ namespace OpenRA.Mods.RA
|
||||
return true;
|
||||
}
|
||||
|
||||
public object Create(ActorInitializer init) { return new Capturable(init.self, this); }
|
||||
public object Create(ActorInitializer init) { return new ExternalCapturable(init.self, this); }
|
||||
}
|
||||
|
||||
public class Capturable : ITick
|
||||
public class ExternalCapturable : ITick
|
||||
{
|
||||
[Sync] public int CaptureProgressTime = 0;
|
||||
[Sync] public Actor Captor;
|
||||
private Actor self;
|
||||
public CapturableInfo Info;
|
||||
public ExternalCapturableInfo Info;
|
||||
public bool CaptureInProgress { get { return Captor != null; } }
|
||||
|
||||
public Capturable(Actor self, CapturableInfo info)
|
||||
public ExternalCapturable(Actor self, ExternalCapturableInfo info)
|
||||
{
|
||||
this.self = self;
|
||||
Info = info;
|
||||
@@ -15,19 +15,19 @@ using OpenRA.Traits;
|
||||
|
||||
namespace OpenRA.Mods.RA
|
||||
{
|
||||
[Desc("Visualize the remaining CaptureCompleteTime from Capturable: trait.")]
|
||||
class CapturableBarInfo : ITraitInfo, Requires<CapturableInfo>
|
||||
[Desc("Visualize the remaining CaptureCompleteTime from ExternalCapturable: trait.")]
|
||||
class ExternalCapturableBarInfo : ITraitInfo, Requires<ExternalCapturableInfo>
|
||||
{
|
||||
public object Create(ActorInitializer init) { return new CapturableBar(init.self); }
|
||||
public object Create(ActorInitializer init) { return new ExternalCapturableBar(init.self); }
|
||||
}
|
||||
|
||||
class CapturableBar : ISelectionBar
|
||||
class ExternalCapturableBar : ISelectionBar
|
||||
{
|
||||
Capturable cap;
|
||||
ExternalCapturable cap;
|
||||
|
||||
public CapturableBar(Actor self)
|
||||
public ExternalCapturableBar(Actor self)
|
||||
{
|
||||
this.cap = self.Trait<Capturable>();
|
||||
this.cap = self.Trait<ExternalCapturable>();
|
||||
}
|
||||
|
||||
public float GetValue()
|
||||
@@ -20,22 +20,22 @@ using OpenRA.Traits;
|
||||
|
||||
namespace OpenRA.Mods.RA
|
||||
{
|
||||
[Desc("This actor can capture other actors which have the Capturable: trait.")]
|
||||
class CapturesInfo : ITraitInfo
|
||||
[Desc("This actor can capture other actors which have the ExternalCapturable: trait.")]
|
||||
class ExternalCapturesInfo : ITraitInfo
|
||||
{
|
||||
[Desc("Types of actors that it can capture, as long as the type also exists in the Capturable Type: trait.")]
|
||||
[Desc("Types of actors that it can capture, as long as the type also exists in the ExternalCapturable Type: trait.")]
|
||||
public readonly string[] CaptureTypes = { "building" };
|
||||
[Desc("Destroy the unit after capturing.")]
|
||||
public readonly bool ConsumeActor = false;
|
||||
|
||||
public object Create(ActorInitializer init) { return new Captures(init.self, this); }
|
||||
public object Create(ActorInitializer init) { return new ExternalCaptures(init.self, this); }
|
||||
}
|
||||
|
||||
class Captures : IIssueOrder, IResolveOrder, IOrderVoice
|
||||
class ExternalCaptures : IIssueOrder, IResolveOrder, IOrderVoice
|
||||
{
|
||||
public readonly CapturesInfo Info;
|
||||
public readonly ExternalCapturesInfo Info;
|
||||
|
||||
public Captures(Actor self, CapturesInfo info)
|
||||
public ExternalCaptures(Actor self, ExternalCapturesInfo info)
|
||||
{
|
||||
Info = info;
|
||||
}
|
||||
@@ -44,13 +44,13 @@ namespace OpenRA.Mods.RA
|
||||
{
|
||||
get
|
||||
{
|
||||
yield return new CaptureOrderTargeter();
|
||||
yield return new ExternalCaptureOrderTargeter();
|
||||
}
|
||||
}
|
||||
|
||||
public Order IssueOrder(Actor self, IOrderTargeter order, Target target, bool queued)
|
||||
{
|
||||
if (order.OrderID != "CaptureActor")
|
||||
if (order.OrderID != "ExternalCaptureActor")
|
||||
return null;
|
||||
|
||||
if (target.Type == TargetType.FrozenActor)
|
||||
@@ -76,23 +76,23 @@ namespace OpenRA.Mods.RA
|
||||
if (frozen == null)
|
||||
return false;
|
||||
|
||||
var ci = frozen.Info.Traits.GetOrDefault<CapturableInfo>();
|
||||
var ci = frozen.Info.Traits.GetOrDefault<ExternalCapturableInfo>();
|
||||
return ci != null && ci.CanBeTargetedBy(self, frozen.Owner);
|
||||
}
|
||||
|
||||
var c = order.TargetActor.TraitOrDefault<Capturable>();
|
||||
var c = order.TargetActor.TraitOrDefault<ExternalCapturable>();
|
||||
return c != null && !c.CaptureInProgress && c.Info.CanBeTargetedBy(self, order.TargetActor.Owner);
|
||||
}
|
||||
|
||||
public string VoicePhraseForOrder(Actor self, Order order)
|
||||
{
|
||||
return order.OrderString == "CaptureActor" && IsValidOrder(self, order)
|
||||
return order.OrderString == "ExternalCaptureActor" && IsValidOrder(self, order)
|
||||
? "Attack" : null;
|
||||
}
|
||||
|
||||
public void ResolveOrder(Actor self, Order order)
|
||||
{
|
||||
if (order.OrderString != "CaptureActor" || !IsValidOrder(self, order))
|
||||
if (order.OrderString != "ExternalCaptureActor" || !IsValidOrder(self, order))
|
||||
return;
|
||||
|
||||
var target = self.ResolveFrozenActorOrder(order, Color.Red);
|
||||
@@ -103,17 +103,17 @@ namespace OpenRA.Mods.RA
|
||||
self.CancelActivity();
|
||||
|
||||
self.SetTargetLine(target, Color.Red);
|
||||
self.QueueActivity(new CaptureActor(target));
|
||||
self.QueueActivity(new ExternalCaptureActor(target));
|
||||
}
|
||||
}
|
||||
|
||||
class CaptureOrderTargeter : UnitOrderTargeter
|
||||
class ExternalCaptureOrderTargeter : UnitOrderTargeter
|
||||
{
|
||||
public CaptureOrderTargeter() : base("CaptureActor", 6, "enter", true, true) { }
|
||||
public ExternalCaptureOrderTargeter() : base("ExternalCaptureActor", 6, "enter", true, true) { }
|
||||
|
||||
public override bool CanTargetActor(Actor self, Actor target, TargetModifiers modifiers, ref string cursor)
|
||||
{
|
||||
var c = target.TraitOrDefault<Capturable>();
|
||||
var c = target.TraitOrDefault<ExternalCapturable>();
|
||||
|
||||
var canTargetActor = c != null && !c.CaptureInProgress && c.Info.CanBeTargetedBy(self, target.Owner);
|
||||
cursor = canTargetActor ? "ability" : "move-blocked";
|
||||
@@ -122,7 +122,7 @@ namespace OpenRA.Mods.RA
|
||||
|
||||
public override bool CanTargetFrozenActor(Actor self, FrozenActor target, TargetModifiers modifiers, ref string cursor)
|
||||
{
|
||||
var c = target.Info.Traits.GetOrDefault<CapturableInfo>();
|
||||
var c = target.Info.Traits.GetOrDefault<ExternalCapturableInfo>();
|
||||
|
||||
var canTargetActor = c != null && c.CanBeTargetedBy(self, target.Owner);
|
||||
cursor = canTargetActor ? "ability" : "move-blocked";
|
||||
@@ -87,7 +87,7 @@
|
||||
<Compile Include="AcceptsSupplies.cs" />
|
||||
<Compile Include="Activities\Attack.cs" />
|
||||
<Compile Include="Activities\CallFunc.cs" />
|
||||
<Compile Include="Activities\CaptureActor.cs" />
|
||||
<Compile Include="Activities\ExternalCaptureActor.cs" />
|
||||
<Compile Include="Activities\DeliverResources.cs" />
|
||||
<Compile Include="Activities\Demolish.cs" />
|
||||
<Compile Include="Activities\DonateSupplies.cs" />
|
||||
@@ -174,10 +174,10 @@
|
||||
<Compile Include="Buildings\Wall.cs" />
|
||||
<Compile Include="Burns.cs" />
|
||||
<Compile Include="C4Demolition.cs" />
|
||||
<Compile Include="Capturable.cs" />
|
||||
<Compile Include="CapturableBar.cs" />
|
||||
<Compile Include="ExternalCapturable.cs" />
|
||||
<Compile Include="ExternalCapturableBar.cs" />
|
||||
<Compile Include="LegacyCapturable.cs" />
|
||||
<Compile Include="Captures.cs" />
|
||||
<Compile Include="ExternalCaptures.cs" />
|
||||
<Compile Include="Cargo.cs" />
|
||||
<Compile Include="CarpetBomb.cs" />
|
||||
<Compile Include="CashTrickler.cs" />
|
||||
@@ -529,7 +529,5 @@ cd "$(SolutionDir)thirdparty/"
|
||||
copy "FuzzyLogicLibrary.dll" "$(SolutionDir)"
|
||||
cd "$(SolutionDir)"</PostBuildEvent>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Folder Include="AI\States\" />
|
||||
</ItemGroup>
|
||||
<ItemGroup />
|
||||
</Project>
|
||||
|
||||
@@ -208,8 +208,8 @@
|
||||
SellSounds: BUILD1.WAV
|
||||
Adjacent: 3
|
||||
GivesBuildableArea:
|
||||
Capturable:
|
||||
CapturableBar:
|
||||
ExternalCapturable:
|
||||
ExternalCapturableBar:
|
||||
SoundOnDamageTransition:
|
||||
DamagedSound: EXPLSML1.WAV
|
||||
DestroyedSound: EXPLHG1.WAV
|
||||
|
||||
@@ -47,7 +47,7 @@ ENGINEER:
|
||||
Passenger:
|
||||
PipType: Yellow
|
||||
EngineerRepair:
|
||||
Captures:
|
||||
ExternalCaptures:
|
||||
-AutoTarget:
|
||||
AttackMove:
|
||||
JustMove: true
|
||||
|
||||
@@ -640,8 +640,8 @@ SIETCH:
|
||||
Range: 10
|
||||
-GivesBuildableArea:
|
||||
-Sellable:
|
||||
-Capturable:
|
||||
-CapturableBar:
|
||||
-ExternalCapturable:
|
||||
-ExternalCapturableBar:
|
||||
|
||||
STARPORTC:
|
||||
Inherits: ^STARPORT
|
||||
|
||||
@@ -529,8 +529,8 @@ Rules:
|
||||
Bib:
|
||||
RevealsShroud:
|
||||
Range: 3
|
||||
Capturable:
|
||||
CapturableBar:
|
||||
ExternalCapturable:
|
||||
ExternalCapturableBar:
|
||||
EngineerRepairable:
|
||||
-MustBeDestroyed:
|
||||
CashTrickler:
|
||||
|
||||
@@ -2606,8 +2606,8 @@ Rules:
|
||||
HP: 2000
|
||||
Armor:
|
||||
Heavy:
|
||||
Capturable:
|
||||
CapturableBar:
|
||||
ExternalCapturable:
|
||||
ExternalCapturableBar:
|
||||
CashTrickler:
|
||||
Period: 750
|
||||
Amount: 333
|
||||
|
||||
@@ -2940,7 +2940,7 @@ Rules:
|
||||
HP: 1500
|
||||
Armor:
|
||||
Heavy:
|
||||
Capturable:
|
||||
ExternalCapturable:
|
||||
CashTrickler:
|
||||
Period: 250
|
||||
Amount: 50
|
||||
|
||||
@@ -2157,8 +2157,8 @@ Rules:
|
||||
HP: 2000
|
||||
Armor:
|
||||
Heavy:
|
||||
Capturable:
|
||||
CapturableBar:
|
||||
ExternalCapturable:
|
||||
ExternalCapturableBar:
|
||||
CashTrickler:
|
||||
Period: 750
|
||||
Amount: 333
|
||||
|
||||
@@ -2588,7 +2588,7 @@ Rules:
|
||||
HP: 2000
|
||||
Armor:
|
||||
Heavy:
|
||||
Capturable:
|
||||
ExternalCapturable:
|
||||
CashTrickler:
|
||||
Period: 750
|
||||
Amount: 333
|
||||
|
||||
@@ -79,8 +79,8 @@ HOSP:
|
||||
Dimensions: 2,2
|
||||
Health:
|
||||
HP: 1000
|
||||
Capturable:
|
||||
CapturableBar:
|
||||
ExternalCapturable:
|
||||
ExternalCapturableBar:
|
||||
EngineerRepairable:
|
||||
SelfHealingTech:
|
||||
Type: InfantryHealing
|
||||
@@ -320,8 +320,8 @@ OILB:
|
||||
HP: 1000
|
||||
RevealsShroud:
|
||||
Range: 3
|
||||
Capturable:
|
||||
CapturableBar:
|
||||
ExternalCapturable:
|
||||
ExternalCapturableBar:
|
||||
EngineerRepairable:
|
||||
-MustBeDestroyed:
|
||||
CashTrickler:
|
||||
|
||||
@@ -222,8 +222,8 @@
|
||||
TerrainTypes: Clear,Road
|
||||
RequiresBaseProvider: True
|
||||
GivesBuildableArea:
|
||||
Capturable:
|
||||
CapturableBar:
|
||||
ExternalCapturable:
|
||||
ExternalCapturableBar:
|
||||
SoundOnDamageTransition:
|
||||
DamagedSound: kaboom1.aud
|
||||
DestroyedSound: kaboom22.aud
|
||||
@@ -303,8 +303,8 @@
|
||||
-AcceptsSupplies:
|
||||
-GivesBuildableArea:
|
||||
-Sellable:
|
||||
-Capturable:
|
||||
-CapturableBar:
|
||||
-ExternalCapturable:
|
||||
-ExternalCapturableBar:
|
||||
FrozenUnderFog:
|
||||
StartsRevealed: true
|
||||
-GpsDot:
|
||||
|
||||
@@ -172,7 +172,7 @@ E6:
|
||||
PipType: Yellow
|
||||
EngineerRepair:
|
||||
RepairsBridges:
|
||||
Captures:
|
||||
ExternalCaptures:
|
||||
TakeCover:
|
||||
-AutoTarget:
|
||||
AttackMove:
|
||||
|
||||
@@ -11,7 +11,6 @@
|
||||
TerrainTypes: Clear,Road
|
||||
GivesBuildableArea:
|
||||
Capturable:
|
||||
CapturableBar:
|
||||
SoundOnDamageTransition:
|
||||
DamagedSound: #TODO
|
||||
DestroyedSound: #TODO
|
||||
|
||||
Reference in New Issue
Block a user