Commit Graph

509 Commits

Author SHA1 Message Date
reaperrr
1098804f9b Make WithSpriteBody always use Animation.PlayRepeating
... for looped sequences.

PlayCustomAnimationRepeating looping back into itself via Action instead of simply using Animation.PlayRepeating is weird, and in fact causes a slight 'desync' in animation speed with Animation.PlayRepeating in at least one downstream mod.
2018-09-24 22:06:10 +02:00
Matthias Mailänder
cb05d8a98d Fix CustomTerrainDebugOverlay not rendered in isometric mods 2018-09-19 20:04:41 +02:00
reaperrr
bbf6e38faa Always leave trails when no TerrainTypes are defined
Requiring terrain types is bogus, as it unnecessarily complicates using this trait for airborne units.
2018-09-10 19:45:02 +02:00
Paul Chote
1b1521812c Add EnabledByDefault check to WithInfantryBody. 2018-08-11 14:30:01 +02:00
Paul Chote
d110a21bfe Add missing EnabledByDefault checks to WithSpriteBodyInfo subclasses. 2018-08-11 14:30:01 +02:00
Chris Forbes
51e000599a Convert crushclasses to bitset 2018-07-28 21:28:46 +01:00
Chris Forbes
d4ef841678 Convert masses of HashSet<string> to BitSet<DamageType> 2018-07-28 20:12:42 +01:00
Mustafa Alperen Seki
f05fc0cae8 Add WithProductionOverlay>Queues 2018-07-28 16:17:47 +01:00
reaperrr
9d24c40f92 Fix various Mods.Common animation traits not supporting actors having multiple sprite bodies 2018-07-01 13:16:07 +02:00
reaperrr
0d0d2e0ae3 Play WithAcceptDeliveredCashAnimation only on the assigned WithSpriteBody 2018-07-01 13:16:07 +02:00
Paul Chote
6b6167d37c Use the default sprite sequence for automatic mouse bounds. 2018-07-01 01:20:55 +02:00
reaperrr
2136d6dc4a Split and refactor aim animation from WithAttackAnimation
Splitting it from the attack animation, triggering start and end of the aiming animation via interface, as well as removing ReloadPrefix (in favor of switching sprite bodies via condition when reloading) allows us to drop updating via ITick, which in turn will make it much easier to ultimately make this trait compatible with other animation traits, once the priority system lands.
2018-06-03 12:23:54 +01:00
reaperrr
7d4956e309 Refactor WithTurretAimAnimation using INotifyAiming
Triggering start and end of the aiming animation via interface, as well as removing ReloadPrefix (in favor of switching sprite bodies via condition when reloading), allows us to drop updating via ITick, which in turn will make it much easier to ultimately make this trait compatible with other animation traits, once the priority system lands.
2018-06-03 12:23:54 +01:00
Paul Chote
eccfac7840 Add blink parameters to WithDecoration. 2018-06-02 18:12:08 +02:00
Paul Chote
bb34d4de49 Add conditional offset support to WithDecoration. 2018-06-02 18:12:08 +02:00
Paul Chote
2ef6f7c0cc Replace repair indicator effect with a Decoration subclass. 2018-06-02 18:12:08 +02:00
Paul Chote
768265bbd2 Unify TargetFlash handling around Targets. 2018-05-30 18:06:59 +02:00
reaperrr
3a82b13093 Make INotifyKilled require explicit implementation 2018-04-29 11:59:49 +01:00
reaperrr
7ca9aa5e0b Make INotifyDamage require explicit implementation 2018-04-29 11:59:49 +01:00
reaperrr
ccd070afd6 Make IRenderModifier require explicit implementation 2018-04-29 11:59:49 +01:00
RoosterDragon
d2f2029caf Add FirstNonEmptyBounds method for IDecorationBounds interface.
This provides a more efficient way of determining the bounds by avoiding LINQ. A helper that works directly on arrays prevents allocation of an enumerator when the collection is know to be an array.
2018-03-18 22:06:12 +01:00
reaperrr
fd83cbf60f Fix WithTurretAimAnimation disabled handling
The old sequence was not recovering when this trait lost its required
condition while the aim anim was running.

Now it doesn't unconditionally return, but instead checks what the
current sequence is and resets to base turret sequence if AimAnim is
disabled.
2018-03-10 00:13:42 +01:00
Mustafa Alperen Seki
1d8b1906ef Add IsPlayerPalette support to WithDecoration 2018-03-10 00:12:56 +01:00
reaperrr
5a889c0efd De-duplicate some WithTurretAttackAnimation code 2018-03-09 21:30:30 +01:00
reaperrr
769a49ef0b Make WithTurretAimAnimation conditional 2018-03-09 21:30:30 +01:00
reaperrr
76da40bbda Make WithTurretAttackAnimation conditional 2018-03-09 21:30:30 +01:00
reaperrr
79c78090d1 Remove WithSpriteTurret.AimSequence
We can now use WithTurretAimAnimation instead.
2018-03-09 19:28:29 +01:00
reaperrr
a1ad76ba74 Split *AimAnimation from WithTurretAttackAnimation
These two didn't interact and actually even conflicted when used at the same time, so splitting them is the sensible thing to do.
2018-03-09 19:28:29 +01:00
Mustafa Alperen Seki
99eedfd0e7 Make SupportPowerChargeBar conditional 2018-02-06 21:09:38 +01:00
Arular101
8a60918841 Update copyright notice year to 2018 2018-01-17 00:47:34 +01:00
Mustafa Alperen Seki
7f77e4cf40 Remove ProductionDoorOverlay while transforming 2017-12-27 13:50:58 +00:00
Paul Chote
ec97214c16 Fix ProductionOverlay crash. 2017-12-25 21:34:31 +01:00
Unknown
4be593123d add me (jongleur1983) to AUTHORS
#14558: MovingToRefinery takes actor instead of CPos

DeliveryOffset (previously added by the harvester) is now taken into account by the AutoCarryable
fix whitespaces
2017-12-25 03:52:44 +01:00
reaperrr
04fb0f209d Spatially partition some actor overlays 2017-12-23 17:56:11 +00:00
reaperrr
c1cba4ecc1 Make Gate more independent from Building and pausable-conditional
Replace Gate IsDisabled checks with IsTraitDisabled/Paused checks
2017-12-17 21:18:44 +00:00
Paul Chote
c87409ed1a Remove legacy bounds code. 2017-12-11 19:45:07 +01:00
Paul Chote
ff5b4b15b3 Introduce IDecorationBounds to replace Actor.SelectionOverlayBounds. 2017-12-11 19:45:07 +01:00
Paul Chote
6f5d035e79 Introduce IMouseBounds and split/rework mouse rectangles.
The render bounds for an actor now include the area covered
by bibs, shadows, and any other widgets. In many cases this
area is much larger than we really want to consider for
tooltips and mouse selection.

An optional Margin is added to Selectable to support cases
like infantry, where we want the mouse area of the actor
to be larger than the drawn selection box.
2017-12-11 19:45:07 +01:00
Paul Chote
8fcc80b05a Use IRender.ScreenBounds in ScreenMap.
Traits are now required to trigger a ScreenMap update whenever they
believe that their ScreenBounds have changed.
2017-12-11 19:45:07 +01:00
Paul Chote
fa65fef4d1 Add IRenderModifier.ModifyScreenBounds to support WithShadow. 2017-12-11 19:45:07 +01:00
Paul Chote
86bfe28ade Add ScreenBounds method to IRender interface.
This method is expected to return Rectangles that cover
the region where Renderables returned by Render may exist.
2017-12-11 19:45:07 +01:00
RoosterDragon
7a7eed4fb7 Add FirstEnabledTraitOrDefault helper method.
This avoids the allocations caused by LINQ when using traits.FirstOrDefault(Exts.IsTraitEnabled). This is important in FrozenActorLayer.RefreshState which is called very often. We apply the new helper method to all areas using the old pattern. An overload that takes an array allows arrays to be enumerated without causing allocations.
2017-12-10 13:39:24 +00:00
Paul Chote
b898b5001a Rename AttackBase.IsAttacking to IsAiming to make its uses and assumptions clear. 2017-11-26 15:58:00 +01:00
Marwan
8a38c6ef23 WithTextDecoration Fix 2017-11-26 15:35:50 +01:00
reaperrr
56b6aabbb8 Use new IAutoRenderSize for determining actor render bounds 2017-11-21 01:00:09 +02:00
reaperrr
5a596d27c9 Switch RenderNameTag to use SelectionOverlayBounds 2017-11-21 01:00:09 +02:00
reaperrr
be290cfabd Split Actor.Bounds into RenderBounds and SelectableBounds
Additionally, internally renamed VisualBounds to SelectionOverlayBounds to avoid confusion with RenderBounds.

This step was necessary to prevent actors with selectable area smaller than their graphics to be removed too early from ScreenMap even though part of the graphics should still be visible.
RA cruisers were a prime example, but to a lesser extent several other actors were affected as well.

This separation also serves as preparation to determine the final RenderBounds from multiple source bounds later, to fix the remaining ScreenMap issues (building 'bibs', aircraft shadows).
2017-11-21 01:00:09 +02:00
Andre Mohren
25968ee66f Allow WithIdleOverlayInfo to render while the actor is being build. 2017-11-19 16:52:59 +00:00
reaperrr
917c6884ed Make WithSpriteBody a pausable trait
Allowing to drop the PauseAnimationWhenDisabled property (in favor of using PausOnCondition).
2017-11-13 03:09:05 +02:00
reaperrr
8533debc44 Require explicit INotifyAddedToWorld and INotifyRemovedFromWorld 2017-10-07 10:17:11 +02:00