spoint 0.1.61 → 0.1.62

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "spoint",
3
- "version": "0.1.61",
3
+ "version": "0.1.62",
4
4
  "description": "Physics and netcode SDK for multiplayer game servers",
5
5
  "type": "module",
6
6
  "main": "src/index.js",
@@ -56,15 +56,14 @@ export class MessageHandler {
56
56
  const oldPlayerId = this._playerId
57
57
  this._playerId = payload.playerId
58
58
  this._currentTick = payload.tick
59
- if (oldPlayerId && oldPlayerId !== this._playerId) {
60
- snapProc?.removePlayer(oldPlayerId)
61
- if (this._smoothInterp) this._smoothInterp.removePlayer(oldPlayerId)
62
- this._callbacks.onPlayerLeft?.(oldPlayerId)
63
- }
64
- if (!this._predEngine) {
65
- this._predEngine = new PredictionEngine(this._config.tickRate || 128)
66
- this._predEngine.init(this._playerId)
59
+ snapProc?.clear()
60
+ if (this._smoothInterp) {
61
+ this._smoothInterp.reset()
62
+ this._smoothInterp.setLocalPlayer(this._playerId)
67
63
  }
64
+ if (oldPlayerId) this._callbacks.onPlayerLeft?.(oldPlayerId)
65
+ this._predEngine = new PredictionEngine(this._config.tickRate || 128)
66
+ this._predEngine.init(this._playerId)
68
67
  if (this._config.smoothInterpolation !== false && !this._smoothInterp) {
69
68
  this._smoothInterp = new SmoothInterpolation({ predictionEnabled: this._config.predictionEnabled !== false })
70
69
  this._smoothInterp.setLocalPlayer(this._playerId)