Commit Graph

138 Commits

Author SHA1 Message Date
reaperrr
acccb01c76 Fix Move regression
If progress == Distance, we must not move again on the same tick,
but still 'return true' to avoid losing a tick in the case
when this is the last Move tick followed by a different activity
(or a new queued Move, for example via waypoints).
2021-05-23 10:49:40 +02:00
reaperrr
27ddae3df9 Fix Move jumpy-ness on MovePart transitions
There were 2 issues at work here, both when progress
would overshoot Distance (which is the usual case,
rather than the exception):
- the overshot progress was passed on by MoveFirstHalf, however
  OnComplete would make the next MovePart start ticking the
  same tick on which the old MovePart reached Distance,
  but move by carryoverProgress +(!!!) terrain speed instead of moving
  by just the left-over carryoverProgress.
- MoveSecondHalf would not pass any overshot progress to the
  next MoveFirstHalf queued by parent Move, leading to
  the next MoveFirstHalf performing a full-speed move the same tick
  MoveSecondHalf finished its last move.
2021-04-15 18:03:42 +02:00
reaperrr
4c7e3d8f3a Rename fraction to distance/progress in MovePart 2021-04-15 18:03:42 +02:00
reaperrr
646495fc5f Simplify MovePart code
InnerActivity and UpdateCenterLocation made this
overly complex and hard to read & debug.

This also fixes a bug that would make an outdated
facing being passed during OnComplete (because
InnerActivity was cached before UpdateCenterLocation
could set the correct final facing).
2021-04-15 18:03:42 +02:00
reaperrr
75a3bb4f0b CellIsEvaluating perf optimization
If an actor has Mobile, it implements IOccupySpace
so we can use OccupiesSpace to save a trait look-up.
2021-03-27 22:29:13 +00:00
reaperrr
441e18b898 Remove PathHash
This is 9(!) years old and we haven't had
pathfinding-related desyncs in quite a while.

We can still bring this back later if we ever
need it again.
2021-03-27 22:29:13 +00:00
reaperrr
65c796dec7 Use Mobile.Pathfinder to reduce trait look-ups 2021-03-14 12:28:54 +00:00
reaperrr
2473b8763b Rename methods/activities with Visual in them
While they may be only 'visual' in terms of influence/cell grid,
they all do update CenterPosition, which is essentially the
actual world position of the actor.
'Visual' would imply that it only affects the position where the
actor is drawn, which is inaccurate.
Furthermore, using the term 'Visual' here would make
naming future methods/properties related to visual interpolation
unnecessarily complicated, because that's where we might
need a real 'Visual(Only)Position'.
2021-03-08 11:19:11 +01:00
teinarss
4a1e4f3e16 Use expression body syntax 2021-03-07 13:00:52 +00:00
teinarss
13581c030d Use in parameter for Target 2020-11-06 22:02:24 +01:00
Paul Chote
5a7dc385a3 Remove obsolete LocomotorInfo caching. 2020-10-18 18:19:56 +02:00
Paul Chote
da53d5b776 Fix a divide by zero crash in Move. 2020-10-17 22:31:35 +02:00
abcdefg30
ce4d263b52 Fix AttackMove getting unarmed units stuck 2020-09-20 12:02:20 +02:00
abcdefg30
53c02eb2b9 Fix a crash in the Move activity 2020-09-18 20:12:42 +02:00
abcdefg30
57a3ad8ae2 Replace 'inner' with 'move' inside AttackMoveActivity 2020-09-12 00:30:33 +02:00
abcdefg30
ad3722e19f Add support for circumventing the target scan limit in AttackMove 2020-09-12 00:30:33 +02:00
abcdefg30
a12d127fd6 Rework the internals of AttackMoveActivity
Avoids creating and throwing away inner activities unnecessarily
2020-09-12 00:30:33 +02:00
abcdefg30
e80ebfae35 Use readonly where possible in AttackMoveActivity 2020-09-12 00:30:33 +02:00
teinarss
9c4fd0e3d3 Use Null-Propagation Operator 2020-08-19 18:11:07 +01:00
teinarss
27f1a7ab27 Use out var syntax 2020-08-19 18:11:07 +01:00
teinarss
19b02875c7 Use Tuple syntax 2020-08-15 10:37:10 +01:00
Andre Mohren
006a87692a Removed unused imports. 2020-07-28 18:22:51 +02:00
KorGgenT
b57c68e392 Fix units walk over tunnels and under bridges. 2020-06-28 17:21:54 +02:00
tovl
b79aa7eb6a Add AlwaysTurnInPlace option to Mobile. 2020-06-28 00:11:26 +02:00
Paul Chote
6adf45bcb4 Convert IFacing.Facing and TurnSpeed to WAngle. 2020-06-12 18:35:41 +02:00
reaperrr
4bf614c5cd Use OccupiesSpace to avoid Mobile look-up in Move
While individual trait look-ups may be cheap,
if a large army that is currently standing still gets
its first move-including order, the look-ups of dozens
or even hundreds of actors may happen on the same tick.

Therefore this may help reducing that first-order lag spike,
at least a little bit.
2020-06-02 20:08:34 +02:00
Paul Chote
626b40f31b Account for ramps in terrain height calculations. 2020-05-28 09:41:55 -05:00
atlimit8
1ef27d18c1 check name for Actor.GrantCondition() 2020-05-17 12:33:29 +02:00
atlimit8
259c8d2c98 Merge ConditionManager trait directly into Actor 2020-05-09 15:46:11 +02:00
Adam Mitchell
0a9eb1ff83 Fix units stuck on transit-only when resupplying 2020-04-17 11:13:46 +02:00
Paul Chote
4d4f94208e Cache CandidateMovementCells within the same tick. 2020-03-12 17:07:14 +01:00
Paul Chote
416713de0c Fix infantry switching subcells and blocking eachother while moving. 2020-03-11 15:40:12 +01:00
Paul Chote
9a6602656b Ignore nearEnough if we think the actor can get closer. 2020-02-18 19:37:17 +01:00
Paul Chote
3a688e03f0 Add multiple levels of fallback. 2020-02-12 21:17:39 +00:00
Paul Chote
a43335c7b0 Restore transient blocker check in pathfinding queries. 2020-02-12 21:17:39 +00: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
tovl
2094142b7d Include tunnel check in CanStayInCell. 2020-01-04 16:04:27 +00:00
tovl
434c46058f Disallow units idling on service depot. 2020-01-04 16:04:27 +00:00
reaperrr
2de51ae73c Cache IPathFinder in Mobile at creation
Avoiding look-ups on every move order,
as well as reducing line lengths.
2019-11-03 20:53:29 +01:00
tovl
38caadfdf0 Clean up nudging code. 2019-10-28 19:35:32 +01:00
tovl
c4d1468f62 Make locomotor cache and nudging logic aware of mobile trait status. 2019-10-28 19:35:32 +01:00
Paul Chote
69970d42f3 Prevent movement pausing at invalid position. 2019-10-19 13:11:00 +02:00
tovl
eed00ded0d pause MovePart when Mobile is paused. 2019-10-06 20:28:20 +01:00
tovl
4a609bbee8 Allow units to give way when path is blocked by oncoming unit. 2019-09-15 17:51:34 +01:00
tovl
946c9f420b Fix Move not cancelling during turns. 2019-08-25 13:13:37 +02:00
tovl
08c472b2e2 Disallow attack-moving units from chasing their targets. 2019-08-15 18:03:30 +02:00
tovl
5393b689d4 Disable preemptive targeting for queued orders. 2019-08-10 19:10:45 +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
tovl
8c7ff3b5b0 Make VisualMove uninterruptible by making Turn a Child of Drag. 2019-08-04 11:48:59 +02:00