Commit Graph

67 Commits

Author SHA1 Message Date
Paul Chote
28f7604172 Reset nextScanTime only when actually scanning for targets. 2020-02-22 16:30:07 +01:00
Paul Chote
ab196a23e6 Fix AttackFollow ignoring allowMove flag when auto-targeting. 2020-02-14 17:30:38 +01:00
Paul Chote
51870a471a Add AttackSource enum. 2020-01-18 16:38:53 +01:00
abcdefg30
23b3c237b7 Update the year numbers in all license headers to 2020 2020-01-05 17:00:34 +00:00
abcdefg30
905e02b765 Prevent a crash in AutoTarget.HasValidTargetPriority 2019-12-14 17:17:36 +01:00
abcdefg30
a586f10875 Don't allow movement for actors without IMove
However, this does not check if any existing IMove traits are enabled.
2019-11-08 23:31:59 +01:00
abcdefg30
980c0c9cd4 Fix actors returning fire at invisible attackers 2019-11-08 23:31:59 +01:00
Turupawn
3240b1e9eb Overhaul target line rendering:
- Targets are now defined by the activities
- Queued activities are shown
- Support custom attack colors
2019-08-05 02:53:09 +01:00
Paul Chote
6eaf615798 Fix conditional traits that incorrectly override INotifyCreated. 2019-07-14 00:41:59 +02:00
Paul Chote
78a70be0d4 Fix and enable SA1133, SA1134 style rules. 2019-05-24 10:47:57 +02:00
Paul Chote
3ca9d4b773 Drop targets when switching to a more restrictive stance. 2019-05-21 15:52:55 +02:00
Paul Chote
62b5d22e53 Add INotify(Activity)StanceChanged interfaces. 2019-05-21 15:52:55 +02:00
Paul Chote
55f6744cf3 Replace IPreventsAutoTarget with IDisable(Enemy)AutoTarget.
This allows traits on the attacking unit to suppress auto targeting
and makes the distinction between the two interfaces clear.
2019-05-19 13:23:01 +02:00
tovl
9abf715fd7 Allow opportunity fire for aircraft. 2019-05-04 23:40:16 +02:00
Mustafa Alperen Seki
e7b8a56511 Add ValidStances to AutoTargetPriority. 2019-04-04 19:08:10 +02:00
tovl
64cec4a0ad Revise AttackMoveActivity. 2019-03-22 19:02:05 +01:00
Paul Chote
ab4a7e3558 Replace System.Drawing primitives with our own. 2019-03-04 18:26:42 +00:00
Paul Chote
012b17b974 Implement a secondary target-of-opportunity for AttackFollow. 2019-02-03 18:07:02 +01:00
matjaeck
b466b5d660 Reset unit stance on owner change. 2019-02-03 16:20:24 +01:00
Paul Chote
0bfc487999 Fix target invalidation and reacquisition in AttackFollow. 2019-01-26 22:53:46 +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
5f79c31a57 Add AutoTarget support for FrozenActors. 2018-12-17 22:19:26 +01:00
Paul Chote
4723e5ddb9 Expose common actor Inits in the map editor. 2018-12-08 22:53:13 +01:00
Paul Chote
f6768fe624 Remove legacy editor actor properties plumbing. 2018-12-08 22:53:13 +01:00
reaperrr
7d695f0c8f Fix actors in ReturnFire stance following targets
On bleed, if AllowMovement is true actors with ReturnFire will actually follow the acquired target, unlike in Defend stance.
This is at least unintuitive, since ReturnFire is expected to be more passive than Defend.
2018-11-18 16:19:50 +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
RoosterDragon
0555ce9321 Reduce allocations in AutoTarget.ChooseTarget.
- Cache active target query.
- Prefer .Count == 0 over Any when working with Lists.
- Use helper for GetEnabledTargetTypes.
- Don't declare target variable until actually needed.
2018-03-21 01:08:59 -03:00
Arular101
8a60918841 Update copyright notice year to 2018 2018-01-17 00:47:34 +01:00
Paul Chote
1376ad674e Remove Player.CanViewActor and .CanTargetActor. 2017-11-03 09:56:00 +01:00
reaperrr
83afcc3448 Some misc explicit interfaces
Just a by-product from a previous commit, not meant to do anything specific other than bringing us a tiny step closer to requiring explicit implementations for these interfaces too, at some point.
2017-09-16 15:51:37 +02:00
reaperrr
761a4f29ab Make INotifyIdle and INotifyBecomingIdle require explicit implementation 2017-09-16 15:51:37 +02:00
abcdefg30
de7a0c9861 Remove TargetWhenIdle and TargetWhenDamaged from AutoTarget 2017-08-10 19:11:47 +02:00
Paul Chote
716343732f Add AutoTargetPriority trait for smarter AutoTarget logic. 2017-06-11 17:14:21 -05:00
atlimit8
afa5a7772d Split ConditionByStance in AutoTarget 2017-05-29 20:41:10 +01:00
atlimit8
cadfbe8a29 Grant condition by unit stance 2017-05-29 20:41:10 +01:00
abcdefg30
700d141c24 Make AutoTargetIgnore upgradeable 2017-02-27 00:36:00 +01:00
RoosterDragon
6a0b993fa2 Remove attackBases member from AutoTarget.
We can use the activeAttackBases member everywhere.
2017-01-25 18:29:33 +00:00
RoosterDragon
9c59d7e255 Avoid delegate allocation in AutoTarget.
Extract a common method for deciding if an attack should happen, and avoid LINQ inside this method.
2017-01-19 20:23:52 +00:00
RoosterDragon
2239d6c88e Cache activeAttackBases query in AutoTarget. 2017-01-19 20:23:49 +00:00
Taryn Hill
43317e0f5d Update copyright notice year to 2017 2016-12-31 23:46:13 -06:00
Paul Chote
268ed016ab Rename UpgradableTrait to ConditionalTrait. 2016-12-23 23:28:34 +00: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
reaperrr
6089599b3f Make AutoTarget handling of AttackFollow more robust
At least in theory, it's possible for an actor to have multiple AttackFollow traits, or AttackFollow is disabled initially but enabled via upgrade later.
To avoid crashes or other issues, let's play it safe and take the same approach as with AttackBase look-ups.
2016-05-23 20:28:02 +02:00
reaperrr
2a19f66a0e Make AutoTarget able to handle multiple Attack* traits 2016-05-23 20:28:02 +02:00
reaperrr
1b6f67e9ee Improve AutoTarget code readability 2016-05-23 20:28:02 +02:00
reaperrr
d5915431dd Made AutoTarget upgradable 2016-05-23 20:28:02 +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
adc7e902e3 Speed up AutoTarget.ChooseTarget among groups of allied units.
Most auto target scans will be conducted among groups of allied units unable to target each other because they are allied and their weapons only target enemies. Since they cannot target each other, the scan will be repeated constantly. Realising this, we can significantly reduce the performance impact of auto target scanning by bailing early in this scenario to avoid carrying out expensive targeting checks on friendly units which we know will fail anyway.
2016-01-04 07:07:26 +00:00
RoosterDragon
7fbbaa2221 Optimize AutoTarget.ChooseTarget.
Avoid using LINQ for filtering, grouping and dictionary building. Instead, we do these ourselves to reduce overhead.

Actors are checked for AutoTargetIgnoreInfo (rather than the trait) since info checks are marginally faster. This check can now be done immediately to allow us to skip such actors right away.

The ClosestTo calculation is now only run on the group on actors for the selected armament, rather than all potential armaments.
2015-12-12 20:55:22 +00:00