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\WithCargo.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\SupportPowers\IonCannonPower.cs" />
<Compile Include="Widgets\Logic\CncMainMenuLogic.cs" />

View File

@@ -18,7 +18,7 @@ using OpenRA.Traits;
namespace OpenRA.Mods.Cnc.Traits
{
[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.")]
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.")]
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 AmmoPool ammoPool;
string sequence;
string ammoSuffix;
public WithReloadingTurret(Actor self, WithReloadingTurretInfo info)
public WithReloadingSpriteTurret(Actor self, WithReloadingSpriteTurretInfo info)
: base(self, info)
{
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\SupportPowerChargeBar.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\WithActiveAnimation.cs" />
<Compile Include="Traits\Render\WithAttackAnimation.cs" />
@@ -441,7 +441,7 @@
<Compile Include="Traits\Render\WithShadow.cs" />
<Compile Include="Traits\Render\WithSmoke.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\WithBuildingPlacedOverlay.cs" />
<Compile Include="Traits\Render\WithProductionDoorOverlay.cs" />

View File

@@ -17,7 +17,7 @@ using OpenRA.Traits;
namespace OpenRA.Mods.Common.Traits
{
[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>
{
[Desc("Sequence name to use.")]
@@ -29,7 +29,7 @@ namespace OpenRA.Mods.Common.Traits
[Desc("Visual offset.")]
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)
{
@@ -52,7 +52,7 @@ namespace OpenRA.Mods.Common.Traits
}
}
public class WithBarrel : UpgradableTrait<WithBarrelInfo>
public class WithSpriteBarrel : UpgradableTrait<WithSpriteBarrelInfo>
{
public readonly Animation DefaultAnimation;
readonly RenderSprites rs;
@@ -61,7 +61,7 @@ namespace OpenRA.Mods.Common.Traits
readonly Turreted turreted;
readonly BodyOrientation body;
public WithBarrel(Actor self, WithBarrelInfo info)
public WithSpriteBarrel(Actor self, WithSpriteBarrelInfo info)
: base(info)
{
this.self = self;

View File

@@ -17,7 +17,7 @@ using OpenRA.Traits;
namespace OpenRA.Mods.Common.Traits
{
[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>
{
[Desc("Sequence name to use")]
@@ -32,7 +32,7 @@ namespace OpenRA.Mods.Common.Traits
[Desc("Render recoil")]
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)
{
@@ -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;
protected readonly AttackBase Attack;
@@ -65,7 +65,7 @@ namespace OpenRA.Mods.Common.Traits
readonly Turreted t;
readonly Armament[] arms;
public WithTurret(Actor self, WithTurretInfo info)
public WithSpriteTurret(Actor self, WithSpriteTurretInfo info)
: base(info)
{
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);
}
}

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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