Merge pull request #10225 from reaperrr/disable-turret
Disable WithSpriteTurret until build/transform complete
This commit is contained in:
@@ -56,7 +56,7 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public class WithSpriteTurret : UpgradableTrait<WithSpriteTurretInfo>, ITick, INotifyDamageStateChanged
|
public class WithSpriteTurret : UpgradableTrait<WithSpriteTurretInfo>, INotifyBuildComplete, INotifySold, INotifyTransform, ITick, INotifyDamageStateChanged
|
||||||
{
|
{
|
||||||
public readonly Animation DefaultAnimation;
|
public readonly Animation DefaultAnimation;
|
||||||
protected readonly AttackBase Attack;
|
protected readonly AttackBase Attack;
|
||||||
@@ -65,6 +65,9 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
readonly Turreted t;
|
readonly Turreted t;
|
||||||
readonly Armament[] arms;
|
readonly Armament[] arms;
|
||||||
|
|
||||||
|
// TODO: This should go away once https://github.com/OpenRA/OpenRA/issues/7035 is implemented
|
||||||
|
bool buildComplete;
|
||||||
|
|
||||||
public WithSpriteTurret(Actor self, WithSpriteTurretInfo info)
|
public WithSpriteTurret(Actor self, WithSpriteTurretInfo info)
|
||||||
: base(info)
|
: base(info)
|
||||||
{
|
{
|
||||||
@@ -75,11 +78,14 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
.First(tt => tt.Name == info.Turret);
|
.First(tt => tt.Name == info.Turret);
|
||||||
arms = self.TraitsImplementing<Armament>()
|
arms = self.TraitsImplementing<Armament>()
|
||||||
.Where(w => w.Info.Turret == info.Turret).ToArray();
|
.Where(w => w.Info.Turret == info.Turret).ToArray();
|
||||||
|
buildComplete = !self.Info.HasTraitInfo<BuildingInfo>(); // always render instantly for units
|
||||||
|
|
||||||
DefaultAnimation = new Animation(self.World, rs.GetImage(self), () => t.TurretFacing);
|
DefaultAnimation = new Animation(self.World, rs.GetImage(self), () => t.TurretFacing);
|
||||||
DefaultAnimation.PlayRepeating(NormalizeSequence(self, info.Sequence));
|
DefaultAnimation.PlayRepeating(NormalizeSequence(self, info.Sequence));
|
||||||
rs.Add(new AnimationWithOffset(
|
rs.Add(new AnimationWithOffset(DefaultAnimation,
|
||||||
DefaultAnimation, () => TurretOffset(self), () => IsTraitDisabled, p => RenderUtils.ZOffsetFromCenter(self, p, 1)));
|
() => TurretOffset(self),
|
||||||
|
() => IsTraitDisabled || !buildComplete,
|
||||||
|
p => RenderUtils.ZOffsetFromCenter(self, p, 1)));
|
||||||
|
|
||||||
// Restrict turret facings to match the sprite
|
// Restrict turret facings to match the sprite
|
||||||
t.QuantizedFacings = DefaultAnimation.CurrentSequence.Facings;
|
t.QuantizedFacings = DefaultAnimation.CurrentSequence.Facings;
|
||||||
@@ -116,5 +122,12 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
var sequence = Attack.IsAttacking ? Info.AimSequence : Info.Sequence;
|
var sequence = Attack.IsAttacking ? Info.AimSequence : Info.Sequence;
|
||||||
DefaultAnimation.ReplaceAnim(sequence);
|
DefaultAnimation.ReplaceAnim(sequence);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void INotifyBuildComplete.BuildingComplete(Actor self) { buildComplete = true; }
|
||||||
|
void INotifySold.Selling(Actor self) { buildComplete = false; }
|
||||||
|
void INotifySold.Sold(Actor self) { }
|
||||||
|
void INotifyTransform.BeforeTransform(Actor self) { buildComplete = false; }
|
||||||
|
void INotifyTransform.OnTransform(Actor self) { }
|
||||||
|
void INotifyTransform.AfterTransform(Actor toActor) { }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -293,7 +293,6 @@
|
|||||||
AutoTarget:
|
AutoTarget:
|
||||||
RenderRangeCircle:
|
RenderRangeCircle:
|
||||||
-GivesBuildableArea:
|
-GivesBuildableArea:
|
||||||
-WithCrumbleOverlay:
|
|
||||||
-WithMakeAnimation:
|
-WithMakeAnimation:
|
||||||
-WithSpriteBody:
|
-WithSpriteBody:
|
||||||
WithWallSpriteBody:
|
WithWallSpriteBody:
|
||||||
|
|||||||
@@ -30,6 +30,14 @@ medium_gun_turret:
|
|||||||
Frames: 2621, 2624, 2622, 2632, 2625, 2626, 2636, 2629, 2623, 2633, 2627, 2628, 2634, 2630, 2631, 2635
|
Frames: 2621, 2624, 2622, 2632, 2625, 2626, 2636, 2629, 2623, 2633, 2627, 2628, 2634, 2630, 2631, 2635
|
||||||
Length: 16
|
Length: 16
|
||||||
Offset: -24,16
|
Offset: -24,16
|
||||||
|
make: DATA.R8 #TODO: unused, enabling WMA currently breaks turrets (bleed 20151214)
|
||||||
|
Start: 4313
|
||||||
|
Length: 8
|
||||||
|
Offset: -16,16
|
||||||
|
crumble-overlay: DATA.R8
|
||||||
|
Start: 4321
|
||||||
|
Length: 7
|
||||||
|
Offset: -16,16
|
||||||
turret: DATA.R8
|
turret: DATA.R8
|
||||||
Start: 2589
|
Start: 2589
|
||||||
Facings: -32
|
Facings: -32
|
||||||
@@ -53,6 +61,14 @@ large_gun_turret:
|
|||||||
Frames: 2621, 2624, 2622, 2632, 2625, 2626, 2636, 2629, 2623, 2633, 2627, 2628, 2634, 2630, 2631, 2635
|
Frames: 2621, 2624, 2622, 2632, 2625, 2626, 2636, 2629, 2623, 2633, 2627, 2628, 2634, 2630, 2631, 2635
|
||||||
Length: 16
|
Length: 16
|
||||||
Offset: -24,16
|
Offset: -24,16
|
||||||
|
make: DATA.R8 #TODO: unused, enabling WMA currently breaks turrets (bleed 20151214)
|
||||||
|
Start: 4313
|
||||||
|
Length: 8
|
||||||
|
Offset: -16,16
|
||||||
|
crumble-overlay: DATA.R8
|
||||||
|
Start: 4321
|
||||||
|
Length: 7
|
||||||
|
Offset: -16,16
|
||||||
turret: DATA.R8
|
turret: DATA.R8
|
||||||
Start: 2637
|
Start: 2637
|
||||||
Facings: -32
|
Facings: -32
|
||||||
|
|||||||
Reference in New Issue
Block a user