Commit Graph

63 Commits

Author SHA1 Message Date
RoosterDragon
9d5d2ab493 RCS0056 - roslynator_max_line_length = 180 2024-07-29 21:56:36 +02:00
RoosterDragon
2ed0656d1b Introduce MoveCooldownHelper to prevent lag spikes from failed pathfinding
Several activities that queue child Move activities can get into a bad scenario where the actor is pathfinding and then gets stuck because the destination is unreachable. When the Move activity then completes, then parent activity sees it has yet to reach the destination and tries to move again. However, the actor is still blocked in the same spot as before and thus the movment finishes immediately. This causes a performance death spiral where the actor attempts to pathfind every tick. The pathfinding attempt can also be very expensive if it must exhaustively check the whole map to determine no route is possible.

In order to prevent blocked actors from running into this scenario, we introduce MoveCooldownHelper. In its default setup it allows the parent activity to bail out if the actor was blocked during a pathfinding attempt. This means the activity will be dropped rather than trying to move endlessly. It also has an option to allow retrying if pathfinding was blocked, but applies a cooldown to avoid the performance penalty. For activities such as Enter, this means the actors will still try and enter their target if it is unreachable, but will only attempt once a second now rather than every tick.

MoveAdjacentTo will now cancel if it fails to reach the destination. This fixes MoveOntoAndTurn to skip the Turn if the move didn't reach the intended destination. Any other derived classes will similarly benefit from skipping follow-up actions.
2024-07-01 15:56:11 +03:00
RoosterDragon
e6914f707a Introduce FirstOrDefault extensions method for Array.Find and List.Find.
This allows the LINQ spelling to be used, but benefits from the performance improvement of the specific methods for these classes that provide the same result.
2023-11-19 19:28:57 +02:00
RoosterDragon
330ca92045 Fix RCS1077 2023-11-19 19:28:57 +02:00
Matthias Mailänder
1899eed839 Add localisation support to transient lines. 2023-08-19 20:46:04 +03:00
Gustas
dc390a7301 Add IMove.MoveOntoTarget interface
In `TraitsInterfaces` we expose offset as WPos instead of CPos. In an upcoming PR we'll translate the same change to yaml.
2023-04-21 18:29:43 +02:00
RoosterDragon
164abfdae1 Fix IDE0083 2023-04-08 16:51:51 +03:00
Gustas
84e7eb144b Move RearmTick to Rearmable 2023-01-20 11:43:12 +02:00
Gustas
0d24f2c08b Merge INotifyBeingResupplied into INotifyDockClient 2023-01-20 10:43:18 +02:00
abcdefg30
5bf7fe852c Remove the copyright year numbers 2023-01-11 11:58:54 +02:00
abcdefg30
6a31b1f9f3 Update the copyright header year 2022-05-28 00:35:10 -05:00
Eduardo Cáceres
79f321cb44 .Any(), .Count() -> .Count or .Length 2022-05-18 11:42:36 -05:00
Ivaylo Draganov
24b9482cc1 Add support for transient text notifications matching speech notifications 2022-04-30 12:39:29 +01:00
RoosterDragon
727084c5fc Run spell check over solution 2021-12-05 19:23:43 +01:00
penev92
8ba6d13b2f Removed unused using directives 2021-10-15 13:12:33 +02:00
Andre Mohren
6810469634 Updated copyright years. 2021-06-29 18:33:21 -05:00
tovl
84eb3c54ef Expose targetline colors to yaml.
All targetlines can now be set to a custom color in yaml or set to be invisible.
All automated behaviours including scripted activities now have no visible target lines.
2020-11-14 12:04:19 +00:00
abcdefg30
7b75a78e38 Fix free-of-charge repairing still costing credits 2020-10-30 15:12:47 +01:00
abcdefg30
75fe0e524f Fix units not attack moving to waypoints after resupply/takeoff 2020-10-17 19:48:54 +01:00
teinarss
9c4fd0e3d3 Use Null-Propagation Operator 2020-08-19 18:11:07 +01:00
abcdefg30
dd99fc93e4 Uncloak during resupply when "UncloakOn: Dock" is defined 2020-08-16 21:01:16 +02:00
abcdefg30
96b06c75d1 Make Resupply display target lines for all queued move activities 2020-06-02 18:23:54 +02:00
abcdefg30
8b13d3e4c7 Fix resupply not displaying target lines correctly 2020-05-19 22:11:20 +02:00
Adam Mitchell
0a9eb1ff83 Fix units stuck on transit-only when resupplying 2020-04-17 11:13:46 +02:00
abcdefg30
1e64048956 Cache PlayerResources and unit cost in Resupply 2020-04-07 21:27:16 +02:00
Zimmermann Gyula
9e534f3804 Add damagetypes to repairing. 2020-03-31 01:10:51 -05:00
Paul Chote
b2f0ac15e8 Generalize RallyPointInfo.Offset to support arbitrary length paths. 2020-02-09 16:52:22 +01:00
abcdefg30
23b3c237b7 Update the year numbers in all license headers to 2020 2020-01-05 17:00:34 +00:00
tovl
c360d8bcef Make service depot passable. 2020-01-04 16:04:27 +00:00
tovl
203fff0ab7 Allow queued structure rallypoints. 2019-12-13 23:51:03 +01:00
tovl
3236499fb7 Increase IMove.MoveTo call flexibility. 2019-12-13 23:51:03 +01:00
reaperrr
ee00954f2e Replace AmmoPool lookup methods with properties
And gave the more suitable names while at it.
This is more in line with how we do things in
other places.
2019-11-20 15:45:41 +01:00
tovl
48059e8249 Skip rally point if order is queued after resupply. 2019-09-26 18:39:44 +02:00
tovl
09cd56b367 Add missing target line to aircraft taking off from resupplying. 2019-09-26 18:39:44 +02:00
tovl
145b6a05a3 Refactor unreserve actions. 2019-09-26 18:39:44 +02:00
reaperrr
e71001f4f8 Fix Resupply closeEnough bugs
Fixes that
- RepairableNear actors wouldn't move close enough
- isCloseEnough would return 'true' even if the host
  is invalid.
2019-08-22 10:26:36 +01:00
Paul Chote
e600848947 Fix crash for invalid Resupply hosts. 2019-08-18 12:48:17 +02:00
Paul Chote
78302ea593 Rework aircraft rally point handling. 2019-08-15 17:02:27 +02:00
abcdefg30
d1c56d78e1 Fix spamming repair orders repairing faster 2019-08-10 11:39:12 +01:00
reaperrr
ac3b3db7ac Made Resupply canceling more robust
The following improvements are made here:
- merged and streamlined the two IsCanceling checks in Tick
  into one that covers both isCloseEnough cases
- isCloseEnough now only checks distance to host
  if host is still valid and otherwise returns 'false'
- called transports are now also cancelled when host becomes
  invalid, not only if the activity is cancelled via order
- aircraft now always take off if the host becomes invalid
- ground actors only try to leave if host is still existing
2019-08-08 17:22:53 +02: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
tovl
d9e1a68453 Cancel carryall transport request when cancelling order. 2019-07-22 22:54:01 +02:00
reaperrr
7f4fbfcf46 Change Resupply closeEnough 'infinite' to negative
...instead of 'zero'.

Returning 'true' at a distance of zero was a legacy left-over
that isn't used anymore once #16695 is merged.
2019-07-21 15:17:09 +02:00
reaperrr
fa41554309 Fix actors resupplying even if too far from resupplier 2019-07-21 15:17:09 +02:00
tovl
c5558e2145 Remove SequenceActivities. 2019-07-20 23:41:31 +02:00
tovl
231825d0d0 Remove WaitForTransport activity. 2019-07-19 10:49:24 +02:00
tovl
922c6e9c40 Fix harvesters losing their last harvesting position when carried by carryall. 2019-07-19 10:49:24 +02:00
reaperrr
cf4d73ab91 Revert FlightDynamics
This needs more thought and most parts might get superseded
by other approaches.

Kept CanSlide separation from CanHover.
2019-07-18 10:26:43 +02:00
reaperrr
c51f2c036a Make aircraft always take off after repair
Reservable logic doesn't handle repairs, and we
don't want aircraft to block repair bays etc. until it does.
2019-07-15 23:48:54 +01:00
reaperrr
5211eb25aa Improve handling of finished/cancelled Resupply 2019-07-15 23:48:54 +01:00