Rename WithTurret, WithBarrel and WithReloadingTurret

Make them use RenderUtils.ZOffsetFromCenter.
This commit is contained in:
reaperrr
2015-10-04 19:56:35 +02:00
parent 72ec431766
commit 35c4aca983
17 changed files with 99 additions and 45 deletions

View File

@@ -84,7 +84,7 @@
<Compile Include="Traits\Render\WithGunboatBody.cs" /> <Compile Include="Traits\Render\WithGunboatBody.cs" />
<Compile Include="Traits\Render\WithCargo.cs" /> <Compile Include="Traits\Render\WithCargo.cs" />
<Compile Include="Traits\Render\WithDeliveryAnimation.cs" /> <Compile Include="Traits\Render\WithDeliveryAnimation.cs" />
<Compile Include="Traits\Render\WithReloadingTurret.cs" /> <Compile Include="Traits\Render\WithReloadingSpriteTurret.cs" />
<Compile Include="Traits\Render\WithRoof.cs" /> <Compile Include="Traits\Render\WithRoof.cs" />
<Compile Include="Traits\SupportPowers\IonCannonPower.cs" /> <Compile Include="Traits\SupportPowers\IonCannonPower.cs" />
<Compile Include="Widgets\Logic\CncMainMenuLogic.cs" /> <Compile Include="Widgets\Logic\CncMainMenuLogic.cs" />

View File

@@ -18,7 +18,7 @@ using OpenRA.Traits;
namespace OpenRA.Mods.Cnc.Traits namespace OpenRA.Mods.Cnc.Traits
{ {
[Desc("Renders ammo-dependent turret graphics for units with the Turreted trait.")] [Desc("Renders ammo-dependent turret graphics for units with the Turreted trait.")]
public class WithReloadingTurretInfo : WithTurretInfo, Requires<AmmoPoolInfo>, Requires<ArmamentInfo> public class WithReloadingSpriteTurretInfo : WithSpriteTurretInfo, Requires<AmmoPoolInfo>, Requires<ArmamentInfo>
{ {
[Desc("AmmoPool to use for ammo-dependent sequences.")] [Desc("AmmoPool to use for ammo-dependent sequences.")]
public readonly string AmmoPoolName = null; public readonly string AmmoPoolName = null;
@@ -27,17 +27,17 @@ namespace OpenRA.Mods.Cnc.Traits
"Adds current reload stage to Sequence as suffix when a matching AmmoPool is present.")] "Adds current reload stage to Sequence as suffix when a matching AmmoPool is present.")]
public readonly int ReloadStages = -1; public readonly int ReloadStages = -1;
public override object Create(ActorInitializer init) { return new WithReloadingTurret(init.Self, this); } public override object Create(ActorInitializer init) { return new WithReloadingSpriteTurret(init.Self, this); }
} }
public class WithReloadingTurret : WithTurret public class WithReloadingSpriteTurret : WithSpriteTurret
{ {
readonly int reloadStages; readonly int reloadStages;
readonly AmmoPool ammoPool; readonly AmmoPool ammoPool;
string sequence; string sequence;
string ammoSuffix; string ammoSuffix;
public WithReloadingTurret(Actor self, WithReloadingTurretInfo info) public WithReloadingSpriteTurret(Actor self, WithReloadingSpriteTurretInfo info)
: base(self, info) : base(self, info)
{ {
ammoPool = self.TraitsImplementing<AmmoPool>().FirstOrDefault(a => a.Info.Name == info.AmmoPoolName); ammoPool = self.TraitsImplementing<AmmoPool>().FirstOrDefault(a => a.Info.Name == info.AmmoPoolName);

View File

@@ -412,7 +412,7 @@
<Compile Include="Traits\Render\ProductionBar.cs" /> <Compile Include="Traits\Render\ProductionBar.cs" />
<Compile Include="Traits\Render\SupportPowerChargeBar.cs" /> <Compile Include="Traits\Render\SupportPowerChargeBar.cs" />
<Compile Include="Traits\Render\TimedUpgradeBar.cs" /> <Compile Include="Traits\Render\TimedUpgradeBar.cs" />
<Compile Include="Traits\Render\WithBarrel.cs" /> <Compile Include="Traits\Render\WithSpriteBarrel.cs" />
<Compile Include="Traits\Render\WithBuildingExplosion.cs" /> <Compile Include="Traits\Render\WithBuildingExplosion.cs" />
<Compile Include="Traits\Render\WithActiveAnimation.cs" /> <Compile Include="Traits\Render\WithActiveAnimation.cs" />
<Compile Include="Traits\Render\WithAttackAnimation.cs" /> <Compile Include="Traits\Render\WithAttackAnimation.cs" />
@@ -441,7 +441,7 @@
<Compile Include="Traits\Render\WithShadow.cs" /> <Compile Include="Traits\Render\WithShadow.cs" />
<Compile Include="Traits\Render\WithSmoke.cs" /> <Compile Include="Traits\Render\WithSmoke.cs" />
<Compile Include="Traits\Render\WithSpriteBody.cs" /> <Compile Include="Traits\Render\WithSpriteBody.cs" />
<Compile Include="Traits\Render\WithTurret.cs" /> <Compile Include="Traits\Render\WithSpriteTurret.cs" />
<Compile Include="Traits\Render\WithFacingSpriteBody.cs" /> <Compile Include="Traits\Render\WithFacingSpriteBody.cs" />
<Compile Include="Traits\Render\WithBuildingPlacedOverlay.cs" /> <Compile Include="Traits\Render\WithBuildingPlacedOverlay.cs" />
<Compile Include="Traits\Render\WithProductionDoorOverlay.cs" /> <Compile Include="Traits\Render\WithProductionDoorOverlay.cs" />

View File

@@ -17,7 +17,7 @@ using OpenRA.Traits;
namespace OpenRA.Mods.Common.Traits namespace OpenRA.Mods.Common.Traits
{ {
[Desc("Renders barrels for units with the Turreted trait.")] [Desc("Renders barrels for units with the Turreted trait.")]
public class WithBarrelInfo : UpgradableTraitInfo, IRenderActorPreviewSpritesInfo, Requires<TurretedInfo>, public class WithSpriteBarrelInfo : UpgradableTraitInfo, IRenderActorPreviewSpritesInfo, Requires<TurretedInfo>,
Requires<ArmamentInfo>, Requires<RenderSpritesInfo>, Requires<BodyOrientationInfo> Requires<ArmamentInfo>, Requires<RenderSpritesInfo>, Requires<BodyOrientationInfo>
{ {
[Desc("Sequence name to use.")] [Desc("Sequence name to use.")]
@@ -29,7 +29,7 @@ namespace OpenRA.Mods.Common.Traits
[Desc("Visual offset.")] [Desc("Visual offset.")]
public readonly WVec LocalOffset = WVec.Zero; public readonly WVec LocalOffset = WVec.Zero;
public override object Create(ActorInitializer init) { return new WithBarrel(init.Self, this); } public override object Create(ActorInitializer init) { return new WithSpriteBarrel(init.Self, this); }
public IEnumerable<IActorPreview> RenderPreviewSprites(ActorPreviewInitializer init, RenderSpritesInfo rs, string image, int facings, PaletteReference p) public IEnumerable<IActorPreview> RenderPreviewSprites(ActorPreviewInitializer init, RenderSpritesInfo rs, string image, int facings, PaletteReference p)
{ {
@@ -52,7 +52,7 @@ namespace OpenRA.Mods.Common.Traits
} }
} }
public class WithBarrel : UpgradableTrait<WithBarrelInfo> public class WithSpriteBarrel : UpgradableTrait<WithSpriteBarrelInfo>
{ {
public readonly Animation DefaultAnimation; public readonly Animation DefaultAnimation;
readonly RenderSprites rs; readonly RenderSprites rs;
@@ -61,7 +61,7 @@ namespace OpenRA.Mods.Common.Traits
readonly Turreted turreted; readonly Turreted turreted;
readonly BodyOrientation body; readonly BodyOrientation body;
public WithBarrel(Actor self, WithBarrelInfo info) public WithSpriteBarrel(Actor self, WithSpriteBarrelInfo info)
: base(info) : base(info)
{ {
this.self = self; this.self = self;

View File

@@ -17,7 +17,7 @@ using OpenRA.Traits;
namespace OpenRA.Mods.Common.Traits namespace OpenRA.Mods.Common.Traits
{ {
[Desc("Renders turrets for units with the Turreted trait.")] [Desc("Renders turrets for units with the Turreted trait.")]
public class WithTurretInfo : UpgradableTraitInfo, IRenderActorPreviewSpritesInfo, public class WithSpriteTurretInfo : UpgradableTraitInfo, IRenderActorPreviewSpritesInfo,
Requires<RenderSpritesInfo>, Requires<TurretedInfo>, Requires<BodyOrientationInfo>, Requires<ArmamentInfo> Requires<RenderSpritesInfo>, Requires<TurretedInfo>, Requires<BodyOrientationInfo>, Requires<ArmamentInfo>
{ {
[Desc("Sequence name to use")] [Desc("Sequence name to use")]
@@ -32,7 +32,7 @@ namespace OpenRA.Mods.Common.Traits
[Desc("Render recoil")] [Desc("Render recoil")]
public readonly bool Recoils = true; public readonly bool Recoils = true;
public override object Create(ActorInitializer init) { return new WithTurret(init.Self, this); } public override object Create(ActorInitializer init) { return new WithSpriteTurret(init.Self, this); }
public IEnumerable<IActorPreview> RenderPreviewSprites(ActorPreviewInitializer init, RenderSpritesInfo rs, string image, int facings, PaletteReference p) public IEnumerable<IActorPreview> RenderPreviewSprites(ActorPreviewInitializer init, RenderSpritesInfo rs, string image, int facings, PaletteReference p)
{ {
@@ -56,7 +56,7 @@ namespace OpenRA.Mods.Common.Traits
} }
} }
public class WithTurret : UpgradableTrait<WithTurretInfo>, ITick, INotifyDamageStateChanged public class WithSpriteTurret : UpgradableTrait<WithSpriteTurretInfo>, ITick, INotifyDamageStateChanged
{ {
public readonly Animation DefaultAnimation; public readonly Animation DefaultAnimation;
protected readonly AttackBase Attack; protected readonly AttackBase Attack;
@@ -65,7 +65,7 @@ namespace OpenRA.Mods.Common.Traits
readonly Turreted t; readonly Turreted t;
readonly Armament[] arms; readonly Armament[] arms;
public WithTurret(Actor self, WithTurretInfo info) public WithSpriteTurret(Actor self, WithSpriteTurretInfo info)
: base(info) : base(info)
{ {
rs = self.Trait<RenderSprites>(); rs = self.Trait<RenderSprites>();

View File

@@ -2399,6 +2399,60 @@ namespace OpenRA.Mods.Common.UtilityCommands
} }
} }
if (engineVersion < 20151127)
{
// Rename WithTurret to WithSpriteTurret
if (depth == 1 && node.Key.StartsWith("WithTurret"))
{
var parts = node.Key.Split('@');
node.Key = "WithSpriteTurret";
if (parts.Length > 1)
node.Key += "@" + parts[1];
}
if (depth == 1 && node.Key.StartsWith("-WithTurret"))
{
var parts = node.Key.Split('@');
node.Key = "-WithSpriteTurret";
if (parts.Length > 1)
node.Key += "@" + parts[1];
}
// Rename WithBarrel to WithSpriteBarrel
if (depth == 1 && node.Key.StartsWith("WithBarrel"))
{
var parts = node.Key.Split('@');
node.Key = "WithSpriteBarrel";
if (parts.Length > 1)
node.Key += "@" + parts[1];
}
if (depth == 1 && node.Key.StartsWith("-WithBarrel"))
{
var parts = node.Key.Split('@');
node.Key = "-WithSpriteBarrel";
if (parts.Length > 1)
node.Key += "@" + parts[1];
}
// Rename WithReloadingTurret to WithReloadingSpriteTurret
if (depth == 1 && node.Key.StartsWith("WithReloadingTurret"))
{
var parts = node.Key.Split('@');
node.Key = "WithReloadingSpriteTurret";
if (parts.Length > 1)
node.Key += "@" + parts[1];
}
if (depth == 1 && node.Key.StartsWith("-WithReloadingTurret"))
{
var parts = node.Key.Split('@');
node.Key = "-WithReloadingSpriteTurret";
if (parts.Length > 1)
node.Key += "@" + parts[1];
}
}
UpgradeActorRules(engineVersion, ref node.Value.Nodes, node, depth + 1); UpgradeActorRules(engineVersion, ref node.Value.Nodes, node, depth + 1);
} }
} }

View File

@@ -114,7 +114,7 @@ APC:
MuzzleSequence: muzzle MuzzleSequence: muzzle
AttackTurreted: AttackTurreted:
WithMuzzleOverlay: WithMuzzleOverlay:
WithTurret: WithSpriteTurret:
AutoTarget: AutoTarget:
Cargo: Cargo:
Types: Infantry Types: Infantry
@@ -220,7 +220,7 @@ BGGY:
MuzzleSequence: muzzle MuzzleSequence: muzzle
AttackTurreted: AttackTurreted:
WithMuzzleOverlay: WithMuzzleOverlay:
WithTurret: WithSpriteTurret:
AutoTarget: AutoTarget:
SpawnActorOnDeath: SpawnActorOnDeath:
Actor: BGGY.Husk Actor: BGGY.Husk
@@ -290,7 +290,7 @@ JEEP:
MuzzleSequence: muzzle MuzzleSequence: muzzle
AttackTurreted: AttackTurreted:
WithMuzzleOverlay: WithMuzzleOverlay:
WithTurret: WithSpriteTurret:
AutoTarget: AutoTarget:
SpawnActorOnDeath: SpawnActorOnDeath:
Actor: JEEP.Husk Actor: JEEP.Husk
@@ -325,7 +325,7 @@ LTNK:
MuzzleSequence: muzzle MuzzleSequence: muzzle
AttackTurreted: AttackTurreted:
WithMuzzleOverlay: WithMuzzleOverlay:
WithTurret: WithSpriteTurret:
AutoTarget: AutoTarget:
SpawnActorOnDeath: SpawnActorOnDeath:
Actor: LTNK.Husk Actor: LTNK.Husk
@@ -359,7 +359,7 @@ MTNK:
MuzzleSequence: muzzle MuzzleSequence: muzzle
AttackTurreted: AttackTurreted:
WithMuzzleOverlay: WithMuzzleOverlay:
WithTurret: WithSpriteTurret:
AutoTarget: AutoTarget:
SpawnActorOnDeath: SpawnActorOnDeath:
Actor: MTNK.Husk Actor: MTNK.Husk
@@ -387,7 +387,7 @@ HTNK:
Type: Heavy Type: Heavy
RevealsShroud: RevealsShroud:
Range: 6c0 Range: 6c0
WithTurret: WithSpriteTurret:
Turreted: Turreted:
ROT: 3 ROT: 3
Armament@PRIMARY: Armament@PRIMARY:
@@ -445,7 +445,7 @@ MSAM:
Weapon: 227mm Weapon: 227mm
LocalOffset: 213,-128,0, 213,128,0 LocalOffset: 213,-128,0, 213,128,0
AttackFrontal: AttackFrontal:
WithTurret: WithSpriteTurret:
AimSequence: aim AimSequence: aim
AutoTarget: AutoTarget:
SpawnActorOnDeath: SpawnActorOnDeath:
@@ -485,7 +485,7 @@ MLRS:
ReloadCount: 1 ReloadCount: 1
SelfReloadTicks: 100 SelfReloadTicks: 100
AttackTurreted: AttackTurreted:
WithReloadingTurret: WithReloadingSpriteTurret:
AmmoPoolName: primary AmmoPoolName: primary
AutoTarget: AutoTarget:
InitialStanceAI: Defend InitialStanceAI: Defend

View File

@@ -283,7 +283,7 @@
^Defense: ^Defense:
Inherits: ^Building Inherits: ^Building
WithTurret: WithSpriteTurret:
AttackTurreted: AttackTurreted:
AutoTarget: AutoTarget:
RenderRangeCircle: RenderRangeCircle:

View File

@@ -205,7 +205,7 @@ siege_tank:
MuzzleSequence: muzzle MuzzleSequence: muzzle
AttackFrontal: AttackFrontal:
WithMuzzleOverlay: WithMuzzleOverlay:
WithTurret: WithSpriteTurret:
Explodes: Explodes:
Weapon: UnitExplodeMed Weapon: UnitExplodeMed
EmptyWeapon: UnitExplodeMed EmptyWeapon: UnitExplodeMed
@@ -465,7 +465,7 @@ deviator:
MuzzleSequence: muzzle MuzzleSequence: muzzle
AttackTurreted: AttackTurreted:
WithMuzzleOverlay: WithMuzzleOverlay:
WithTurret: WithSpriteTurret:
AutoTarget: AutoTarget:
Explodes: Explodes:
Weapon: UnitExplodeMed Weapon: UnitExplodeMed

View File

@@ -1388,7 +1388,7 @@ Rules:
-Huntable: -Huntable:
-Targetable: -Targetable:
-Armament: -Armament:
-WithTurret: -WithSpriteTurret:
-WithMuzzleOverlay: -WithMuzzleOverlay:
Cargo: Cargo:
Types: ~disabled Types: ~disabled

View File

@@ -2209,7 +2209,7 @@ Rules:
MuzzleSequence: muzzle MuzzleSequence: muzzle
AttackTurreted: AttackTurreted:
WithMuzzleOverlay: WithMuzzleOverlay:
WithTurret: WithSpriteTurret:
AutoTarget: AutoTarget:
Explodes: Explodes:
Weapon: MiniNuke Weapon: MiniNuke

View File

@@ -149,7 +149,7 @@ DD:
AttackTurreted: AttackTurreted:
SelectionDecorations: SelectionDecorations:
VisualBounds: 38,38 VisualBounds: 38,38
WithTurret: WithSpriteTurret:
AutoTarget: AutoTarget:
DetectCloaked: DetectCloaked:
CloakTypes: Underwater CloakTypes: Underwater
@@ -204,9 +204,9 @@ CA:
WithMuzzleOverlay: WithMuzzleOverlay:
SelectionDecorations: SelectionDecorations:
VisualBounds: 44,44 VisualBounds: 44,44
WithTurret@PRIMARY: WithSpriteTurret@PRIMARY:
Turret: primary Turret: primary
WithTurret@SECONDARY: WithSpriteTurret@SECONDARY:
Turret: secondary Turret: secondary
AutoTarget: AutoTarget:
@@ -277,7 +277,7 @@ PT:
WithMuzzleOverlay: WithMuzzleOverlay:
SelectionDecorations: SelectionDecorations:
VisualBounds: 36,36 VisualBounds: 36,36
WithTurret: WithSpriteTurret:
AutoTarget: AutoTarget:
DetectCloaked: DetectCloaked:
CloakTypes: Underwater CloakTypes: Underwater

View File

@@ -61,7 +61,7 @@ V2RL:
MuzzleSequence: muzzle MuzzleSequence: muzzle
AttackTurreted: AttackTurreted:
WithMuzzleOverlay: WithMuzzleOverlay:
WithTurret: WithSpriteTurret:
AutoTarget: AutoTarget:
SpawnActorOnDeath: SpawnActorOnDeath:
Actor: 1TNK.Husk Actor: 1TNK.Husk
@@ -98,7 +98,7 @@ V2RL:
MuzzleSequence: muzzle MuzzleSequence: muzzle
AttackTurreted: AttackTurreted:
WithMuzzleOverlay: WithMuzzleOverlay:
WithTurret: WithSpriteTurret:
AutoTarget: AutoTarget:
SpawnActorOnDeath: SpawnActorOnDeath:
Actor: 2TNK.Husk Actor: 2TNK.Husk
@@ -137,7 +137,7 @@ V2RL:
MuzzleSequence: muzzle MuzzleSequence: muzzle
AttackTurreted: AttackTurreted:
WithMuzzleOverlay: WithMuzzleOverlay:
WithTurret: WithSpriteTurret:
AutoTarget: AutoTarget:
SpawnActorOnDeath: SpawnActorOnDeath:
Actor: 3TNK.Husk Actor: 3TNK.Husk
@@ -185,7 +185,7 @@ V2RL:
MuzzleSequence: muzzle MuzzleSequence: muzzle
AttackTurreted: AttackTurreted:
WithMuzzleOverlay: WithMuzzleOverlay:
WithTurret: WithSpriteTurret:
AutoTarget: AutoTarget:
SpawnActorOnDeath: SpawnActorOnDeath:
Actor: 4TNK.Husk Actor: 4TNK.Husk
@@ -344,7 +344,7 @@ JEEP:
MuzzleSequence: muzzle MuzzleSequence: muzzle
AttackTurreted: AttackTurreted:
WithMuzzleOverlay: WithMuzzleOverlay:
WithTurret: WithSpriteTurret:
AutoTarget: AutoTarget:
Cargo: Cargo:
Types: Infantry Types: Infantry
@@ -608,7 +608,7 @@ FTRK:
MuzzleSequence: muzzle MuzzleSequence: muzzle
AttackTurreted: AttackTurreted:
WithMuzzleOverlay: WithMuzzleOverlay:
WithTurret: WithSpriteTurret:
AutoTarget: AutoTarget:
SelectionDecorations: SelectionDecorations:
VisualBounds: 28,28 VisualBounds: 28,28
@@ -738,7 +738,7 @@ STNK:
Turreted: Turreted:
ROT: 5 ROT: 5
AttackTurreted: AttackTurreted:
WithTurret: WithSpriteTurret:
Cargo: Cargo:
Types: Infantry Types: Infantry
MaxWeight: 4 MaxWeight: 4

View File

@@ -62,17 +62,17 @@ GACTWR:
UpgradeMinEnabledLevel: 1 UpgradeMinEnabledLevel: 1
CanPowerDown: CanPowerDown:
IndicatorPalette: mouse IndicatorPalette: mouse
WithTurret@VULC: WithSpriteTurret@VULC:
UpgradeTypes: tower.vulcan UpgradeTypes: tower.vulcan
UpgradeMinEnabledLevel: 1 UpgradeMinEnabledLevel: 1
Recoils: no Recoils: no
Sequence: turret-vulcan Sequence: turret-vulcan
WithTurret@ROCKET: WithSpriteTurret@ROCKET:
UpgradeTypes: tower.rocket UpgradeTypes: tower.rocket
UpgradeMinEnabledLevel: 1 UpgradeMinEnabledLevel: 1
Recoils: no Recoils: no
Sequence: turret-rocket Sequence: turret-rocket
WithTurret@SAM: WithSpriteTurret@SAM:
UpgradeTypes: tower.sam UpgradeTypes: tower.sam
UpgradeMinEnabledLevel: 1 UpgradeMinEnabledLevel: 1
Recoils: no Recoils: no

View File

@@ -145,7 +145,7 @@ MMCH:
ROT: 5 ROT: 5
AttackTurreted: AttackTurreted:
Voice: Attack Voice: Attack
WithTurret: WithSpriteTurret:
Recoils: no Recoils: no
Armament: Armament:
Weapon: 120mm Weapon: 120mm

View File

@@ -134,7 +134,7 @@ NASAM:
ROT: 10 ROT: 10
InitialFacing: 50 InitialFacing: 50
AttackTurreted: AttackTurreted:
WithTurret: WithSpriteTurret:
Recoils: no Recoils: no
Armament: Armament:
Weapon: RedEye2 Weapon: RedEye2

View File

@@ -28,7 +28,7 @@ NAPULS:
AttackTurreted: AttackTurreted:
Armament: Armament:
Weapon: EMPulseCannon Weapon: EMPulseCannon
WithTurret: WithSpriteTurret:
Sequence: turret Sequence: turret
Power: Power:
Amount: -150 Amount: -150