Commit Graph

141 Commits

Author SHA1 Message Date
Markus Hartung
f7ddb969c6 Change so Attack* calls Created on base class 2017-06-04 17:11:44 +02:00
Paul Chote
45b13dabfb Explicitly implement interfaces in AttackBase. 2017-05-29 06:27:19 -05:00
Paul Chote
34844e87a3 Replace Lazy trait lookups with INotifyCreated. 2017-05-29 06:27:19 -05:00
atlimit8
4917c6e453 Merge pull request #12924 from reaperrr/fix-tunnel-atk
Prevent units in tunnels/underground from attacking
2017-04-29 00:25:23 -05:00
reaperrr
1fae993593 Prevent attacking while in tunnel/underground 2017-04-27 17:50:02 +02:00
MartinCurwen
ea6e1fdd64 Multiple armament check fix in AttackGarrisoned 2017-04-19 17:40:14 +01:00
Paul Chote
a9cfbd9ad7 Fix Obelisk not dropping targets when they move out of range. 2017-03-10 19:42:15 +00:00
Paul Chote
a52ea71c62 Add AttackCharges trait for TD and TS obelisks. 2017-02-11 16:19:58 +00:00
Paul Chote
a8d46adb2d Rename tesla attack logic and move to Mods.Cnc. 2017-02-11 16:19:58 +00:00
abcdefg30
19549a9068 Fix null being passed through the INotifyAttack interface 2017-01-29 11:07:20 +01: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
Paul Chote
9ddfdc45b3 Introduce SoundType enum. 2016-12-23 11:34:23 +00:00
Paul Chote
23f4ae5027 Replace UpgradeMinEnabledLevel checks with an EnabledByDefault shim. 2016-11-19 17:19:25 +00:00
Oliver Brakmann
9ab2ce2362 Merge pull request #11520 from reaperrr/IdleWander
Make civilians wander around when idle
2016-07-04 11:50:35 +02:00
reaperrr
c8012baffb Make all Attack* traits listen to Stop order 2016-07-02 16:02:00 +02:00
reaperrr
75c49620d1 Introduce INotifyAttack.PreparingAttack
And use it to allow triggering attack animations/overlays at a different point
than the actual weapon firing.
2016-07-02 16:02:00 +02:00
reaperrr
f5a0c7e425 Move AttackWander into root Traits folder
It's not really an Attack* trait, so it doesn't belong into that subfolder.
2016-06-25 12:36:35 +02:00
reaperrr
27993729be Make attack cursor smarter
Rather than simply taking the first valid armament, regardless of available ammo and regardless of which valid armament has the highest range, the attack cursor is now chosen a) by whether the armament has ammo and b) by which valid armament has the highest range.
2016-06-23 15:09:11 +02:00
reaperrr
4f55b088eb Check if weapon without self-reloading is out of ammo when deciding validity
This should prevent attacking helicopters (or other actors) staying at the range to target of a weapon that is out of ammo and needs manual reloading at a RearmBuilding or via upgrades.
2016-06-23 14:47:41 +02:00
reaperrr
2f1a6e8807 Add maximum and minimum range vs. target checks
This adresses the issue that actors would ignore the validity of weapons when deciding the attack distance versus a target. This could result in actors staying out of range of a weapon valid versus target if they carried a weapon with higher range but invalid versus target.
2016-06-16 20:39:45 +02:00
reaperrr
fd5a597966 Move Render traits to Traits.Render namespace 2016-04-15 20:43:04 +02:00
Paul Chote
acab6f1f4b Fix custom order generators for left-click targeting. 2016-04-09 11:59:54 -04:00
Paul Chote
2024f86290 Fix Turreted units not dropping cancelled targets. 2016-04-03 10:22:53 +01:00
Taryn Hill
6d4e365af5 Require explicit implementation of INotifyPassenger(Entered|Exited) 2016-03-29 06:59:43 -05:00
Jonathan Ling
2d4c3f715f Refactored ticks to delay per issue #9810 2016-03-22 17:03:37 -04:00
RoosterDragon
4598b0de43 Have turrets actively track targets, even when not ready to attack. 2016-03-12 20:42:10 +00:00
Matthias Mailänder
ecbd1a0247 Merge pull request #9509 from penev92/upgradeTickTank
Convert Tick Tank to use DeployToUpgrade + some fixes
2016-02-23 23:33:38 +01:00
Pavel Penev
17ef6efefc Fix AttackFollow (and consequently AttackTurreted) firing at old target when the trait is reenabled
Most noticeable by ordering a deployed Tick Tank to fire at the ground, then undeploying it and deploying it again.
2016-02-22 02:44:28 +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
Oliver Brakmann
ce62e456d7 Fix TD gunboat attack behaviour 2016-02-14 21:28:50 +01:00
teees
dc6d31cec8 Fix turreted immovable actors not dropping targets that are out of range 2016-02-14 21:28:50 +01:00
Paul Chote
5f4ca605bd Merge pull request #10420 from Mailaender/revert-fixAttack
Revert "Don't attack actors that you can't see"
2016-01-23 12:45:55 +00:00
Paul Chote
b0bd252343 Move Util to Mods.Common. 2016-01-19 23:35:18 +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
Paul Chote
3b18c7815d Remove Util.GetFacing. 2016-01-16 22:38:17 +00:00
Matthias Mailänder
6900e4bad3 rename DemoTruck to AttackSuicides
generalize move to add Aircraft support
give it a description
don't require Explodes as it is just a soft dependency
use a regular self kill
2016-01-16 19:38:23 +01:00
Matthias Mailänder
aa9ef48737 Revert "Don't attack actors that you can't see"
This reverts commit d235ea3a52.
2016-01-04 23:02:03 +01: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
Matthias Mailänder
b289478123 Merge pull request #10189 from reaperrr/less-lazy1
AttackBase and Armament optimizations
2015-12-25 14:04:46 +01:00
reaperrr
0e5ea959aa Perform faster checks in AB.CanAttack much earlier
Move self.IsDisabled right after IsInWorld and IsTraitDisabled checks.
This should skip/avoid a lot of the following checks when actors are disabled by low power, EMP or similar, potentially saving some performance when there are many disabled actors with attack trait.

Move IsValidFor before HasAnyValidWeapons because the latter is more
expensive.
2015-12-14 04:34:58 +01:00
reaperrr
acc9b37a01 Remove ITraitInfo from AttackBase
That is already included in UpgradableTraitInfo.
2015-12-14 04:34:58 +01:00
RoosterDragon
21292061f9 Added "PERF: Avoid LINQ." comments. 2015-12-12 21:05:13 +00:00
RoosterDragon
16386873af Optimize AttackBase.ChooseArmamentsForTarget.
Remove the unused onlyEnabled parameter to avoid it needlessly being captured in the closure, and simplify the logic.

Evaluate RequiresForceFire and Weapon.IsValidAgainst last in their respective logic chains as these are the most expensive operations and benefit from short-circuiting being able to skip their evaluation.
2015-12-12 20:55:19 +00:00
RoosterDragon
0fab3ec1b2 Remove LINQ in some performance critical AutoTarget paths. 2015-12-12 20:55:18 +00:00
RoosterDragon
082ea6ba73 Refactor animation classes.
Specify pause function in constructors of Animation if required, and remove the unused pause function from AnimationWithOffset.

Cleanup Animation.cs and reduce code duplication.
2015-12-05 16:58:26 +00:00
reaperrr
72ec431766 Add RenderUtils
With ZOffsetFromCenter as first feature so render traits don't have to use it from WithTurret(Overlay)
2015-11-28 20:47:17 +01:00
Oliver Brakmann
16de21d41c Merge pull request #10018 from pchote/fix-spy-cursor
Restore targeting cursor when mousing over a disguised enemy spy.
2015-11-21 20:57:12 +01:00