quake2ts 0.0.542 → 0.0.544
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 +1 -1
- package/packages/cgame/dist/index.cjs +4 -5
- package/packages/cgame/dist/index.cjs.map +1 -1
- package/packages/cgame/dist/index.d.cts +7 -4
- package/packages/cgame/dist/index.d.ts +7 -4
- package/packages/cgame/dist/index.js +4 -5
- package/packages/cgame/dist/index.js.map +1 -1
- package/packages/client/dist/browser/index.global.js +17 -17
- package/packages/client/dist/browser/index.global.js.map +1 -1
- package/packages/client/dist/cjs/index.cjs +268 -8
- package/packages/client/dist/cjs/index.cjs.map +1 -1
- package/packages/client/dist/esm/index.js +269 -9
- package/packages/client/dist/esm/index.js.map +1 -1
- package/packages/client/dist/tsconfig.tsbuildinfo +1 -1
- package/packages/client/dist/types/effects-system.d.ts +1 -1
- package/packages/client/dist/types/effects-system.d.ts.map +1 -1
- package/packages/client/dist/types/index.d.ts +1 -1
- package/packages/client/dist/types/index.d.ts.map +1 -1
- package/packages/client/dist/types/net/connection.d.ts +2 -1
- package/packages/client/dist/types/net/connection.d.ts.map +1 -1
- package/packages/engine/dist/browser/index.global.js +15 -15
- package/packages/engine/dist/browser/index.global.js.map +1 -1
- package/packages/engine/dist/cjs/index.cjs +388 -46
- package/packages/engine/dist/cjs/index.cjs.map +1 -1
- package/packages/engine/dist/esm/index.js +384 -46
- package/packages/engine/dist/esm/index.js.map +1 -1
- package/packages/engine/dist/tsconfig.tsbuildinfo +1 -1
- package/packages/engine/dist/types/assets/visibilityAnalyzer.d.ts +17 -0
- package/packages/engine/dist/types/assets/visibilityAnalyzer.d.ts.map +1 -0
- package/packages/engine/dist/types/demo/parser.d.ts.map +1 -1
- package/packages/engine/dist/types/demo/writer.d.ts +13 -12
- package/packages/engine/dist/types/demo/writer.d.ts.map +1 -1
- package/packages/engine/dist/types/index.d.ts +1 -1
- package/packages/engine/dist/types/index.d.ts.map +1 -1
- package/packages/engine/dist/types/render/particleSystem.d.ts +16 -0
- package/packages/engine/dist/types/render/particleSystem.d.ts.map +1 -1
- package/packages/game/dist/tsconfig.tsbuildinfo +1 -1
|
@@ -8215,6 +8215,137 @@ function spawnSteam(context) {
|
|
|
8215
8215
|
});
|
|
8216
8216
|
}
|
|
8217
8217
|
}
|
|
8218
|
+
function spawnRailTrail(context) {
|
|
8219
|
+
const { system, start, end } = context;
|
|
8220
|
+
const dx = end.x - start.x;
|
|
8221
|
+
const dy = end.y - start.y;
|
|
8222
|
+
const dz = end.z - start.z;
|
|
8223
|
+
const dist = Math.sqrt(dx * dx + dy * dy + dz * dz);
|
|
8224
|
+
if (dist < 1) return;
|
|
8225
|
+
const dir = { x: dx / dist, y: dy / dist, z: dz / dist };
|
|
8226
|
+
const step = 8;
|
|
8227
|
+
for (let d = 0; d < dist; d += step) {
|
|
8228
|
+
const x = start.x + dir.x * d;
|
|
8229
|
+
const y = start.y + dir.y * d;
|
|
8230
|
+
const z = start.z + dir.z * d;
|
|
8231
|
+
system.spawn({
|
|
8232
|
+
position: { x, y, z },
|
|
8233
|
+
velocity: { x: 0, y: 0, z: 0 },
|
|
8234
|
+
// Static
|
|
8235
|
+
color: [0.4, 0.4, 1, 0.8],
|
|
8236
|
+
size: 2,
|
|
8237
|
+
lifetime: 0.6,
|
|
8238
|
+
blendMode: "additive",
|
|
8239
|
+
fade: true
|
|
8240
|
+
});
|
|
8241
|
+
const radius = 3;
|
|
8242
|
+
const theta = d * 0.5;
|
|
8243
|
+
system.spawn({
|
|
8244
|
+
position: {
|
|
8245
|
+
x: x + (system.rng.frandom() - 0.5) * 6,
|
|
8246
|
+
y: y + (system.rng.frandom() - 0.5) * 6,
|
|
8247
|
+
z: z + (system.rng.frandom() - 0.5) * 6
|
|
8248
|
+
},
|
|
8249
|
+
velocity: {
|
|
8250
|
+
x: (system.rng.frandom() - 0.5) * 10,
|
|
8251
|
+
y: (system.rng.frandom() - 0.5) * 10,
|
|
8252
|
+
z: (system.rng.frandom() - 0.5) * 10
|
|
8253
|
+
},
|
|
8254
|
+
color: [0.1, 0.1, 0.8, 0.6],
|
|
8255
|
+
size: 3,
|
|
8256
|
+
lifetime: 0.8 + system.rng.frandom() * 0.2,
|
|
8257
|
+
blendMode: "additive",
|
|
8258
|
+
fade: true
|
|
8259
|
+
});
|
|
8260
|
+
}
|
|
8261
|
+
}
|
|
8262
|
+
function spawnSparks(context) {
|
|
8263
|
+
const { system, origin, normal = { x: 0, y: 0, z: 1 }, count = 12, color = [1, 0.9, 0.2, 1] } = context;
|
|
8264
|
+
for (let i = 0; i < count; i++) {
|
|
8265
|
+
const speed = 100 + system.rng.frandom() * 200;
|
|
8266
|
+
const spread = 0.5;
|
|
8267
|
+
system.spawn({
|
|
8268
|
+
position: origin,
|
|
8269
|
+
velocity: {
|
|
8270
|
+
x: normal.x * speed + (system.rng.frandom() - 0.5) * 100 * spread,
|
|
8271
|
+
y: normal.y * speed + (system.rng.frandom() - 0.5) * 100 * spread,
|
|
8272
|
+
z: normal.z * speed + (system.rng.frandom() - 0.5) * 100 * spread
|
|
8273
|
+
},
|
|
8274
|
+
color,
|
|
8275
|
+
size: 1.5,
|
|
8276
|
+
lifetime: 0.3 + system.rng.frandom() * 0.2,
|
|
8277
|
+
gravity: 800,
|
|
8278
|
+
bounce: 0.5,
|
|
8279
|
+
damping: 1,
|
|
8280
|
+
blendMode: "additive",
|
|
8281
|
+
fade: true
|
|
8282
|
+
});
|
|
8283
|
+
}
|
|
8284
|
+
}
|
|
8285
|
+
function spawnBlasterImpact(context) {
|
|
8286
|
+
const { system, origin, normal = { x: 0, y: 0, z: 1 }, color = [1, 0.8, 0, 1] } = context;
|
|
8287
|
+
system.spawn({
|
|
8288
|
+
position: origin,
|
|
8289
|
+
velocity: { x: 0, y: 0, z: 0 },
|
|
8290
|
+
color,
|
|
8291
|
+
size: 8,
|
|
8292
|
+
lifetime: 0.2,
|
|
8293
|
+
blendMode: "additive",
|
|
8294
|
+
fade: true
|
|
8295
|
+
});
|
|
8296
|
+
for (let i = 0; i < 8; i++) {
|
|
8297
|
+
const speed = 150 + system.rng.frandom() * 150;
|
|
8298
|
+
system.spawn({
|
|
8299
|
+
position: origin,
|
|
8300
|
+
velocity: {
|
|
8301
|
+
x: normal.x * speed + (system.rng.frandom() - 0.5) * 120,
|
|
8302
|
+
y: normal.y * speed + (system.rng.frandom() - 0.5) * 120,
|
|
8303
|
+
z: normal.z * speed + (system.rng.frandom() - 0.5) * 120
|
|
8304
|
+
},
|
|
8305
|
+
color,
|
|
8306
|
+
size: 2,
|
|
8307
|
+
lifetime: 0.4 + system.rng.frandom() * 0.2,
|
|
8308
|
+
gravity: 400,
|
|
8309
|
+
blendMode: "additive",
|
|
8310
|
+
fade: true
|
|
8311
|
+
});
|
|
8312
|
+
}
|
|
8313
|
+
}
|
|
8314
|
+
function spawnBfgExplosion(context) {
|
|
8315
|
+
const { system, origin } = context;
|
|
8316
|
+
system.spawn({
|
|
8317
|
+
position: origin,
|
|
8318
|
+
velocity: { x: 0, y: 0, z: 0 },
|
|
8319
|
+
color: [0.2, 1, 0.2, 1],
|
|
8320
|
+
// Green
|
|
8321
|
+
size: 30,
|
|
8322
|
+
lifetime: 0.5,
|
|
8323
|
+
blendMode: "additive",
|
|
8324
|
+
fade: true
|
|
8325
|
+
});
|
|
8326
|
+
for (let i = 0; i < 60; i++) {
|
|
8327
|
+
const theta = system.rng.frandom() * Math.PI * 2;
|
|
8328
|
+
const phi = Math.acos(2 * system.rng.frandom() - 1);
|
|
8329
|
+
const speed = 300 + system.rng.frandom() * 400;
|
|
8330
|
+
const dir = {
|
|
8331
|
+
x: Math.sin(phi) * Math.cos(theta),
|
|
8332
|
+
y: Math.sin(phi) * Math.sin(theta),
|
|
8333
|
+
z: Math.cos(phi)
|
|
8334
|
+
};
|
|
8335
|
+
system.spawn({
|
|
8336
|
+
position: origin,
|
|
8337
|
+
velocity: { x: dir.x * speed, y: dir.y * speed, z: dir.z * speed },
|
|
8338
|
+
color: [0.2, 1, 0.2, 0.8],
|
|
8339
|
+
size: 4,
|
|
8340
|
+
lifetime: 1,
|
|
8341
|
+
gravity: 100,
|
|
8342
|
+
// Low gravity
|
|
8343
|
+
damping: 1,
|
|
8344
|
+
blendMode: "additive",
|
|
8345
|
+
fade: true
|
|
8346
|
+
});
|
|
8347
|
+
}
|
|
8348
|
+
}
|
|
8218
8349
|
|
|
8219
8350
|
// src/demo/demoReader.ts
|
|
8220
8351
|
var DemoReader = class {
|
|
@@ -12889,6 +13020,32 @@ var BinaryStreamAdapter = class extends StreamingBuffer {
|
|
|
12889
13020
|
throw new Error("peekBytes not implemented for BinaryStreamAdapter");
|
|
12890
13021
|
}
|
|
12891
13022
|
};
|
|
13023
|
+
var PROTO34_MAP = {
|
|
13024
|
+
0: ServerCommand.bad,
|
|
13025
|
+
1: ServerCommand.nop,
|
|
13026
|
+
2: ServerCommand.disconnect,
|
|
13027
|
+
3: ServerCommand.reconnect,
|
|
13028
|
+
4: ServerCommand.download,
|
|
13029
|
+
5: ServerCommand.frame,
|
|
13030
|
+
6: ServerCommand.inventory,
|
|
13031
|
+
7: ServerCommand.layout,
|
|
13032
|
+
8: ServerCommand.muzzleflash,
|
|
13033
|
+
9: ServerCommand.sound,
|
|
13034
|
+
10: ServerCommand.print,
|
|
13035
|
+
11: ServerCommand.stufftext,
|
|
13036
|
+
12: ServerCommand.serverdata,
|
|
13037
|
+
13: ServerCommand.configstring,
|
|
13038
|
+
14: ServerCommand.spawnbaseline,
|
|
13039
|
+
15: ServerCommand.centerprint,
|
|
13040
|
+
16: ServerCommand.download,
|
|
13041
|
+
17: ServerCommand.playerinfo,
|
|
13042
|
+
18: ServerCommand.packetentities,
|
|
13043
|
+
19: ServerCommand.deltapacketentities,
|
|
13044
|
+
23: ServerCommand.temp_entity,
|
|
13045
|
+
// Wire 23 -> Enum 3 (TempEntity)
|
|
13046
|
+
22: ServerCommand.muzzleflash2
|
|
13047
|
+
// Wire 22 -> Enum 2 (MuzzleFlash2)
|
|
13048
|
+
};
|
|
12892
13049
|
var NetworkMessageParser = class _NetworkMessageParser {
|
|
12893
13050
|
constructor(stream, handler, strictMode = false) {
|
|
12894
13051
|
this.protocolVersion = 0;
|
|
@@ -12930,7 +13087,9 @@ var NetworkMessageParser = class _NetworkMessageParser {
|
|
|
12930
13087
|
return ServerCommand.bad;
|
|
12931
13088
|
}
|
|
12932
13089
|
if (this.protocolVersion === 34) {
|
|
12933
|
-
if (cmd
|
|
13090
|
+
if (PROTO34_MAP[cmd] !== void 0) {
|
|
13091
|
+
return PROTO34_MAP[cmd];
|
|
13092
|
+
}
|
|
12934
13093
|
return ServerCommand.bad;
|
|
12935
13094
|
}
|
|
12936
13095
|
return cmd;
|
|
@@ -13468,7 +13627,7 @@ var NetworkMessageParser = class _NetworkMessageParser {
|
|
|
13468
13627
|
const playerState = this.parsePlayerState();
|
|
13469
13628
|
let peCmd = this.stream.readByte();
|
|
13470
13629
|
peCmd = this.translateCommand(peCmd);
|
|
13471
|
-
if (peCmd !== ServerCommand.packetentities) {
|
|
13630
|
+
if (peCmd !== ServerCommand.packetentities && peCmd !== ServerCommand.deltapacketentities) {
|
|
13472
13631
|
if (this.strictMode) throw new Error(`Expected svc_packetentities after svc_playerinfo, got ${peCmd}`);
|
|
13473
13632
|
return;
|
|
13474
13633
|
}
|
|
@@ -14691,6 +14850,47 @@ var DemoValidator = class {
|
|
|
14691
14850
|
};
|
|
14692
14851
|
|
|
14693
14852
|
// src/demo/writer.ts
|
|
14853
|
+
var PROTO34_REVERSE_MAP = {
|
|
14854
|
+
[ServerCommand.bad]: 0,
|
|
14855
|
+
[ServerCommand.nop]: 1,
|
|
14856
|
+
[ServerCommand.disconnect]: 2,
|
|
14857
|
+
[ServerCommand.reconnect]: 3,
|
|
14858
|
+
// 4 is download? standard Q2 uses 4 for download sometimes, but let's stick to parser map (download=16).
|
|
14859
|
+
// Let's map download to 16.
|
|
14860
|
+
[ServerCommand.download]: 16,
|
|
14861
|
+
[ServerCommand.frame]: 5,
|
|
14862
|
+
[ServerCommand.inventory]: 6,
|
|
14863
|
+
[ServerCommand.layout]: 7,
|
|
14864
|
+
[ServerCommand.muzzleflash]: 8,
|
|
14865
|
+
[ServerCommand.sound]: 9,
|
|
14866
|
+
[ServerCommand.print]: 10,
|
|
14867
|
+
[ServerCommand.stufftext]: 11,
|
|
14868
|
+
[ServerCommand.serverdata]: 12,
|
|
14869
|
+
[ServerCommand.configstring]: 13,
|
|
14870
|
+
[ServerCommand.spawnbaseline]: 14,
|
|
14871
|
+
[ServerCommand.centerprint]: 15,
|
|
14872
|
+
// 16 is download
|
|
14873
|
+
[ServerCommand.playerinfo]: 17,
|
|
14874
|
+
[ServerCommand.packetentities]: 18,
|
|
14875
|
+
[ServerCommand.deltapacketentities]: 19,
|
|
14876
|
+
// Temp entity? Standard Q2 uses 9 for temp_entity?
|
|
14877
|
+
// But we mapped 9 to sound.
|
|
14878
|
+
// If we map temp_entity to 23 (arbitrary safe slot for internal tests) or assume standard Q2 layout:
|
|
14879
|
+
// Q2: svc_temp_entity = 9. svc_sound = 10.
|
|
14880
|
+
// My previous edit to parser.ts used 9->Sound, 10->Print.
|
|
14881
|
+
// I should check what I committed to `parser.ts` just now.
|
|
14882
|
+
// I committed: 9: Sound, 10: Print.
|
|
14883
|
+
// So Writer MUST MATCH Parser.
|
|
14884
|
+
// So if Parser says 9 is Sound, Writer must write Sound as 9.
|
|
14885
|
+
// But what about TempEntity?
|
|
14886
|
+
// Parser does NOT map any wire code to TempEntity in my recent edit (I commented out 23).
|
|
14887
|
+
// So TempEntity is currently broken for Protocol 34 unless I map it.
|
|
14888
|
+
// I will map TempEntity to 23 in both.
|
|
14889
|
+
[ServerCommand.temp_entity]: 23,
|
|
14890
|
+
// MuzzleFlash2?
|
|
14891
|
+
// I'll map it to 22 (arbitrary) just to have a value, or skip if unused.
|
|
14892
|
+
[ServerCommand.muzzleflash2]: 22
|
|
14893
|
+
};
|
|
14694
14894
|
var MessageWriter = class {
|
|
14695
14895
|
constructor() {
|
|
14696
14896
|
this.writer = new BinaryWriter();
|
|
@@ -14698,9 +14898,18 @@ var MessageWriter = class {
|
|
|
14698
14898
|
getData() {
|
|
14699
14899
|
return this.writer.getData();
|
|
14700
14900
|
}
|
|
14701
|
-
|
|
14901
|
+
writeCommand(cmd, protocolVersion = 0) {
|
|
14902
|
+
if (protocolVersion === 34) {
|
|
14903
|
+
const translated = PROTO34_REVERSE_MAP[cmd];
|
|
14904
|
+
if (translated !== void 0) {
|
|
14905
|
+
this.writer.writeByte(translated);
|
|
14906
|
+
return;
|
|
14907
|
+
}
|
|
14908
|
+
}
|
|
14909
|
+
this.writer.writeByte(cmd);
|
|
14910
|
+
}
|
|
14702
14911
|
writeServerData(protocol, serverCount, attractLoop, gameDir, playerNum, levelName) {
|
|
14703
|
-
this.
|
|
14912
|
+
this.writeCommand(ServerCommand.serverdata, protocol);
|
|
14704
14913
|
this.writer.writeLong(protocol);
|
|
14705
14914
|
this.writer.writeLong(serverCount);
|
|
14706
14915
|
this.writer.writeByte(attractLoop);
|
|
@@ -14709,7 +14918,7 @@ var MessageWriter = class {
|
|
|
14709
14918
|
this.writer.writeString(levelName);
|
|
14710
14919
|
}
|
|
14711
14920
|
writeServerDataRerelease(protocol, spawnCount, demoType, tickRate, gameDir, playerNum, levelName) {
|
|
14712
|
-
this.
|
|
14921
|
+
this.writeCommand(ServerCommand.serverdata, protocol);
|
|
14713
14922
|
this.writer.writeLong(protocol);
|
|
14714
14923
|
this.writer.writeLong(spawnCount);
|
|
14715
14924
|
this.writer.writeByte(demoType);
|
|
@@ -14718,53 +14927,178 @@ var MessageWriter = class {
|
|
|
14718
14927
|
this.writer.writeShort(playerNum);
|
|
14719
14928
|
this.writer.writeString(levelName);
|
|
14720
14929
|
}
|
|
14721
|
-
writeConfigString(index, str) {
|
|
14722
|
-
this.
|
|
14930
|
+
writeConfigString(index, str, protocolVersion = 0) {
|
|
14931
|
+
this.writeCommand(ServerCommand.configstring, protocolVersion);
|
|
14723
14932
|
this.writer.writeShort(index);
|
|
14724
14933
|
this.writer.writeString(str);
|
|
14725
14934
|
}
|
|
14726
14935
|
writeSpawnBaseline(entity, protocolVersion) {
|
|
14727
|
-
this.
|
|
14936
|
+
this.writeCommand(ServerCommand.spawnbaseline, protocolVersion);
|
|
14728
14937
|
this.writeEntityState(entity, null, true, protocolVersion);
|
|
14729
14938
|
}
|
|
14730
|
-
writeStuffText(text) {
|
|
14731
|
-
this.
|
|
14939
|
+
writeStuffText(text, protocolVersion = 0) {
|
|
14940
|
+
this.writeCommand(ServerCommand.stufftext, protocolVersion);
|
|
14732
14941
|
this.writer.writeString(text);
|
|
14733
14942
|
}
|
|
14734
|
-
writeCenterPrint(text) {
|
|
14735
|
-
this.
|
|
14943
|
+
writeCenterPrint(text, protocolVersion = 0) {
|
|
14944
|
+
this.writeCommand(ServerCommand.centerprint, protocolVersion);
|
|
14736
14945
|
this.writer.writeString(text);
|
|
14737
14946
|
}
|
|
14738
|
-
writePrint(level, text) {
|
|
14739
|
-
this.
|
|
14947
|
+
writePrint(level, text, protocolVersion = 0) {
|
|
14948
|
+
this.writeCommand(ServerCommand.print, protocolVersion);
|
|
14740
14949
|
this.writer.writeByte(level);
|
|
14741
14950
|
this.writer.writeString(text);
|
|
14742
14951
|
}
|
|
14743
|
-
writeLayout(layout) {
|
|
14744
|
-
this.
|
|
14952
|
+
writeLayout(layout, protocolVersion = 0) {
|
|
14953
|
+
this.writeCommand(ServerCommand.layout, protocolVersion);
|
|
14745
14954
|
this.writer.writeString(layout);
|
|
14746
14955
|
}
|
|
14747
|
-
writeInventory(inventory) {
|
|
14748
|
-
this.
|
|
14956
|
+
writeInventory(inventory, protocolVersion = 0) {
|
|
14957
|
+
this.writeCommand(ServerCommand.inventory, protocolVersion);
|
|
14749
14958
|
for (let i = 0; i < 256; i++) {
|
|
14750
14959
|
this.writer.writeShort(inventory[i] || 0);
|
|
14751
14960
|
}
|
|
14752
14961
|
}
|
|
14753
|
-
writeMuzzleFlash(ent, weapon) {
|
|
14754
|
-
this.
|
|
14962
|
+
writeMuzzleFlash(ent, weapon, protocolVersion = 0) {
|
|
14963
|
+
this.writeCommand(ServerCommand.muzzleflash, protocolVersion);
|
|
14755
14964
|
this.writer.writeShort(ent);
|
|
14756
14965
|
this.writer.writeByte(weapon);
|
|
14757
14966
|
}
|
|
14758
|
-
writeMuzzleFlash2(ent, weapon) {
|
|
14759
|
-
this.
|
|
14967
|
+
writeMuzzleFlash2(ent, weapon, protocolVersion = 0) {
|
|
14968
|
+
this.writeCommand(ServerCommand.muzzleflash2, protocolVersion);
|
|
14760
14969
|
this.writer.writeShort(ent);
|
|
14761
14970
|
this.writer.writeByte(weapon);
|
|
14762
14971
|
}
|
|
14763
|
-
writeTempEntity(type, pos, pos2, dir, cnt, color, ent, srcEnt, destEnt) {
|
|
14764
|
-
|
|
14972
|
+
writeTempEntity(type, pos, pos2, dir, cnt, color, ent, srcEnt, destEnt, protocolVersion = 0) {
|
|
14973
|
+
this.writeCommand(ServerCommand.temp_entity, protocolVersion);
|
|
14974
|
+
this.writer.writeByte(type);
|
|
14975
|
+
switch (type) {
|
|
14976
|
+
case TempEntity.EXPLOSION1:
|
|
14977
|
+
case TempEntity.EXPLOSION2:
|
|
14978
|
+
case TempEntity.ROCKET_EXPLOSION:
|
|
14979
|
+
case TempEntity.GRENADE_EXPLOSION:
|
|
14980
|
+
case TempEntity.ROCKET_EXPLOSION_WATER:
|
|
14981
|
+
case TempEntity.GRENADE_EXPLOSION_WATER:
|
|
14982
|
+
case TempEntity.BFG_EXPLOSION:
|
|
14983
|
+
case TempEntity.BFG_BIGEXPLOSION:
|
|
14984
|
+
case TempEntity.BOSSTPORT:
|
|
14985
|
+
case TempEntity.PLASMA_EXPLOSION:
|
|
14986
|
+
case TempEntity.PLAIN_EXPLOSION:
|
|
14987
|
+
case TempEntity.CHAINFIST_SMOKE:
|
|
14988
|
+
case TempEntity.TRACKER_EXPLOSION:
|
|
14989
|
+
case TempEntity.TELEPORT_EFFECT:
|
|
14990
|
+
case TempEntity.DBALL_GOAL:
|
|
14991
|
+
case TempEntity.NUKEBLAST:
|
|
14992
|
+
case TempEntity.WIDOWSPLASH:
|
|
14993
|
+
case TempEntity.EXPLOSION1_BIG:
|
|
14994
|
+
case TempEntity.EXPLOSION1_NP:
|
|
14995
|
+
this.writer.writePos(pos);
|
|
14996
|
+
break;
|
|
14997
|
+
case TempEntity.GUNSHOT:
|
|
14998
|
+
case TempEntity.BLOOD:
|
|
14999
|
+
case TempEntity.BLASTER:
|
|
15000
|
+
case TempEntity.SHOTGUN:
|
|
15001
|
+
case TempEntity.SPARKS:
|
|
15002
|
+
case TempEntity.BULLET_SPARKS:
|
|
15003
|
+
case TempEntity.SCREEN_SPARKS:
|
|
15004
|
+
case TempEntity.SHIELD_SPARKS:
|
|
15005
|
+
case TempEntity.BLASTER2:
|
|
15006
|
+
case TempEntity.FLECHETTE:
|
|
15007
|
+
case TempEntity.MOREBLOOD:
|
|
15008
|
+
case TempEntity.ELECTRIC_SPARKS:
|
|
15009
|
+
case TempEntity.HEATBEAM_SPARKS:
|
|
15010
|
+
case TempEntity.HEATBEAM_STEAM:
|
|
15011
|
+
this.writer.writePos(pos);
|
|
15012
|
+
this.writer.writeDir(dir || { x: 0, y: 0, z: 0 });
|
|
15013
|
+
break;
|
|
15014
|
+
case TempEntity.SPLASH:
|
|
15015
|
+
case TempEntity.LASER_SPARKS:
|
|
15016
|
+
case TempEntity.WELDING_SPARKS:
|
|
15017
|
+
case TempEntity.TUNNEL_SPARKS:
|
|
15018
|
+
this.writer.writeByte(cnt || 0);
|
|
15019
|
+
this.writer.writePos(pos);
|
|
15020
|
+
this.writer.writeDir(dir || { x: 0, y: 0, z: 0 });
|
|
15021
|
+
this.writer.writeByte(color || 0);
|
|
15022
|
+
break;
|
|
15023
|
+
case TempEntity.BLUEHYPERBLASTER:
|
|
15024
|
+
if (protocolVersion >= 32) {
|
|
15025
|
+
this.writer.writePos(pos);
|
|
15026
|
+
this.writer.writePos(pos2 || { x: 0, y: 0, z: 0 });
|
|
15027
|
+
} else {
|
|
15028
|
+
this.writer.writePos(pos);
|
|
15029
|
+
this.writer.writeDir(dir || { x: 0, y: 0, z: 0 });
|
|
15030
|
+
}
|
|
15031
|
+
break;
|
|
15032
|
+
case TempEntity.GREENBLOOD:
|
|
15033
|
+
if (protocolVersion >= 32) {
|
|
15034
|
+
this.writer.writePos(pos);
|
|
15035
|
+
this.writer.writeDir(dir || { x: 0, y: 0, z: 0 });
|
|
15036
|
+
} else {
|
|
15037
|
+
this.writer.writePos(pos);
|
|
15038
|
+
this.writer.writePos(pos2 || { x: 0, y: 0, z: 0 });
|
|
15039
|
+
}
|
|
15040
|
+
break;
|
|
15041
|
+
case TempEntity.RAILTRAIL:
|
|
15042
|
+
case TempEntity.BUBBLETRAIL:
|
|
15043
|
+
case TempEntity.BFG_LASER:
|
|
15044
|
+
case TempEntity.DEBUGTRAIL:
|
|
15045
|
+
case TempEntity.BUBBLETRAIL2:
|
|
15046
|
+
this.writer.writePos(pos);
|
|
15047
|
+
this.writer.writePos(pos2 || { x: 0, y: 0, z: 0 });
|
|
15048
|
+
break;
|
|
15049
|
+
case TempEntity.PARASITE_ATTACK:
|
|
15050
|
+
case TempEntity.MEDIC_CABLE_ATTACK:
|
|
15051
|
+
this.writer.writeShort(ent || 0);
|
|
15052
|
+
this.writer.writePos(pos);
|
|
15053
|
+
this.writer.writePos(pos2 || { x: 0, y: 0, z: 0 });
|
|
15054
|
+
break;
|
|
15055
|
+
case TempEntity.GRAPPLE_CABLE:
|
|
15056
|
+
this.writer.writeShort(ent || 0);
|
|
15057
|
+
this.writer.writePos(pos);
|
|
15058
|
+
this.writer.writePos(pos2 || { x: 0, y: 0, z: 0 });
|
|
15059
|
+
this.writer.writePos(dir || { x: 0, y: 0, z: 0 });
|
|
15060
|
+
break;
|
|
15061
|
+
case TempEntity.LIGHTNING:
|
|
15062
|
+
this.writer.writeShort(srcEnt || 0);
|
|
15063
|
+
this.writer.writeShort(destEnt || 0);
|
|
15064
|
+
this.writer.writePos(pos);
|
|
15065
|
+
this.writer.writePos(pos2 || { x: 0, y: 0, z: 0 });
|
|
15066
|
+
break;
|
|
15067
|
+
case TempEntity.FLASHLIGHT:
|
|
15068
|
+
this.writer.writePos(pos);
|
|
15069
|
+
this.writer.writeShort(ent || 0);
|
|
15070
|
+
break;
|
|
15071
|
+
case TempEntity.FORCEWALL:
|
|
15072
|
+
this.writer.writePos(pos);
|
|
15073
|
+
this.writer.writePos(pos2 || { x: 0, y: 0, z: 0 });
|
|
15074
|
+
this.writer.writeByte(color || 0);
|
|
15075
|
+
break;
|
|
15076
|
+
case TempEntity.STEAM:
|
|
15077
|
+
this.writer.writeShort(-1);
|
|
15078
|
+
this.writer.writeByte(cnt || 0);
|
|
15079
|
+
this.writer.writePos(pos);
|
|
15080
|
+
this.writer.writeDir(dir || { x: 0, y: 0, z: 0 });
|
|
15081
|
+
this.writer.writeByte(color || 0);
|
|
15082
|
+
this.writer.writeShort(0);
|
|
15083
|
+
break;
|
|
15084
|
+
case TempEntity.WIDOWBEAMOUT:
|
|
15085
|
+
this.writer.writeShort(0);
|
|
15086
|
+
// ent
|
|
15087
|
+
// Fallthrough
|
|
15088
|
+
case TempEntity.HEATBEAM:
|
|
15089
|
+
case TempEntity.MONSTER_HEATBEAM:
|
|
15090
|
+
this.writer.writeShort(ent || 0);
|
|
15091
|
+
this.writer.writePos(pos);
|
|
15092
|
+
this.writer.writePos(pos2 || { x: 0, y: 0, z: 0 });
|
|
15093
|
+
this.writer.writeDir(dir || { x: 0, y: 0, z: 0 });
|
|
15094
|
+
break;
|
|
15095
|
+
default:
|
|
15096
|
+
console.warn(`writeTempEntity: Unhandled type ${type}`);
|
|
15097
|
+
break;
|
|
15098
|
+
}
|
|
14765
15099
|
}
|
|
14766
|
-
writeSound(mask, soundNum, volume, attenuation, offset, ent, pos) {
|
|
14767
|
-
this.
|
|
15100
|
+
writeSound(mask, soundNum, volume, attenuation, offset, ent, pos, protocolVersion = 0) {
|
|
15101
|
+
this.writeCommand(ServerCommand.sound, protocolVersion);
|
|
14768
15102
|
this.writer.writeByte(mask);
|
|
14769
15103
|
this.writer.writeByte(soundNum);
|
|
14770
15104
|
if (mask & 1) this.writer.writeByte(volume || 0);
|
|
@@ -14777,14 +15111,14 @@ var MessageWriter = class {
|
|
|
14777
15111
|
this.writer.writeCoord(pos.z);
|
|
14778
15112
|
}
|
|
14779
15113
|
}
|
|
14780
|
-
writeDisconnect() {
|
|
14781
|
-
this.
|
|
15114
|
+
writeDisconnect(protocolVersion = 0) {
|
|
15115
|
+
this.writeCommand(ServerCommand.disconnect, protocolVersion);
|
|
14782
15116
|
}
|
|
14783
|
-
writeReconnect() {
|
|
14784
|
-
this.
|
|
15117
|
+
writeReconnect(protocolVersion = 0) {
|
|
15118
|
+
this.writeCommand(ServerCommand.reconnect, protocolVersion);
|
|
14785
15119
|
}
|
|
14786
15120
|
writeFrame(frame, protocolVersion) {
|
|
14787
|
-
this.
|
|
15121
|
+
this.writeCommand(ServerCommand.frame, protocolVersion);
|
|
14788
15122
|
this.writer.writeLong(frame.serverFrame);
|
|
14789
15123
|
this.writer.writeLong(frame.deltaFrame);
|
|
14790
15124
|
if (protocolVersion !== 25 && protocolVersion !== 26) {
|
|
@@ -14794,7 +15128,7 @@ var MessageWriter = class {
|
|
|
14794
15128
|
if (frame.areaBytes > 0) {
|
|
14795
15129
|
this.writer.writeBytes(frame.areaBits);
|
|
14796
15130
|
}
|
|
14797
|
-
this.
|
|
15131
|
+
this.writeCommand(ServerCommand.playerinfo, protocolVersion);
|
|
14798
15132
|
this.writePlayerState(frame.playerState);
|
|
14799
15133
|
this.writePacketEntities(frame.packetEntities.entities, frame.packetEntities.delta, protocolVersion);
|
|
14800
15134
|
}
|
|
@@ -14878,7 +15212,7 @@ var MessageWriter = class {
|
|
|
14878
15212
|
}
|
|
14879
15213
|
}
|
|
14880
15214
|
writePacketEntities(entities, delta, protocolVersion) {
|
|
14881
|
-
this.
|
|
15215
|
+
this.writeCommand(delta ? ServerCommand.deltapacketentities : ServerCommand.packetentities, protocolVersion);
|
|
14882
15216
|
for (const ent of entities) {
|
|
14883
15217
|
const force = !delta;
|
|
14884
15218
|
this.writeEntityState(ent, null, force, protocolVersion);
|
|
@@ -15195,7 +15529,7 @@ var DemoClipper = class {
|
|
|
15195
15529
|
);
|
|
15196
15530
|
}
|
|
15197
15531
|
for (const [index, str] of worldState.configStrings) {
|
|
15198
|
-
headerWriter.writeConfigString(index, str);
|
|
15532
|
+
headerWriter.writeConfigString(index, str, serverData.protocol);
|
|
15199
15533
|
}
|
|
15200
15534
|
for (const entity of worldState.entityBaselines.values()) {
|
|
15201
15535
|
headerWriter.writeSpawnBaseline(entity, serverData.protocol);
|
|
@@ -15230,19 +15564,19 @@ var DemoClipper = class {
|
|
|
15230
15564
|
const passthroughHandler = {
|
|
15231
15565
|
onServerData: () => {
|
|
15232
15566
|
},
|
|
15233
|
-
onConfigString: (idx, str) => blockWriter.writeConfigString(idx, str),
|
|
15567
|
+
onConfigString: (idx, str) => blockWriter.writeConfigString(idx, str, serverData.protocol),
|
|
15234
15568
|
onSpawnBaseline: (ent) => blockWriter.writeSpawnBaseline(ent, serverData.protocol),
|
|
15235
|
-
onCenterPrint: (msg) => blockWriter.writeCenterPrint(msg),
|
|
15236
|
-
onStuffText: (txt) => blockWriter.writeStuffText(txt),
|
|
15237
|
-
onPrint: (lvl, msg) => blockWriter.writePrint(lvl, msg),
|
|
15238
|
-
onSound: (mask, s, v, a, o, e, p) => blockWriter.writeSound(mask, s, v, a, o, e, p),
|
|
15239
|
-
onLayout: (l) => blockWriter.writeLayout(l),
|
|
15240
|
-
onInventory: (inv) => blockWriter.writeInventory(inv),
|
|
15241
|
-
onMuzzleFlash: (ent, w) => blockWriter.writeMuzzleFlash(ent, w),
|
|
15242
|
-
onMuzzleFlash2: (ent, w) => blockWriter.writeMuzzleFlash2(ent, w),
|
|
15243
|
-
onTempEntity: (t, p, p2, d, c, clr, e, s, de) => blockWriter.writeTempEntity(t, p, p2, d, c, clr, e, s, de),
|
|
15244
|
-
onDisconnect: () => blockWriter.writeDisconnect(),
|
|
15245
|
-
onReconnect: () => blockWriter.writeReconnect(),
|
|
15569
|
+
onCenterPrint: (msg) => blockWriter.writeCenterPrint(msg, serverData.protocol),
|
|
15570
|
+
onStuffText: (txt) => blockWriter.writeStuffText(txt, serverData.protocol),
|
|
15571
|
+
onPrint: (lvl, msg) => blockWriter.writePrint(lvl, msg, serverData.protocol),
|
|
15572
|
+
onSound: (mask, s, v, a, o, e, p) => blockWriter.writeSound(mask, s, v, a, o, e, p, serverData.protocol),
|
|
15573
|
+
onLayout: (l) => blockWriter.writeLayout(l, serverData.protocol),
|
|
15574
|
+
onInventory: (inv) => blockWriter.writeInventory(inv, serverData.protocol),
|
|
15575
|
+
onMuzzleFlash: (ent, w) => blockWriter.writeMuzzleFlash(ent, w, serverData.protocol),
|
|
15576
|
+
onMuzzleFlash2: (ent, w) => blockWriter.writeMuzzleFlash2(ent, w, serverData.protocol),
|
|
15577
|
+
onTempEntity: (t, p, p2, d, c, clr, e, s, de) => blockWriter.writeTempEntity(t, p, p2, d, c, clr, e, s, de, serverData.protocol),
|
|
15578
|
+
onDisconnect: () => blockWriter.writeDisconnect(serverData.protocol),
|
|
15579
|
+
onReconnect: () => blockWriter.writeReconnect(serverData.protocol),
|
|
15246
15580
|
onDownload: () => {
|
|
15247
15581
|
},
|
|
15248
15582
|
// Stub for download
|
|
@@ -15924,10 +16258,14 @@ export {
|
|
|
15924
16258
|
removeViewTranslation,
|
|
15925
16259
|
resolveLightStyles,
|
|
15926
16260
|
serializeEntLump,
|
|
16261
|
+
spawnBfgExplosion,
|
|
16262
|
+
spawnBlasterImpact,
|
|
15927
16263
|
spawnBlood,
|
|
15928
16264
|
spawnBulletImpact,
|
|
15929
16265
|
spawnExplosion,
|
|
15930
16266
|
spawnMuzzleFlash,
|
|
16267
|
+
spawnRailTrail,
|
|
16268
|
+
spawnSparks,
|
|
15931
16269
|
spawnSplash,
|
|
15932
16270
|
spawnSteam,
|
|
15933
16271
|
spawnTeleportFlash,
|