Commit Graph

468 Commits

Author SHA1 Message Date
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
reaperrr
9e138178ad WithAttackAnimation style fix
Looks better this way.
2017-07-01 12:33:51 +01:00
reaperrr
9c2e3aaa05 Make WithMoveAnimation conditional and modify only a single assigned sprite body
The latter to match what we do on WithAttackAnimation already.
2017-07-01 12:33:51 +01:00
Paul Chote
6ca0208694 Rename VoxelPreview to ModelPreview. 2017-06-14 18:56:06 +02:00
Paul Chote
736e70df78 Rename VoxelRenderable to ModelRenderable. 2017-06-14 18:56:06 +02:00
Paul Chote
34810756c2 Move Voxel code to Mods.Cnc. 2017-06-14 18:56:06 +02:00
Paul Chote
4f42778d26 Rename VoxelAnimation to ModelAnimation. 2017-06-14 18:56:06 +02:00
reaperrr
d52313ab18 Rename WithAttackAnimation.BodyName to just .Body
Shorter and more consistent with Armament.Turret, WithTurretedAttackAnimation.Turret, WithSpriteBarrel.Armament etc.
2017-06-12 19:01:10 -05:00
reaperrr
fef388834e Throw yaml exception if WithAttackAnimation has no assigned sprite body
...or too many assigned bodies.

Also, further simplify WithAttackAnimation code.
2017-06-12 19:01:10 -05:00
reaperrr
5fb468922e Make WithAttackAnimation conditional 2017-06-12 19:01:10 -05:00
reaperrr
2e70b6931b Refactor WithAttackAnimation
- made trait compatible with actors that have more than one sprite body or enable/disable sprite bodies via conditions
- added check for running attack anim and prevent aim/reload sequences from overriding it
- added caching of whether trait has either aim or reload sequence, to avoid some string.IsNullOrEmpty look-ups every tick
2017-06-12 19:01:10 -05:00
abcdefg30
2a3139dc39 Add a IAutoSelctionSizeInfo trait interface 2017-05-28 14:02:18 +02:00
Paul Chote
d45870ca23 Allow fixed barrel pitches to be defined in yaml. 2017-05-14 11:52:42 +01:00
reaperrr
aa8d9f5dda Fix GrantConditionOnDeploy to support multiple sprite bodies 2017-05-14 00:22:26 -05:00
reaperrr
6f19379a2b Make WithMoveAnimation multi-WithSpriteBody-compatible 2017-05-14 00:22:26 -05:00
reaperrr
3b798897be Add Name ID field to WithSpriteBody 2017-05-14 00:22:26 -05:00
Paul Chote
5dcb840f9f Fix WithHarvesterOffset.LocalOffset name. 2017-05-07 13:44:47 +01:00
Paul Chote
d787429a2e Merge pull request #12996 from atlimit8/RemoveIDisable-part2
Remove IDisable - part 2
2017-05-07 08:38:09 +01:00
atlimit8
700b117122 Convert WithRepairAnimation from disable to conditional. 2017-05-06 17:19:43 -05:00
atlimit8
5fd4b3a1bd Convert WithRearmAnimation from disable to conditional. 2017-05-06 17:19:42 -05:00
atlimit8
b0706e7cd0 Removes actor disabled support from WithIdleAnimation. 2017-05-06 17:19:42 -05:00
atlimit8
64a2b9de55 WithRepairOverlay into pausable-conditional trait EMP disabled polish. 2017-05-06 17:19:42 -05:00