| 89 | } |
| 90 | |
| 91 | void Entity::ApplyRemoteState(float deltaT) |
| 92 | { |
| 93 | // Local units are authoritative; nothing to correct. Single-player keeps |
| 94 | // every unit local, so this whole path is inert outside MP clients. |
| 95 | if (IsLocal() || !_remoteInterp.HasTarget()) |
| 96 | { |
| 97 | return; |
| 98 | } |
| 99 | // Once prediction is frozen the unit must hold still until the next update, |
| 100 | // not keep chasing an extrapolated ghost. |
| 101 | if (CheckPredictionFrozen()) |
| 102 | { |
| 103 | _remoteInterp.Clear(); |
| 104 | return; |
| 105 | } |
| 106 | |
| 107 | RemoteInterpParams params; |
| 108 | RemoteInterpResult res = _remoteInterp.Step(deltaT, Position(), _speed, Orientation(), params); |
| 109 | if (!res.active) |
| 110 | { |
| 111 | return; |
| 112 | } |
| 113 | |
| 114 | Matrix4 trans; |
| 115 | trans.SetOrientation(res.orientation); |
| 116 | trans.SetPosition(res.position); |
| 117 | Move(trans); |
| 118 | SetSpeed(res.speed); |
| 119 | } |
| 120 | |
| 121 | static Vector3 AddFriction(Vector3Val accel, Vector3Val friction) |
| 122 | { |
nothing calls this directly
no test coverage detected