Commit Graph

54 Commits

Author SHA1 Message Date
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
RoosterDragon
487727c9d0 Optimize AutoTarget.ScanForTarget.
The currentTarget parameter is null at the only call site. Inlining it allows us to make some simplifications to the logic.
2015-12-12 20:55:20 +00:00
Michael Rätzel
51bb515a4d prevent allied units from autoattack building which is being captured. resolves #6170. 2015-11-11 14:32:38 +01:00
Pavel Penev
ab2c5ab43d Enable AutoTarget to aquire targets under fog if GPS is present 2015-11-10 22:50:22 +02:00
Oliver Brakmann
b096671acb Add an ActorInit for unit stances 2015-10-27 19:41:49 +01:00
Oliver Brakmann
1a879009f1 Change InitialStance to Defend for human players 2015-10-27 19:41:49 +01:00
Pavel Penev
8c7bdae617 Fix AutoTarget acquiring targets under fog/shroud 2015-10-23 00:27:42 +03:00
Pavel Penev
f68da6ada7 Small refactoring to AutoTarget
- Move a check for AutoTargetIgnore up the chain
 - Simplify some LINQs to a single .FirstOrDefault()
 - Rename local variable
2015-10-21 21:09:26 +03:00
Matija Hustić
2a0a7541ba Gets AttackMove to work with 'Defend' stance 2015-10-11 19:23:08 +02:00
Matija Hustić
d94c645046 First step in the attack mechanism's refactor.
Enabled firing multiple armaments at a target simultaneously.
Each armament defines own cursor for targeting.
The force attack modifier influences armament choice for target.
Autotargeting modified to handle firing multiple armaments simultaneously.
As a consequence, healers (medics) no longer require separate Heal
activity and AttackMedic and AutoHeal traits.
2015-10-06 01:46:55 +02:00
atlimit8
8162fa27ab Add ActorInfo.HasTraitInfo<T>() requiring ITraitInfo types 2015-09-19 09:49:24 -05:00
atlimit8
85fab45451 Remove Actor.HasTrait<T>() 2015-09-19 09:49:23 -05:00
Matthias Mailänder
7447e0bf93 rename WRange to WDist 2015-07-09 10:55:38 +02:00
Paul Chote
0677c309f3 Move Shroud.IsTargetable to Player. 2015-06-19 22:02:08 +01:00