-
-
Notifications
You must be signed in to change notification settings - Fork 2.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Streamline turret render traits - part 2 #14036
Conversation
d108d33
to
31a748a
Compare
31a748a
to
4966002
Compare
02426aa
to
52494f3
Compare
var sequence = Attack.IsAttacking ? Info.AimSequence : Info.Sequence; | ||
DefaultAnimation.ReplaceAnim(sequence); | ||
} | ||
protected virtual void Tick(Actor self) { } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Better to remove ITick
completely, and if a subclass wants to tick then they can implement the interface themselves.
} | ||
|
||
void INotifyAttack.Attacking(Actor self, Target target, Armament a, Barrel barrel) | ||
{ | ||
if (info.DelayRelativeTo == AttackDelayType.Attack) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This appears to be almost completely duplicated with INotifyAttack.PreparingAttack
.
Could you split out a void NotifyAttack(Actor self, AttackDelayType type)
method that is called from each?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
PlayAttackAnimation(self); | ||
|
||
if (string.IsNullOrEmpty(info.AimSequence) && string.IsNullOrEmpty(info.ReloadPrefix)) | ||
if (IsTraitDisabled) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not much point having this as an early return. Just add !IsTraitDisabled
to the if statement below.
mods/cnc/cursors.yaml
Outdated
@@ -235,3 +235,10 @@ Cursors: | |||
Length: 8 | |||
attackoutsiderange-minimap: | |||
Start: 8 | |||
mouse8.shp: cursor |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rebase error?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oops.
|
||
public override void RulesetLoaded(Ruleset rules, ActorInfo ai) | ||
{ | ||
var matches = ai.TraitInfos<WithTurretAimAnimationInfo>().Count(t => t.Turret == Turret); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Style nit: .Any(t => t.Turret == Turret)
instead of Count != 0.
|
||
public override void RulesetLoaded(Ruleset rules, ActorInfo ai) | ||
{ | ||
var turretAttackAnim = ai.TraitInfos<WithTurretAttackAnimationInfo>().Any(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't this be checking the turret the same way as WithTurretAmmoReloadAnimationInfo
?
52494f3
to
ed98b2f
Compare
Basically depends on #13538 due to |
d350d6d
to
24a53eb
Compare
Updated and rebased. Note: Added a testcase commit that needs to be removed before merging (makes cnc mobile sam able to attack ground, for easier testing). |
8e8dda8
to
40ef9c6
Compare
Rebased and updated. Moved testcase here (TD Nod Mobile SAM): |
Has merge conflicts again with god-knows-what. |
With #14202. |
40ef9c6
to
18a1196
Compare
18a1196
to
c0c2e06
Compare
Rebased. |
And needs another rebase. |
I guess there's no point in rebasing this until the upgrade rule refactor is merged. |
Please don't forget to update the copyright notice year. |
WithReloadingSpriteTurret was bound to run into conflicts with any WithTurret*Animation traits due to overriding the turret sequence constantly via ITick. Using (stacked) conditions instead avoids that.
c0c2e06
to
045b186
Compare
These two didn't interact and actually even conflicted when used at the same time, so splitting them is the sensible thing to do.
We can now use WithTurretAimAnimation instead.
045b186
to
04fb88e
Compare
Rebased and updated. |
My idea for making #13619 more flexible is to use integer priority values instead of a single boolean, but even independently from that, our current turret render traits are a bit of a mess, especially when it comes to anything dealing with "aiming" at a target.
This needs to be sorted out first to avoid problems and work-arounds in #13619.
This PR straightens out that mess, so that both #13619 as well as any future additional
WithTurret*Animation
traits should have an easier time to do what they're intended to do without implicit conflicts or compatibility issues.