Rename BridgeHut to LegacyBridgeHut.
This commit is contained in:
@@ -16,27 +16,27 @@ namespace OpenRA.Mods.Common.Activities
|
|||||||
{
|
{
|
||||||
class RepairBridge : Enter
|
class RepairBridge : Enter
|
||||||
{
|
{
|
||||||
readonly BridgeHut hut;
|
readonly LegacyBridgeHut legacyHut;
|
||||||
readonly string notification;
|
readonly string notification;
|
||||||
|
|
||||||
public RepairBridge(Actor self, Actor target, EnterBehaviour enterBehaviour, string notification)
|
public RepairBridge(Actor self, Actor target, EnterBehaviour enterBehaviour, string notification)
|
||||||
: base(self, target, enterBehaviour)
|
: base(self, target, enterBehaviour)
|
||||||
{
|
{
|
||||||
hut = target.Trait<BridgeHut>();
|
legacyHut = target.Trait<LegacyBridgeHut>();
|
||||||
this.notification = notification;
|
this.notification = notification;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override bool CanReserve(Actor self)
|
protected override bool CanReserve(Actor self)
|
||||||
{
|
{
|
||||||
return hut.BridgeDamageState != DamageState.Undamaged && !hut.Repairing && hut.Bridge.GetHut(0) != null && hut.Bridge.GetHut(1) != null;
|
return legacyHut.BridgeDamageState != DamageState.Undamaged && !legacyHut.Repairing && legacyHut.Bridge.GetHut(0) != null && legacyHut.Bridge.GetHut(1) != null;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void OnInside(Actor self)
|
protected override void OnInside(Actor self)
|
||||||
{
|
{
|
||||||
if (hut.BridgeDamageState == DamageState.Undamaged || hut.Repairing || hut.Bridge.GetHut(0) == null || hut.Bridge.GetHut(1) == null)
|
if (legacyHut.BridgeDamageState == DamageState.Undamaged || legacyHut.Repairing || legacyHut.Bridge.GetHut(0) == null || legacyHut.Bridge.GetHut(1) == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
hut.Repair(self);
|
legacyHut.Repair(self);
|
||||||
|
|
||||||
Game.Sound.PlayNotification(self.World.Map.Rules, self.Owner, "Speech", notification, self.Owner.Faction.InternalName);
|
Game.Sound.PlayNotification(self.World.Map.Rules, self.Owner, "Speech", notification, self.Owner.Faction.InternalName);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -274,7 +274,7 @@
|
|||||||
<Compile Include="Traits\Buildings\BaseProvider.cs" />
|
<Compile Include="Traits\Buildings\BaseProvider.cs" />
|
||||||
<Compile Include="Traits\Buildings\Bib.cs" />
|
<Compile Include="Traits\Buildings\Bib.cs" />
|
||||||
<Compile Include="Traits\Buildings\Bridge.cs" />
|
<Compile Include="Traits\Buildings\Bridge.cs" />
|
||||||
<Compile Include="Traits\Buildings\BridgeHut.cs" />
|
<Compile Include="Traits\Buildings\LegacyBridgeHut.cs" />
|
||||||
<Compile Include="Traits\Buildings\Building.cs" />
|
<Compile Include="Traits\Buildings\Building.cs" />
|
||||||
<Compile Include="Traits\Buildings\BuildingInfluence.cs" />
|
<Compile Include="Traits\Buildings\BuildingInfluence.cs" />
|
||||||
<Compile Include="Traits\Buildings\BuildingUtils.cs" />
|
<Compile Include="Traits\Buildings\BuildingUtils.cs" />
|
||||||
|
|||||||
@@ -78,7 +78,7 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
{
|
{
|
||||||
readonly BuildingInfo building;
|
readonly BuildingInfo building;
|
||||||
readonly Bridge[] neighbours = new Bridge[2];
|
readonly Bridge[] neighbours = new Bridge[2];
|
||||||
readonly BridgeHut[] huts = new BridgeHut[2]; // Huts before this / first & after this / last
|
readonly LegacyBridgeHut[] huts = new LegacyBridgeHut[2]; // Huts before this / first & after this / last
|
||||||
readonly Health health;
|
readonly Health health;
|
||||||
readonly Actor self;
|
readonly Actor self;
|
||||||
readonly BridgeInfo info;
|
readonly BridgeInfo info;
|
||||||
@@ -88,7 +88,7 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
ushort template;
|
ushort template;
|
||||||
Dictionary<CPos, byte> footprint;
|
Dictionary<CPos, byte> footprint;
|
||||||
|
|
||||||
public BridgeHut Hut { get; private set; }
|
public LegacyBridgeHut Hut { get; private set; }
|
||||||
public bool IsDangling { get { return isDangling.Value; } }
|
public bool IsDangling { get { return isDangling.Value; } }
|
||||||
|
|
||||||
public Bridge(Actor self, BridgeInfo info)
|
public Bridge(Actor self, BridgeInfo info)
|
||||||
@@ -152,7 +152,7 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
internal void AddHut(BridgeHut hut)
|
internal void AddHut(LegacyBridgeHut hut)
|
||||||
{
|
{
|
||||||
// TODO: This method is incomprehensible and fragile, and should be rewritten.
|
// TODO: This method is incomprehensible and fragile, and should be rewritten.
|
||||||
if (huts[0] == huts[1])
|
if (huts[0] == huts[1])
|
||||||
@@ -170,7 +170,7 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
Hut = null;
|
Hut = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public BridgeHut GetHut(int index) { return huts[index]; }
|
public LegacyBridgeHut GetHut(int index) { return huts[index]; }
|
||||||
public Bridge GetNeighbor(int[] offset, BridgeLayer bridges)
|
public Bridge GetNeighbor(int[] offset, BridgeLayer bridges)
|
||||||
{
|
{
|
||||||
if (offset == null)
|
if (offset == null)
|
||||||
|
|||||||
@@ -15,14 +15,14 @@ using OpenRA.Traits;
|
|||||||
namespace OpenRA.Mods.Common.Traits
|
namespace OpenRA.Mods.Common.Traits
|
||||||
{
|
{
|
||||||
[Desc("Allows bridges to be targeted for demolition and repair.")]
|
[Desc("Allows bridges to be targeted for demolition and repair.")]
|
||||||
class BridgeHutInfo : IDemolishableInfo, ITraitInfo
|
class LegacyBridgeHutInfo : IDemolishableInfo, ITraitInfo
|
||||||
{
|
{
|
||||||
public bool IsValidTarget(ActorInfo actorInfo, Actor saboteur) { return false; } // TODO: bridges don't support frozen under fog
|
public bool IsValidTarget(ActorInfo actorInfo, Actor saboteur) { return false; } // TODO: bridges don't support frozen under fog
|
||||||
|
|
||||||
public object Create(ActorInitializer init) { return new BridgeHut(init); }
|
public object Create(ActorInitializer init) { return new LegacyBridgeHut(init); }
|
||||||
}
|
}
|
||||||
|
|
||||||
class BridgeHut : IDemolishable
|
class LegacyBridgeHut : IDemolishable
|
||||||
{
|
{
|
||||||
public readonly Bridge FirstBridge;
|
public readonly Bridge FirstBridge;
|
||||||
public readonly Bridge Bridge;
|
public readonly Bridge Bridge;
|
||||||
@@ -30,7 +30,7 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
public bool Repairing { get { return repairDirections > 0; } }
|
public bool Repairing { get { return repairDirections > 0; } }
|
||||||
int repairDirections = 0;
|
int repairDirections = 0;
|
||||||
|
|
||||||
public BridgeHut(ActorInitializer init)
|
public LegacyBridgeHut(ActorInitializer init)
|
||||||
{
|
{
|
||||||
Bridge = init.Get<ParentActorInit>().ActorValue.Trait<Bridge>();
|
Bridge = init.Get<ParentActorInit>().ActorValue.Trait<Bridge>();
|
||||||
Bridge.AddHut(this);
|
Bridge.AddHut(this);
|
||||||
@@ -17,7 +17,7 @@ using OpenRA.Traits;
|
|||||||
|
|
||||||
namespace OpenRA.Mods.Common.Traits
|
namespace OpenRA.Mods.Common.Traits
|
||||||
{
|
{
|
||||||
[Desc("Can enter a BridgeHut to trigger a repair.")]
|
[Desc("Can enter a LegacyBridgeHut to trigger a repair.")]
|
||||||
class RepairsBridgesInfo : ITraitInfo
|
class RepairsBridgesInfo : ITraitInfo
|
||||||
{
|
{
|
||||||
[VoiceReference] public readonly string Voice = "Action";
|
[VoiceReference] public readonly string Voice = "Action";
|
||||||
@@ -26,7 +26,7 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
"Possible values are Exit, Suicide, Dispose.")]
|
"Possible values are Exit, Suicide, Dispose.")]
|
||||||
public readonly EnterBehaviour EnterBehaviour = EnterBehaviour.Dispose;
|
public readonly EnterBehaviour EnterBehaviour = EnterBehaviour.Dispose;
|
||||||
|
|
||||||
[Desc("Cursor to use when targeting a BridgeHut of an unrepaired bridge.")]
|
[Desc("Cursor to use when targeting a LegacyBridgeHut of an unrepaired bridge.")]
|
||||||
public readonly string TargetCursor = "goldwrench";
|
public readonly string TargetCursor = "goldwrench";
|
||||||
|
|
||||||
[Desc("Cursor to use when repairing is denied.")]
|
[Desc("Cursor to use when repairing is denied.")]
|
||||||
@@ -65,22 +65,22 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
if (order.OrderString != "RepairBridge")
|
if (order.OrderString != "RepairBridge")
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
var hut = order.TargetActor.TraitOrDefault<BridgeHut>();
|
var legacyHut = order.TargetActor.TraitOrDefault<LegacyBridgeHut>();
|
||||||
if (hut == null)
|
if (legacyHut == null)
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
return hut.BridgeDamageState == DamageState.Undamaged || hut.Repairing || hut.Bridge.IsDangling ? null : info.Voice;
|
return legacyHut.BridgeDamageState == DamageState.Undamaged || legacyHut.Repairing || legacyHut.Bridge.IsDangling ? null : info.Voice;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void ResolveOrder(Actor self, Order order)
|
public void ResolveOrder(Actor self, Order order)
|
||||||
{
|
{
|
||||||
if (order.OrderString == "RepairBridge")
|
if (order.OrderString == "RepairBridge")
|
||||||
{
|
{
|
||||||
var hut = order.TargetActor.TraitOrDefault<BridgeHut>();
|
var legacyHut = order.TargetActor.TraitOrDefault<LegacyBridgeHut>();
|
||||||
if (hut == null)
|
if (legacyHut == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (hut.BridgeDamageState == DamageState.Undamaged || hut.Repairing || hut.Bridge.IsDangling)
|
if (legacyHut.BridgeDamageState == DamageState.Undamaged || legacyHut.Repairing || legacyHut.Bridge.IsDangling)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
self.SetTargetLine(Target.FromOrder(self.World, order), Color.Yellow);
|
self.SetTargetLine(Target.FromOrder(self.World, order), Color.Yellow);
|
||||||
@@ -102,12 +102,12 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
|
|
||||||
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 hut = target.TraitOrDefault<BridgeHut>();
|
var legacyHut = target.TraitOrDefault<LegacyBridgeHut>();
|
||||||
if (hut == null)
|
if (legacyHut == null)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
// Require force attack to heal partially damaged bridges to avoid unnecessary cursor noise
|
// Require force attack to heal partially damaged bridges to avoid unnecessary cursor noise
|
||||||
var damage = hut.BridgeDamageState;
|
var damage = legacyHut.BridgeDamageState;
|
||||||
if (!modifiers.HasModifier(TargetModifiers.ForceAttack) && damage != DamageState.Dead)
|
if (!modifiers.HasModifier(TargetModifiers.ForceAttack) && damage != DamageState.Dead)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
@@ -116,7 +116,7 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
return false;
|
return false;
|
||||||
|
|
||||||
// Can't repair a bridge that is undamaged, already under repair, or dangling
|
// Can't repair a bridge that is undamaged, already under repair, or dangling
|
||||||
if (damage == DamageState.Undamaged || hut.Repairing || hut.Bridge.IsDangling)
|
if (damage == DamageState.Undamaged || legacyHut.Repairing || legacyHut.Bridge.IsDangling)
|
||||||
cursor = info.TargetBlockedCursor;
|
cursor = info.TargetBlockedCursor;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
@@ -532,6 +532,12 @@ namespace OpenRA.Mods.Common.UtilityCommands
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (engineVersion < 20161210)
|
||||||
|
{
|
||||||
|
if (node.Key == "BridgeHut")
|
||||||
|
RenameNodeKey(node, "LegacyBridgeHut");
|
||||||
|
}
|
||||||
|
|
||||||
UpgradeActorRules(modData, engineVersion, ref node.Value.Nodes, node, depth + 1);
|
UpgradeActorRules(modData, engineVersion, ref node.Value.Nodes, node, depth + 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -448,7 +448,7 @@ BRIDGEHUT:
|
|||||||
Dimensions: 2,2
|
Dimensions: 2,2
|
||||||
CustomSelectionSize:
|
CustomSelectionSize:
|
||||||
CustomBounds: 48,48
|
CustomBounds: 48,48
|
||||||
BridgeHut:
|
LegacyBridgeHut:
|
||||||
Targetable:
|
Targetable:
|
||||||
TargetTypes: BridgeHut, C4
|
TargetTypes: BridgeHut, C4
|
||||||
|
|
||||||
|
|||||||
@@ -522,7 +522,7 @@ BRIDGEHUT:
|
|||||||
Selectable:
|
Selectable:
|
||||||
Bounds: 48,48
|
Bounds: 48,48
|
||||||
Priority: 2
|
Priority: 2
|
||||||
BridgeHut:
|
LegacyBridgeHut:
|
||||||
Targetable:
|
Targetable:
|
||||||
TargetTypes: BridgeHut, C4
|
TargetTypes: BridgeHut, C4
|
||||||
|
|
||||||
@@ -534,7 +534,7 @@ BRIDGEHUT.small:
|
|||||||
Selectable:
|
Selectable:
|
||||||
Bounds: 24,24
|
Bounds: 24,24
|
||||||
Priority: 2
|
Priority: 2
|
||||||
BridgeHut:
|
LegacyBridgeHut:
|
||||||
Targetable:
|
Targetable:
|
||||||
TargetTypes: BridgeHut, C4
|
TargetTypes: BridgeHut, C4
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user