quake2ts 0.0.196 → 0.0.197

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.
@@ -1606,6 +1606,7 @@ var Entity = class {
1606
1606
  this.timestamp = 0;
1607
1607
  this.lip = 0;
1608
1608
  this.state = 0;
1609
+ this.style = 0;
1609
1610
  this.sounds = 0;
1610
1611
  this.noise_index = 0;
1611
1612
  this.attenuation = 0;
@@ -1837,6 +1838,7 @@ var ENTITY_FIELD_METADATA = [
1837
1838
  { name: "timestamp", type: "float", save: true },
1838
1839
  { name: "lip", type: "int", save: true },
1839
1840
  { name: "state", type: "int", save: true },
1841
+ { name: "style", type: "int", save: true },
1840
1842
  { name: "sounds", type: "int", save: true },
1841
1843
  { name: "noise_index", type: "int", save: true },
1842
1844
  { name: "attenuation", type: "float", save: true },
@@ -3443,6 +3445,35 @@ function registerMiscSpawns(registry) {
3443
3445
  });
3444
3446
  }
3445
3447
 
3448
+ // src/imports.ts
3449
+ var MulticastType = /* @__PURE__ */ ((MulticastType2) => {
3450
+ MulticastType2[MulticastType2["All"] = 0] = "All";
3451
+ MulticastType2[MulticastType2["Pvs"] = 1] = "Pvs";
3452
+ MulticastType2[MulticastType2["Phs"] = 2] = "Phs";
3453
+ return MulticastType2;
3454
+ })(MulticastType || {});
3455
+
3456
+ // src/entities/utils.ts
3457
+ var VEC_UP = { x: 0, y: -1, z: 0 };
3458
+ var MOVEDIR_UP = { x: 0, y: 0, z: 1 };
3459
+ var VEC_DOWN = { x: 0, y: -2, z: 0 };
3460
+ var MOVEDIR_DOWN = { x: 0, y: 0, z: -1 };
3461
+ function vecEquals(a, b) {
3462
+ return a.x === b.x && a.y === b.y && a.z === b.z;
3463
+ }
3464
+ function isZeroVector(vector) {
3465
+ return vecEquals(vector, ZERO_VEC3);
3466
+ }
3467
+ function setMovedir(angles) {
3468
+ if (vecEquals(angles, VEC_UP)) {
3469
+ return { ...MOVEDIR_UP };
3470
+ }
3471
+ if (vecEquals(angles, VEC_DOWN)) {
3472
+ return { ...MOVEDIR_DOWN };
3473
+ }
3474
+ return { ...angleVectors(angles).forward };
3475
+ }
3476
+
3446
3477
  // src/entities/targets.ts
3447
3478
  var ATTN_NORM = 1;
3448
3479
  var SPEAKER_SPAWNFLAGS = {
@@ -3476,8 +3507,20 @@ function targetSpeakerUse(self, other, activator, context) {
3476
3507
  }
3477
3508
  }
3478
3509
  }
3510
+ function useTargetTempEntity(self, context) {
3511
+ const entities = context.entities;
3512
+ const type = self.style;
3513
+ entities.multicast(self.origin, 1 /* Pvs */, ServerCommand.temp_entity, type, self.origin);
3514
+ }
3515
+ function useTargetSplash(self, context) {
3516
+ const entities = context.entities;
3517
+ entities.multicast(self.origin, 1 /* Pvs */, ServerCommand.temp_entity, TempEntity.SPLASH, self.count, self.origin, self.movedir, self.sounds);
3518
+ }
3479
3519
  function registerTargetSpawns(registry) {
3480
- registry.register("target_temp_entity", () => {
3520
+ registry.register("target_temp_entity", (entity, context) => {
3521
+ entity.style = context.keyValues.style ? parseInt(context.keyValues.style) : 0;
3522
+ entity.use = (self) => useTargetTempEntity(self, context);
3523
+ entity.svflags |= 1 /* NoClient */;
3481
3524
  });
3482
3525
  registry.register("target_speaker", (entity, context) => {
3483
3526
  const noise = context.keyValues.noise;
@@ -3502,14 +3545,17 @@ function registerTargetSpawns(registry) {
3502
3545
  entity.use = (self, other, activator) => targetSpeakerUse(self, other, activator ?? null, context);
3503
3546
  entity.solid = 0 /* Not */;
3504
3547
  });
3505
- registry.register("target_explosion", (entity) => {
3506
- entity.use = () => {
3548
+ registry.register("target_explosion", (entity, { entities }) => {
3549
+ entity.use = (self) => {
3550
+ entities.multicast(self.origin, 2 /* Phs */, ServerCommand.temp_entity, TempEntity.EXPLOSION1, self.origin);
3507
3551
  };
3508
3552
  entity.svflags |= 1 /* NoClient */;
3509
3553
  });
3510
- registry.register("target_splash", (entity) => {
3511
- entity.use = () => {
3512
- };
3554
+ registry.register("target_splash", (entity, context) => {
3555
+ entity.count = context.keyValues.count ? parseInt(context.keyValues.count) : 0;
3556
+ entity.sounds = context.keyValues.sounds ? parseInt(context.keyValues.sounds) : 0;
3557
+ entity.movedir = setMovedir(entity.angles);
3558
+ entity.use = (self) => useTargetSplash(self, context);
3513
3559
  entity.svflags |= 1 /* NoClient */;
3514
3560
  });
3515
3561
  registry.register("target_secret", (entity, { entities }) => {
@@ -3539,27 +3585,6 @@ function registerTargetSpawns(registry) {
3539
3585
  });
3540
3586
  }
3541
3587
 
3542
- // src/entities/utils.ts
3543
- var VEC_UP = { x: 0, y: -1, z: 0 };
3544
- var MOVEDIR_UP = { x: 0, y: 0, z: 1 };
3545
- var VEC_DOWN = { x: 0, y: -2, z: 0 };
3546
- var MOVEDIR_DOWN = { x: 0, y: 0, z: -1 };
3547
- function vecEquals(a, b) {
3548
- return a.x === b.x && a.y === b.y && a.z === b.z;
3549
- }
3550
- function isZeroVector(vector) {
3551
- return vecEquals(vector, ZERO_VEC3);
3552
- }
3553
- function setMovedir(angles) {
3554
- if (vecEquals(angles, VEC_UP)) {
3555
- return { ...MOVEDIR_UP };
3556
- }
3557
- if (vecEquals(angles, VEC_DOWN)) {
3558
- return { ...MOVEDIR_DOWN };
3559
- }
3560
- return { ...angleVectors(angles).forward };
3561
- }
3562
-
3563
3588
  // src/entities/triggers.ts
3564
3589
  var FRAME_TIME_SECONDS = 1 / 40;
3565
3590
  var THINK_INTERVAL = 0.1;
@@ -4917,14 +4942,6 @@ function monster_think(self, context) {
4917
4942
  self.nextthink = context.timeSeconds + 0.1;
4918
4943
  }
4919
4944
 
4920
- // src/imports.ts
4921
- var MulticastType = /* @__PURE__ */ ((MulticastType2) => {
4922
- MulticastType2[MulticastType2["All"] = 0] = "All";
4923
- MulticastType2[MulticastType2["Pvs"] = 1] = "Pvs";
4924
- MulticastType2[MulticastType2["Phs"] = 2] = "Phs";
4925
- return MulticastType2;
4926
- })(MulticastType || {});
4927
-
4928
4945
  // src/combat/damage.ts
4929
4946
  var EntityDamageFlags = /* @__PURE__ */ ((EntityDamageFlags2) => {
4930
4947
  EntityDamageFlags2[EntityDamageFlags2["GODMODE"] = 1] = "GODMODE";