quake2ts 0.0.650 → 0.0.652
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 +3 -3
- package/packages/game/dist/tsconfig.tsbuildinfo +1 -1
- package/packages/game/dist/types/entities/projectiles/prox.d.ts.map +1 -1
- package/packages/test-utils/dist/index.cjs +98 -0
- package/packages/test-utils/dist/index.cjs.map +1 -1
- package/packages/test-utils/dist/index.d.cts +12 -5
- package/packages/test-utils/dist/index.d.ts +12 -5
- package/packages/test-utils/dist/index.js +97 -0
- package/packages/test-utils/dist/index.js.map +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prox.d.ts","sourceRoot":"","sources":["../../../../src/entities/projectiles/prox.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,MAAM,EAAqC,MAAM,cAAc,CAAC;AACzE,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAC5C,OAAO,EAAE,IAAI,EAAyH,MAAM,kBAAkB,CAAC;AAc/J,wBAAgB,cAAc,CAC1B,QAAQ,EAAE,YAAY,EACtB,KAAK,EAAE,MAAM,EACb,KAAK,EAAE,IAAI,EACX,GAAG,EAAE,IAAI,EACT,KAAK,GAAE,MAAY,GACpB,MAAM,
|
|
1
|
+
{"version":3,"file":"prox.d.ts","sourceRoot":"","sources":["../../../../src/entities/projectiles/prox.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,MAAM,EAAqC,MAAM,cAAc,CAAC;AACzE,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAC5C,OAAO,EAAE,IAAI,EAAyH,MAAM,kBAAkB,CAAC;AAc/J,wBAAgB,cAAc,CAC1B,QAAQ,EAAE,YAAY,EACtB,KAAK,EAAE,MAAM,EACb,KAAK,EAAE,IAAI,EACX,GAAG,EAAE,IAAI,EACT,KAAK,GAAE,MAAY,GACpB,MAAM,CAiJR"}
|
|
@@ -217,6 +217,7 @@ __export(index_exports, {
|
|
|
217
217
|
makePlane: () => makePlane,
|
|
218
218
|
measureSnapshotSize: () => measureSnapshotSize,
|
|
219
219
|
mockMonsterAttacks: () => mockMonsterAttacks,
|
|
220
|
+
parseProtocolPlayerState: () => parseProtocolPlayerState,
|
|
220
221
|
randomVector3: () => randomVector3,
|
|
221
222
|
renderAndCapture: () => renderAndCapture,
|
|
222
223
|
renderAndExpectSnapshot: () => renderAndExpectSnapshot,
|
|
@@ -1811,6 +1812,7 @@ function simulatePlayerInput(client, input) {
|
|
|
1811
1812
|
}
|
|
1812
1813
|
|
|
1813
1814
|
// src/server/helpers/snapshot.ts
|
|
1815
|
+
var import_shared8 = require("@quake2ts/shared");
|
|
1814
1816
|
function createServerSnapshot(serverState, clientNum) {
|
|
1815
1817
|
const visibleEntities = [];
|
|
1816
1818
|
if (serverState.baselines) {
|
|
@@ -1873,6 +1875,101 @@ async function simulateSnapshotDelivery(snapshot, reliability = 1) {
|
|
|
1873
1875
|
}
|
|
1874
1876
|
return snapshot;
|
|
1875
1877
|
}
|
|
1878
|
+
function parseProtocolPlayerState(data) {
|
|
1879
|
+
const stream = new import_shared8.BinaryStream(data.buffer);
|
|
1880
|
+
const ps = {
|
|
1881
|
+
pm_type: 0,
|
|
1882
|
+
origin: { x: 0, y: 0, z: 0 },
|
|
1883
|
+
velocity: { x: 0, y: 0, z: 0 },
|
|
1884
|
+
pm_time: 0,
|
|
1885
|
+
pm_flags: 0,
|
|
1886
|
+
gravity: 0,
|
|
1887
|
+
delta_angles: { x: 0, y: 0, z: 0 },
|
|
1888
|
+
viewoffset: { x: 0, y: 0, z: 0 },
|
|
1889
|
+
viewangles: { x: 0, y: 0, z: 0 },
|
|
1890
|
+
kick_angles: { x: 0, y: 0, z: 0 },
|
|
1891
|
+
gun_index: 0,
|
|
1892
|
+
gun_frame: 0,
|
|
1893
|
+
gun_offset: { x: 0, y: 0, z: 0 },
|
|
1894
|
+
gun_angles: { x: 0, y: 0, z: 0 },
|
|
1895
|
+
blend: [0, 0, 0, 0],
|
|
1896
|
+
fov: 0,
|
|
1897
|
+
rdflags: 0,
|
|
1898
|
+
stats: new Array(32).fill(0),
|
|
1899
|
+
watertype: 0
|
|
1900
|
+
};
|
|
1901
|
+
const flags = stream.readShort();
|
|
1902
|
+
if (flags & 1) ps.pm_type = stream.readByte();
|
|
1903
|
+
if (flags & 2) {
|
|
1904
|
+
const x = stream.readShort() * 0.125;
|
|
1905
|
+
const y = stream.readShort() * 0.125;
|
|
1906
|
+
const z = stream.readShort() * 0.125;
|
|
1907
|
+
ps.origin = { x, y, z };
|
|
1908
|
+
}
|
|
1909
|
+
if (flags & 4) {
|
|
1910
|
+
const x = stream.readShort() * 0.125;
|
|
1911
|
+
const y = stream.readShort() * 0.125;
|
|
1912
|
+
const z = stream.readShort() * 0.125;
|
|
1913
|
+
ps.velocity = { x, y, z };
|
|
1914
|
+
}
|
|
1915
|
+
if (flags & 8) ps.pm_time = stream.readByte();
|
|
1916
|
+
if (flags & 16) ps.pm_flags = stream.readByte();
|
|
1917
|
+
if (flags & 32) ps.gravity = stream.readShort();
|
|
1918
|
+
if (flags & 64) {
|
|
1919
|
+
const x = stream.readShort() * (180 / 32768);
|
|
1920
|
+
const y = stream.readShort() * (180 / 32768);
|
|
1921
|
+
const z = stream.readShort() * (180 / 32768);
|
|
1922
|
+
ps.delta_angles = { x, y, z };
|
|
1923
|
+
}
|
|
1924
|
+
if (flags & 128) {
|
|
1925
|
+
const x = stream.readChar() * 0.25;
|
|
1926
|
+
const y = stream.readChar() * 0.25;
|
|
1927
|
+
const z = stream.readChar() * 0.25;
|
|
1928
|
+
ps.viewoffset = { x, y, z };
|
|
1929
|
+
}
|
|
1930
|
+
if (flags & 256) {
|
|
1931
|
+
const x = stream.readAngle16();
|
|
1932
|
+
const y = stream.readAngle16();
|
|
1933
|
+
const z = stream.readAngle16();
|
|
1934
|
+
ps.viewangles = { x, y, z };
|
|
1935
|
+
}
|
|
1936
|
+
if (flags & 512) {
|
|
1937
|
+
const x = stream.readChar() * 0.25;
|
|
1938
|
+
const y = stream.readChar() * 0.25;
|
|
1939
|
+
const z = stream.readChar() * 0.25;
|
|
1940
|
+
ps.kick_angles = { x, y, z };
|
|
1941
|
+
}
|
|
1942
|
+
if (flags & 4096) ps.gun_index = stream.readByte();
|
|
1943
|
+
if (flags & 8192) {
|
|
1944
|
+
ps.gun_frame = stream.readByte();
|
|
1945
|
+
const ox = stream.readChar() * 0.25;
|
|
1946
|
+
const oy = stream.readChar() * 0.25;
|
|
1947
|
+
const oz = stream.readChar() * 0.25;
|
|
1948
|
+
ps.gun_offset = { x: ox, y: oy, z: oz };
|
|
1949
|
+
const ax = stream.readChar() * 0.25;
|
|
1950
|
+
const ay = stream.readChar() * 0.25;
|
|
1951
|
+
const az = stream.readChar() * 0.25;
|
|
1952
|
+
ps.gun_angles = { x: ax, y: ay, z: az };
|
|
1953
|
+
}
|
|
1954
|
+
if (flags & 1024) {
|
|
1955
|
+
ps.blend = [
|
|
1956
|
+
stream.readByte(),
|
|
1957
|
+
stream.readByte(),
|
|
1958
|
+
stream.readByte(),
|
|
1959
|
+
stream.readByte()
|
|
1960
|
+
];
|
|
1961
|
+
}
|
|
1962
|
+
if (flags & 2048) ps.fov = stream.readByte();
|
|
1963
|
+
if (flags & 16384) ps.rdflags = stream.readByte();
|
|
1964
|
+
if (flags & 32768) ps.watertype = stream.readByte();
|
|
1965
|
+
const statbits = stream.readLong();
|
|
1966
|
+
for (let i = 0; i < 32; i++) {
|
|
1967
|
+
if (statbits & 1 << i) {
|
|
1968
|
+
ps.stats[i] = stream.readShort();
|
|
1969
|
+
}
|
|
1970
|
+
}
|
|
1971
|
+
return ps;
|
|
1972
|
+
}
|
|
1876
1973
|
|
|
1877
1974
|
// src/server/helpers/bandwidth.ts
|
|
1878
1975
|
function createMockRateLimiter(bytesPerSecond) {
|
|
@@ -5226,6 +5323,7 @@ function createVisualTestScenario(sceneName) {
|
|
|
5226
5323
|
makePlane,
|
|
5227
5324
|
measureSnapshotSize,
|
|
5228
5325
|
mockMonsterAttacks,
|
|
5326
|
+
parseProtocolPlayerState,
|
|
5229
5327
|
randomVector3,
|
|
5230
5328
|
renderAndCapture,
|
|
5231
5329
|
renderAndExpectSnapshot,
|