quake2ts 0.0.542 → 0.0.543

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.
@@ -117,16 +117,19 @@ interface PredictionSettings {
117
117
  }
118
118
  declare function defaultPredictionState(): PredictionState;
119
119
  declare function interpolatePredictionState(previous: PredictionState, latest: PredictionState, alpha: number): PredictionState;
120
+ interface PredictionPhysics {
121
+ trace: PmoveTraceFn;
122
+ pointContents: (p: Vec3) => number;
123
+ }
120
124
  declare class ClientPrediction {
121
125
  private readonly settings;
122
- private readonly trace;
123
- private readonly pointContents;
126
+ private readonly physics;
124
127
  private enabled;
125
128
  private baseFrame;
126
129
  private commands;
127
130
  private predicted;
128
131
  private predictionError;
129
- constructor(trace: PmoveTraceFn, pointContents: (p: Vec3) => number, settings?: Partial<PredictionSettings>);
132
+ constructor(physics: PredictionPhysics, settings?: Partial<PredictionSettings>);
130
133
  setPredictionEnabled(enabled: boolean): void;
131
134
  setAuthoritative(frame: GameFrameResult<PredictionState>): PredictionState;
132
135
  getPredictionError(): Vec3;
@@ -196,4 +199,4 @@ declare const updateCamera: (camera: Camera, viewSample: ViewSample) => void;
196
199
  */
197
200
  declare function GetCGameAPI(imports: CGameImport): CGameExport;
198
201
 
199
- export { type ActiveKick, type CGameExport, type CGameImport, ClientPrediction, GetCGameAPI, type PredictionSettings, type PredictionState, type ViewEffectSettings, ViewEffects, type ViewKick, type ViewSample, defaultPredictionState, interpolatePredictionState, updateCamera };
202
+ export { type ActiveKick, type CGameExport, type CGameImport, ClientPrediction, GetCGameAPI, type PredictionPhysics, type PredictionSettings, type PredictionState, type ViewEffectSettings, ViewEffects, type ViewKick, type ViewSample, defaultPredictionState, interpolatePredictionState, updateCamera };
@@ -117,16 +117,19 @@ interface PredictionSettings {
117
117
  }
118
118
  declare function defaultPredictionState(): PredictionState;
119
119
  declare function interpolatePredictionState(previous: PredictionState, latest: PredictionState, alpha: number): PredictionState;
120
+ interface PredictionPhysics {
121
+ trace: PmoveTraceFn;
122
+ pointContents: (p: Vec3) => number;
123
+ }
120
124
  declare class ClientPrediction {
121
125
  private readonly settings;
122
- private readonly trace;
123
- private readonly pointContents;
126
+ private readonly physics;
124
127
  private enabled;
125
128
  private baseFrame;
126
129
  private commands;
127
130
  private predicted;
128
131
  private predictionError;
129
- constructor(trace: PmoveTraceFn, pointContents: (p: Vec3) => number, settings?: Partial<PredictionSettings>);
132
+ constructor(physics: PredictionPhysics, settings?: Partial<PredictionSettings>);
130
133
  setPredictionEnabled(enabled: boolean): void;
131
134
  setAuthoritative(frame: GameFrameResult<PredictionState>): PredictionState;
132
135
  getPredictionError(): Vec3;
@@ -196,4 +199,4 @@ declare const updateCamera: (camera: Camera, viewSample: ViewSample) => void;
196
199
  */
197
200
  declare function GetCGameAPI(imports: CGameImport): CGameExport;
198
201
 
199
- export { type ActiveKick, type CGameExport, type CGameImport, ClientPrediction, GetCGameAPI, type PredictionSettings, type PredictionState, type ViewEffectSettings, ViewEffects, type ViewKick, type ViewSample, defaultPredictionState, interpolatePredictionState, updateCamera };
202
+ export { type ActiveKick, type CGameExport, type CGameImport, ClientPrediction, GetCGameAPI, type PredictionPhysics, type PredictionSettings, type PredictionState, type ViewEffectSettings, ViewEffects, type ViewKick, type ViewSample, defaultPredictionState, interpolatePredictionState, updateCamera };
@@ -1087,7 +1087,7 @@ function simulateCommand(state, cmd, settings, trace, pointContents) {
1087
1087
  };
1088
1088
  }
1089
1089
  var ClientPrediction = class {
1090
- constructor(trace, pointContents, settings = {}) {
1090
+ constructor(physics, settings = {}) {
1091
1091
  this.enabled = true;
1092
1092
  this.baseFrame = {
1093
1093
  frame: 0,
@@ -1098,8 +1098,7 @@ var ClientPrediction = class {
1098
1098
  this.predicted = defaultPredictionState();
1099
1099
  this.predictionError = ZERO_VEC32;
1100
1100
  this.settings = { ...DEFAULTS, ...settings };
1101
- this.trace = trace;
1102
- this.pointContents = pointContents;
1101
+ this.physics = physics;
1103
1102
  this.predicted = this.baseFrame.state ?? defaultPredictionState();
1104
1103
  }
1105
1104
  setPredictionEnabled(enabled) {
@@ -1116,7 +1115,7 @@ var ClientPrediction = class {
1116
1115
  if (relevantCommands.length > 0 || this.baseFrame.frame === frame.frame) {
1117
1116
  let tempState = normalizeState(this.baseFrame.state);
1118
1117
  for (const cmd of relevantCommands) {
1119
- tempState = simulateCommand(tempState, cmd, this.settings, this.trace, this.pointContents);
1118
+ tempState = simulateCommand(tempState, cmd, this.settings, this.physics.trace, this.physics.pointContents);
1120
1119
  }
1121
1120
  predictedAtFrame = tempState;
1122
1121
  }
@@ -1169,7 +1168,7 @@ var ClientPrediction = class {
1169
1168
  let state = normalizeState(this.baseFrame.state);
1170
1169
  if (this.enabled) {
1171
1170
  for (const cmd of this.commands) {
1172
- state = simulateCommand(state, cmd, this.settings, this.trace, this.pointContents);
1171
+ state = simulateCommand(state, cmd, this.settings, this.physics.trace, this.physics.pointContents);
1173
1172
  }
1174
1173
  }
1175
1174
  this.predicted = state;