Commit Graph

539 Commits

Author SHA1 Message Date
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
Mustafa Alperen Seki
2102fad2b5 Add CashTricklerBar 2017-10-06 23:02:02 +02:00
Forcecore
18c6fe09db Sound and Animation support for DonateCash 2017-10-06 18:07:18 +02:00
reaperrr
5026dfe5d3 Require explicit INotifyCreated 2017-09-28 13:14:08 +02:00
Matthias Mailänder
0018bf3063 Add start and stop repair overlay animation support. 2017-09-24 11:43:49 +01:00
Andre Mohren
800f6adc21 Made WithSpriteTurret.TurretOffset protected virtual to be overridden by mod traits. 2017-09-22 13:29:15 +02:00
reaperrr
28e1f391e0 Make ITick require explicit implementation 2017-09-16 15:51:37 +02:00
reaperrr
ddfed13db4 Make Tick and TickIdle explicit in WithInfantryBody 2017-09-16 15:51:37 +02:00
reaperrr
dbcfb0c92e Rename and move WithTurretedSpriteBody
The name wasn't in line with our implicit naming convention and ambigous on top of that.
Also, only used by RA and TD so moved to Mods.Cnc.
2017-09-15 18:10:13 +01:00
reaperrr
c611b5aeeb Remove 'ed' from WithTurretedAttackAnimation
Too confusing, as people might think it requires 'WithTurretedSpriteBody', also not entirely in line with our (admittedly implicit) render trait naming convention.
2017-09-15 18:10:13 +01:00
Matthias Mailänder
4526344eed Add WithNukeLaunchAnimation and -Overlay traits. 2017-09-02 15:10:35 +02:00
reaperrr
d1a4133752 Fix WithShadow
It *modifies* the actor rendering, so returning an empty renderable was bogus, as were the IsInWorld/IsDead checks.
2017-08-31 16:54:03 +02:00
reaperrr
120d7f9976 WithHarvestAnimation style fixes
Make interface implementations explicit.
2017-08-23 12:34:00 +02:00
reaperrr
0103b7ca87 Make WithSpriteBody.PlayCustomAnimation resume loop of Sequence
...after it finished playing.
2017-08-23 12:34:00 +02:00
reaperrr
90a4fe7ca1 Resume looping default WithSpriteTurret.Sequence after custom anim
It doesn't really make sense not to, and the only trait using PlayCustomAnimation previously did this manually anyway.
2017-08-23 12:34:00 +02:00
reaperrr
cab6a96b16 Allow skipping make anim for actors with WithMakeAnimation and GrantConditionOnDeploy 2017-08-17 22:03:42 +01:00
reaperrr
d949e17b88 Perform FogObscures as late as possible
FogObscures is more expensive than simpler boolean, player or HasTraitInfo checks, so in these places it makes sense to perform the other checks first.
2017-08-07 09:42:12 +02:00
rob-v
d4e9e0e069 Add Visualization chat commands 2017-07-23 15:08:24 +02:00
Jean-Rémy Buchs
488440197e Add new trait ReloadArmamentsBar which renders a bar to show the current reload status 2017-07-16 14:58:00 +01:00
reaperrr
fdb3866238 Remove FootprintUtils 2017-07-13 17:43:41 +02:00
Jean-Rémy Buchs
6749060e57 Add RangeCircleMode to trait RenderRangeCircle 2017-07-12 00:10:52 +02:00