Commit Graph

188 Commits

Author SHA1 Message Date
Oliver Brakmann
b4fd7331b2 Simplify Activity class
After the removal of the CompositeActivity class, all the supporting
code that made it work can be removed as well.
2019-03-30 14:38:23 +00:00
tovl
705795abde Activity.Cancel returns void instead of bool. 2019-03-09 21:47:43 +00:00
tovl
8191a6566b Add missing self and optional pretick parameters to Queue, QueueChild and PrintActivity methods.
This means sequenceActivities needs to accept self as well.
2019-03-09 21:47:43 +00:00
Paul Chote
ab4a7e3558 Replace System.Drawing primitives with our own. 2019-03-04 18:26:42 +00:00
abcdefg30
cadbd0d9ab Change the year number in all cs headers from 2018 to 2019 2019-01-26 23:15:21 +01:00
Paul Chote
a545b2e5fa Deselect actors when their owner changes. 2019-01-26 21:40:31 +00:00
Paul Chote
0406b89a96 Add Actor.ReplacedByActor to track transformations.
This isn't great conceptually, but has precedent
in the Generation number.
2018-12-17 22:19:26 +01:00
Paul Chote
4b6853b433 Prevent multiple Transforms from triggering in the same tick.
This leads to actor duplication.
2018-12-08 11:34:49 +01:00
reaperrr
1553a8a5cb Fix empty activity tick when becoming idle
Activities usually don't do much more than cleanup on their last, 'null' tick.
That, combined with queued activities normally only starting to tick on the next tick,
would lead to visible 1-tick 'gaps' between movement activities.
Non-movement activities would suffer from the same problem,
only with different (presumably less noticable) symptoms.

Now we start ticking any activity that was queued from OnBecomingIdle
immediately, to avoid that issue.
2018-12-05 09:20:58 +13:00
reaperrr
422ba16ed9 Run TickIdle from inside Actor.Tick instead of World.Tick
Avoids calling ActorsWithTrait<INotifyIdle> every tick and allows caching all INotifyIdle traits at creation.
2018-10-15 22:53:57 +02:00
reaperrr
9bcb754836 Add OnActorDispose plumbing to Activity
This allows activities to perform necessary cleanups on actor
death/disposal, for example by running OnLastRun directly,
which would otherwise be skipped when the actor dies or is disposed
through other means.
2018-09-24 22:01:22 +02:00
reaperrr
c983dda077 Fix husks not updating targetable positions on teleport
This should have checked for IPositionableInfo to begin with.

Husk already implements IPositionable, so implementing *Info as well
makes sense, even if it only serves to exclude it from
ITargetablePositions caching for now.
2018-08-14 17:26:36 +01:00
Chris Forbes
d4ef841678 Convert masses of HashSet<string> to BitSet<DamageType> 2018-07-28 20:12:42 +01:00
abcdefg30
dd080eb882 Fix bridges not being targetable by enter activities 2018-04-12 17:04:57 +02:00
reaperrr
0c52ff3ae5 Cache TargetablePositions in Actor
To speed up Target.Positions.
2018-04-07 17:24:13 +01:00
RoosterDragon
5bd5a384b7 Use a BitSet for representing target types.
- Rename Bits<T> to BitSet<T>.
- Implement set based helpers for BitSet<T>.
- When representing TargetTypes of ITargetable in various traits, use a BitSet<TargetableType> instead of HashSet<string> for better performance & reduced memory usage.
- Fix FieldLoader to trim input values when generating a BitSet<T>.
- Require T in BitSet<T> and BitSetAllocator<T> to be a class since it's just a marker value. This allows the JIT to instantiate generic code for these classes once, as they don't benefit from specialized code for T. (Typically JITs will generate shared code for all reference types, and unique code for every value type encountered).
2018-03-21 12:07:44 +01:00
Mustafa Alperen Seki
5e7e3bb011 Add DamageTypes to Kill() and make some traits use it. 2018-03-09 00:25:29 +01:00
Arular101
8a60918841 Update copyright notice year to 2018 2018-01-17 00:47:34 +01:00
Andrii Yukhymchak
11db40a2b3 Fixed issue with unit ready when capturing 2018-01-01 12:52:47 +00:00
reaperrr
01a88862b3 Remove IDisable for good 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
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
RoosterDragon
8ef8c60a1a Remove allocations when enumerating sync hashes on an actor.
Exposing Actor.SyncHashes as an array allows allocation free enumeration, we just need to adjust the SyncHash type to run the hash function.
2017-12-10 13:49:52 +00:00
reaperrr
56b6aabbb8 Use new IAutoRenderSize for determining actor render bounds 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
DeadlySurprise
80bf36e1a8 Deprecate Actor.IsDisabled 2017-10-08 00:12:15 +02:00
Paul Chote
dd709a2679 Revert "Have some activities count as idle activities"
This reverts commit ae111248f3.
2017-08-10 12:22:28 +02:00
abcdefg30
ae111248f3 Have some activities count as idle activities 2017-03-24 18:06:10 +01:00
abcdefg30
5e923ff091 Remove the dead ActorGroupProxy trait 2017-03-18 13:40:05 +01:00
Oliver Brakmann
660124156f Add built-in support for child and composite activities 2017-01-22 20:39:17 +01:00
Taryn Hill
43317e0f5d Update copyright notice year to 2017 2016-12-31 23:46:13 -06:00
Oliver Brakmann
2c66ee8c13 Add native support for uninterruptible activities
This pattern occurs a few times throughout the code, so it makes sense to bake it into the Activity class itself.
2016-10-31 18:46:27 +01:00
Oliver Brakmann
3e9bf7aa4d Turn Actor.GetCurrentActivity into a property 2016-10-31 18:46:27 +01:00
Paul Chote
635fc9e1e2 Prevent mod code from changing Actor.Owner directly. 2016-10-23 12:21:03 +01:00
Zimmermann Gyula
cf8fff2b99 Remove passing the warheads from DamageWarhead to AttackInfo.
Added a Damage class to pass damage value and damage(types) instead.
This removes a great amount of overhead and longterm opens possibilities to have damagetypes without warheads.
2016-07-12 10:09:49 +02:00
abcdefg30
8c80b61897 Fix the tech tree not refreshing properly on owner change 2016-04-30 13:15:51 +02:00
Paul Chote
e71225496b Clarify GPL version. 2016-02-21 16:30:48 +00:00
Paul Chote
b396965fd9 Update licence header year. 2016-02-21 16:27:31 +00:00
RoosterDragon
dc37574494 Cache sync hash functions per actor for faster sync calculations.
Caching the result of the function lookup allows the actor to calculate all the sync hashes for its syncable traits faster as it does not need to repeat the lookup each time.
2016-01-31 00:44:43 +00:00
Paul Chote
0039a2bdbf Split out an ActivityUtils class. 2016-01-19 23:34:13 +00:00
RoosterDragon
8e89a6a696 Simplify names, remove unused usings, remove redundant casts. 2016-01-17 21:35:36 +00:00
Oliver Brakmann
71478aa2b8 Merge pull request #9734 from RoosterDragon/auto-target-perf
Improve AutoTarget performance
2015-12-20 19:53:17 +01:00
RoosterDragon
b0619a3e25 Added comments in performance sensitive code. 2015-12-13 16:24:54 +00:00
RoosterDragon
21292061f9 Added "PERF: Avoid LINQ." comments. 2015-12-12 21:05:13 +00:00
RoosterDragon
dcf375a412 Store Targetables in Actor.
This can be used to avoid several lookups for these traits, as well as allow Actor to provide specialised methods to deal with target types efficiently. This also reduces some code duplication.
2015-12-12 20:55:17 +00:00
atlimit8
7de98ad6d8 Merge pull request #9635 from RoosterDragon/occupy-space-perf
Speed up checks for IOccupySpace trait
2015-10-22 18:28:57 -05:00
RoosterDragon
262ab408b5 Speed up checks for IOccupySpace trait.
Eagerly load the trait (if it exists) in Actor, and use this reference to avoid having to perform self.Info.HasTraitInfo<IOccupySpaceInfo>() checks.
2015-10-14 20:46:15 +01:00
Huw Pascoe
5a81d5dfa7 Created IHealth interface and cleanup.
To decouple the Health trait from OpenRA.Traits.
DisplayHp renamed to DisplayHP and HealthExts moved
moved next to Actor.Kill() for consistency.
2015-10-12 01:55:59 +01:00
Matthias Mailänder
3884a31550 Merge pull request #9313 from RoosterDragon/actor-eager
Eagerly cache traits in Actor
2015-09-26 13:18:05 +02:00