quake2ts 0.0.228 → 0.0.229

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.
Files changed (42) hide show
  1. package/package.json +1 -1
  2. package/packages/client/dist/browser/index.global.js +11 -11
  3. package/packages/client/dist/browser/index.global.js.map +1 -1
  4. package/packages/client/dist/cjs/index.cjs +98 -11
  5. package/packages/client/dist/cjs/index.cjs.map +1 -1
  6. package/packages/client/dist/esm/index.js +98 -11
  7. package/packages/client/dist/esm/index.js.map +1 -1
  8. package/packages/client/dist/tsconfig.tsbuildinfo +1 -1
  9. package/packages/client/dist/types/demo/handler.d.ts +6 -0
  10. package/packages/client/dist/types/demo/handler.d.ts.map +1 -1
  11. package/packages/engine/dist/browser/index.global.js +9 -9
  12. package/packages/engine/dist/browser/index.global.js.map +1 -1
  13. package/packages/engine/dist/cjs/index.cjs +81 -11
  14. package/packages/engine/dist/cjs/index.cjs.map +1 -1
  15. package/packages/engine/dist/esm/index.js +80 -11
  16. package/packages/engine/dist/esm/index.js.map +1 -1
  17. package/packages/engine/dist/tsconfig.tsbuildinfo +1 -1
  18. package/packages/engine/dist/types/demo/parser.d.ts +26 -0
  19. package/packages/engine/dist/types/demo/parser.d.ts.map +1 -1
  20. package/packages/engine/dist/types/index.d.ts +1 -1
  21. package/packages/engine/dist/types/index.d.ts.map +1 -1
  22. package/packages/game/dist/browser/index.global.js +2 -2
  23. package/packages/game/dist/browser/index.global.js.map +1 -1
  24. package/packages/game/dist/cjs/index.cjs +13 -0
  25. package/packages/game/dist/cjs/index.cjs.map +1 -1
  26. package/packages/game/dist/esm/index.js +13 -0
  27. package/packages/game/dist/esm/index.js.map +1 -1
  28. package/packages/game/dist/tsconfig.tsbuildinfo +1 -1
  29. package/packages/shared/dist/browser/index.global.js +1 -1
  30. package/packages/shared/dist/browser/index.global.js.map +1 -1
  31. package/packages/shared/dist/cjs/index.cjs +13 -0
  32. package/packages/shared/dist/cjs/index.cjs.map +1 -1
  33. package/packages/shared/dist/esm/index.js +13 -0
  34. package/packages/shared/dist/esm/index.js.map +1 -1
  35. package/packages/shared/dist/tsconfig.tsbuildinfo +1 -1
  36. package/packages/shared/dist/types/protocol/entityState.d.ts +11 -0
  37. package/packages/shared/dist/types/protocol/entityState.d.ts.map +1 -1
  38. package/packages/shared/dist/types/protocol/ops.d.ts +14 -1
  39. package/packages/shared/dist/types/protocol/ops.d.ts.map +1 -1
  40. package/packages/shared/dist/types/protocol/player-state.d.ts +4 -0
  41. package/packages/shared/dist/types/protocol/player-state.d.ts.map +1 -1
  42. package/packages/tools/dist/tsconfig.tsbuildinfo +1 -1
@@ -2051,6 +2051,19 @@ var ServerCommand = /* @__PURE__ */ ((ServerCommand2) => {
2051
2051
  ServerCommand2[ServerCommand2["packetentities"] = 18] = "packetentities";
2052
2052
  ServerCommand2[ServerCommand2["deltapacketentities"] = 19] = "deltapacketentities";
2053
2053
  ServerCommand2[ServerCommand2["frame"] = 20] = "frame";
2054
+ ServerCommand2[ServerCommand2["splitclient"] = 21] = "splitclient";
2055
+ ServerCommand2[ServerCommand2["configblast"] = 22] = "configblast";
2056
+ ServerCommand2[ServerCommand2["spawnbaselineblast"] = 23] = "spawnbaselineblast";
2057
+ ServerCommand2[ServerCommand2["level_restart"] = 24] = "level_restart";
2058
+ ServerCommand2[ServerCommand2["damage"] = 25] = "damage";
2059
+ ServerCommand2[ServerCommand2["locprint"] = 26] = "locprint";
2060
+ ServerCommand2[ServerCommand2["fog"] = 27] = "fog";
2061
+ ServerCommand2[ServerCommand2["waitingforplayers"] = 28] = "waitingforplayers";
2062
+ ServerCommand2[ServerCommand2["bot_chat"] = 29] = "bot_chat";
2063
+ ServerCommand2[ServerCommand2["poi"] = 30] = "poi";
2064
+ ServerCommand2[ServerCommand2["help_path"] = 31] = "help_path";
2065
+ ServerCommand2[ServerCommand2["muzzleflash3"] = 32] = "muzzleflash3";
2066
+ ServerCommand2[ServerCommand2["achievement"] = 33] = "achievement";
2054
2067
  return ServerCommand2;
2055
2068
  })(ServerCommand || {});
2056
2069
  var TempEntity = /* @__PURE__ */ ((TempEntity2) => {
@@ -2825,6 +2838,7 @@ var U_OLDORIGIN = 1 << 24;
2825
2838
  var U_SKIN16 = 1 << 25;
2826
2839
  var U_SOUND2 = 1 << 26;
2827
2840
  var U_SOLID2 = 1 << 27;
2841
+ var U_ALPHA = 1 << 13;
2828
2842
  var RECORD_CLIENT = 1;
2829
2843
  var RECORD_SERVER = 2;
2830
2844
  var RECORD_RELAY = 128;
@@ -2844,7 +2858,14 @@ var createEmptyEntityState = () => ({
2844
2858
  sound: 0,
2845
2859
  event: 0,
2846
2860
  solid: 0,
2847
- bits: 0
2861
+ bits: 0,
2862
+ alpha: 0,
2863
+ scale: 0,
2864
+ instanceBits: 0,
2865
+ loopVolume: 0,
2866
+ loopAttenuation: 0,
2867
+ owner: 0,
2868
+ oldFrame: 0
2848
2869
  });
2849
2870
  var createEmptyProtocolPlayerState = () => ({
2850
2871
  pm_type: 0,
@@ -2864,7 +2885,11 @@ var createEmptyProtocolPlayerState = () => ({
2864
2885
  blend: [0, 0, 0, 0],
2865
2886
  fov: 0,
2866
2887
  rdflags: 0,
2867
- stats: new Array(32).fill(0)
2888
+ stats: new Array(32).fill(0),
2889
+ gunskin: 0,
2890
+ gunrate: 0,
2891
+ damage_blend: [0, 0, 0, 0],
2892
+ team_id: 0
2868
2893
  });
2869
2894
  var NetworkMessageParser = class {
2870
2895
  constructor(stream, handler) {
@@ -2875,17 +2900,11 @@ var NetworkMessageParser = class {
2875
2900
  }
2876
2901
  translateCommand(cmd) {
2877
2902
  if (this.protocolVersion === 0) {
2878
- if (cmd === 7) {
2879
- return ServerCommand.serverdata;
2880
- }
2881
- if (cmd === 12) {
2882
- return ServerCommand.serverdata;
2883
- }
2903
+ if (cmd === 7) return ServerCommand.serverdata;
2904
+ if (cmd === 12) return ServerCommand.serverdata;
2884
2905
  }
2885
2906
  if (this.protocolVersion === 25) {
2886
- if (cmd >= 7 && cmd <= 15) {
2887
- return cmd + 5;
2888
- }
2907
+ if (cmd >= 7 && cmd <= 15) return cmd + 5;
2889
2908
  if (cmd === 1) return ServerCommand.print;
2890
2909
  if (cmd === 2) return ServerCommand.stufftext;
2891
2910
  if (cmd === 3) return ServerCommand.sound;
@@ -2909,8 +2928,10 @@ var NetworkMessageParser = class {
2909
2928
  case ServerCommand.nop:
2910
2929
  break;
2911
2930
  case ServerCommand.disconnect:
2931
+ if (this.handler && this.handler.onDisconnect) this.handler.onDisconnect();
2912
2932
  break;
2913
2933
  case ServerCommand.reconnect:
2934
+ if (this.handler && this.handler.onReconnect) this.handler.onReconnect();
2914
2935
  break;
2915
2936
  case ServerCommand.print:
2916
2937
  this.parsePrint();
@@ -2963,6 +2984,36 @@ var NetworkMessageParser = class {
2963
2984
  case ServerCommand.temp_entity:
2964
2985
  this.parseTempEntity();
2965
2986
  break;
2987
+ // New Rerelease Commands
2988
+ case ServerCommand.splitclient:
2989
+ break;
2990
+ case ServerCommand.configblast:
2991
+ break;
2992
+ case ServerCommand.spawnbaselineblast:
2993
+ break;
2994
+ case ServerCommand.level_restart:
2995
+ if (this.handler && this.handler.onLevelRestart) this.handler.onLevelRestart();
2996
+ break;
2997
+ case ServerCommand.damage:
2998
+ break;
2999
+ case ServerCommand.locprint:
3000
+ break;
3001
+ case ServerCommand.fog:
3002
+ break;
3003
+ case ServerCommand.waitingforplayers:
3004
+ if (this.handler && this.handler.onWaitingForPlayers) this.handler.onWaitingForPlayers();
3005
+ break;
3006
+ case ServerCommand.bot_chat:
3007
+ break;
3008
+ case ServerCommand.poi:
3009
+ break;
3010
+ case ServerCommand.help_path:
3011
+ break;
3012
+ case ServerCommand.muzzleflash3:
3013
+ this.parseMuzzleFlash3();
3014
+ break;
3015
+ case ServerCommand.achievement:
3016
+ break;
2966
3017
  default:
2967
3018
  console.warn(`Unknown server command: ${originalCmd} (translated: ${cmd}) at offset ${this.stream.getPosition() - 1}`);
2968
3019
  return;
@@ -2976,15 +3027,27 @@ var NetworkMessageParser = class {
2976
3027
  parsePrint() {
2977
3028
  const id = this.stream.readByte();
2978
3029
  const str3 = this.stream.readString();
3030
+ if (this.handler) {
3031
+ this.handler.onPrint(id, str3);
3032
+ }
2979
3033
  }
2980
3034
  parseStuffText() {
2981
3035
  const text = this.stream.readString();
3036
+ if (this.handler) {
3037
+ this.handler.onStuffText(text);
3038
+ }
2982
3039
  }
2983
3040
  parseLayout() {
2984
3041
  const layout = this.stream.readString();
3042
+ if (this.handler) {
3043
+ this.handler.onLayout(layout);
3044
+ }
2985
3045
  }
2986
3046
  parseCenterPrint() {
2987
3047
  const centerMsg = this.stream.readString();
3048
+ if (this.handler) {
3049
+ this.handler.onCenterPrint(centerMsg);
3050
+ }
2988
3051
  }
2989
3052
  parseServerData() {
2990
3053
  this.protocolVersion = this.stream.readLong();
@@ -3067,6 +3130,11 @@ var NetworkMessageParser = class {
3067
3130
  const weapon = this.stream.readByte();
3068
3131
  if (this.handler) this.handler.onMuzzleFlash2(ent, weapon);
3069
3132
  }
3133
+ parseMuzzleFlash3() {
3134
+ const ent = this.stream.readShort();
3135
+ const weapon = this.stream.readShort();
3136
+ if (this.handler && this.handler.onMuzzleFlash3) this.handler.onMuzzleFlash3(ent, weapon);
3137
+ }
3070
3138
  parseTempEntity() {
3071
3139
  const type = this.stream.readByte();
3072
3140
  const pos = { x: 0, y: 0, z: 0 };
@@ -4442,6 +4510,13 @@ var ClientNetworkHandler = class {
4442
4510
  if (bits & U_SOUND2) to.sound = from.sound;
4443
4511
  if (bits & U_EVENT2) to.event = from.event;
4444
4512
  if (bits & U_SOLID2) to.solid = from.solid;
4513
+ if (from.alpha !== 0) to.alpha = from.alpha;
4514
+ if (from.scale !== 0) to.scale = from.scale;
4515
+ if (from.instanceBits !== 0) to.instanceBits = from.instanceBits;
4516
+ if (from.loopVolume !== 0) to.loopVolume = from.loopVolume;
4517
+ if (from.loopAttenuation !== 0) to.loopAttenuation = from.loopAttenuation;
4518
+ if (from.owner !== 0) to.owner = from.owner;
4519
+ if (from.oldFrame !== 0) to.oldFrame = from.oldFrame;
4445
4520
  }
4446
4521
  onCenterPrint(msg) {
4447
4522
  if (this.callbacks?.onCenterPrint) {
@@ -4485,6 +4560,18 @@ var ClientNetworkHandler = class {
4485
4560
  }
4486
4561
  onMuzzleFlash2(ent, weapon) {
4487
4562
  }
4563
+ onMuzzleFlash3(ent, weapon) {
4564
+ if (this.callbacks?.onMuzzleFlash3) {
4565
+ this.callbacks.onMuzzleFlash3(ent, weapon);
4566
+ }
4567
+ }
4568
+ // New Rerelease Handlers (Stubbed)
4569
+ onLevelRestart() {
4570
+ if (this.callbacks?.onLevelRestart) this.callbacks.onLevelRestart();
4571
+ }
4572
+ onWaitingForPlayers() {
4573
+ if (this.callbacks?.onWaitingForPlayers) this.callbacks.onWaitingForPlayers();
4574
+ }
4488
4575
  onDisconnect() {
4489
4576
  console.log("Demo disconnected");
4490
4577
  }