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.
@@ -1440,6 +1440,7 @@ var Entity = class {
1440
1440
  this.timestamp = 0;
1441
1441
  this.lip = 0;
1442
1442
  this.state = 0;
1443
+ this.style = 0;
1443
1444
  this.sounds = 0;
1444
1445
  this.noise_index = 0;
1445
1446
  this.attenuation = 0;
@@ -1671,6 +1672,7 @@ var ENTITY_FIELD_METADATA = [
1671
1672
  { name: "timestamp", type: "float", save: true },
1672
1673
  { name: "lip", type: "int", save: true },
1673
1674
  { name: "state", type: "int", save: true },
1675
+ { name: "style", type: "int", save: true },
1674
1676
  { name: "sounds", type: "int", save: true },
1675
1677
  { name: "noise_index", type: "int", save: true },
1676
1678
  { name: "attenuation", type: "float", save: true },
@@ -3277,6 +3279,35 @@ function registerMiscSpawns(registry) {
3277
3279
  });
3278
3280
  }
3279
3281
 
3282
+ // src/imports.ts
3283
+ var MulticastType = /* @__PURE__ */ ((MulticastType2) => {
3284
+ MulticastType2[MulticastType2["All"] = 0] = "All";
3285
+ MulticastType2[MulticastType2["Pvs"] = 1] = "Pvs";
3286
+ MulticastType2[MulticastType2["Phs"] = 2] = "Phs";
3287
+ return MulticastType2;
3288
+ })(MulticastType || {});
3289
+
3290
+ // src/entities/utils.ts
3291
+ var VEC_UP = { x: 0, y: -1, z: 0 };
3292
+ var MOVEDIR_UP = { x: 0, y: 0, z: 1 };
3293
+ var VEC_DOWN = { x: 0, y: -2, z: 0 };
3294
+ var MOVEDIR_DOWN = { x: 0, y: 0, z: -1 };
3295
+ function vecEquals(a, b) {
3296
+ return a.x === b.x && a.y === b.y && a.z === b.z;
3297
+ }
3298
+ function isZeroVector(vector) {
3299
+ return vecEquals(vector, ZERO_VEC3);
3300
+ }
3301
+ function setMovedir(angles) {
3302
+ if (vecEquals(angles, VEC_UP)) {
3303
+ return { ...MOVEDIR_UP };
3304
+ }
3305
+ if (vecEquals(angles, VEC_DOWN)) {
3306
+ return { ...MOVEDIR_DOWN };
3307
+ }
3308
+ return { ...angleVectors(angles).forward };
3309
+ }
3310
+
3280
3311
  // src/entities/targets.ts
3281
3312
  var ATTN_NORM = 1;
3282
3313
  var SPEAKER_SPAWNFLAGS = {
@@ -3310,8 +3341,20 @@ function targetSpeakerUse(self, other, activator, context) {
3310
3341
  }
3311
3342
  }
3312
3343
  }
3344
+ function useTargetTempEntity(self, context) {
3345
+ const entities = context.entities;
3346
+ const type = self.style;
3347
+ entities.multicast(self.origin, 1 /* Pvs */, ServerCommand.temp_entity, type, self.origin);
3348
+ }
3349
+ function useTargetSplash(self, context) {
3350
+ const entities = context.entities;
3351
+ entities.multicast(self.origin, 1 /* Pvs */, ServerCommand.temp_entity, TempEntity.SPLASH, self.count, self.origin, self.movedir, self.sounds);
3352
+ }
3313
3353
  function registerTargetSpawns(registry) {
3314
- registry.register("target_temp_entity", () => {
3354
+ registry.register("target_temp_entity", (entity, context) => {
3355
+ entity.style = context.keyValues.style ? parseInt(context.keyValues.style) : 0;
3356
+ entity.use = (self) => useTargetTempEntity(self, context);
3357
+ entity.svflags |= 1 /* NoClient */;
3315
3358
  });
3316
3359
  registry.register("target_speaker", (entity, context) => {
3317
3360
  const noise = context.keyValues.noise;
@@ -3336,14 +3379,17 @@ function registerTargetSpawns(registry) {
3336
3379
  entity.use = (self, other, activator) => targetSpeakerUse(self, other, activator ?? null, context);
3337
3380
  entity.solid = 0 /* Not */;
3338
3381
  });
3339
- registry.register("target_explosion", (entity) => {
3340
- entity.use = () => {
3382
+ registry.register("target_explosion", (entity, { entities }) => {
3383
+ entity.use = (self) => {
3384
+ entities.multicast(self.origin, 2 /* Phs */, ServerCommand.temp_entity, TempEntity.EXPLOSION1, self.origin);
3341
3385
  };
3342
3386
  entity.svflags |= 1 /* NoClient */;
3343
3387
  });
3344
- registry.register("target_splash", (entity) => {
3345
- entity.use = () => {
3346
- };
3388
+ registry.register("target_splash", (entity, context) => {
3389
+ entity.count = context.keyValues.count ? parseInt(context.keyValues.count) : 0;
3390
+ entity.sounds = context.keyValues.sounds ? parseInt(context.keyValues.sounds) : 0;
3391
+ entity.movedir = setMovedir(entity.angles);
3392
+ entity.use = (self) => useTargetSplash(self, context);
3347
3393
  entity.svflags |= 1 /* NoClient */;
3348
3394
  });
3349
3395
  registry.register("target_secret", (entity, { entities }) => {
@@ -3373,27 +3419,6 @@ function registerTargetSpawns(registry) {
3373
3419
  });
3374
3420
  }
3375
3421
 
3376
- // src/entities/utils.ts
3377
- var VEC_UP = { x: 0, y: -1, z: 0 };
3378
- var MOVEDIR_UP = { x: 0, y: 0, z: 1 };
3379
- var VEC_DOWN = { x: 0, y: -2, z: 0 };
3380
- var MOVEDIR_DOWN = { x: 0, y: 0, z: -1 };
3381
- function vecEquals(a, b) {
3382
- return a.x === b.x && a.y === b.y && a.z === b.z;
3383
- }
3384
- function isZeroVector(vector) {
3385
- return vecEquals(vector, ZERO_VEC3);
3386
- }
3387
- function setMovedir(angles) {
3388
- if (vecEquals(angles, VEC_UP)) {
3389
- return { ...MOVEDIR_UP };
3390
- }
3391
- if (vecEquals(angles, VEC_DOWN)) {
3392
- return { ...MOVEDIR_DOWN };
3393
- }
3394
- return { ...angleVectors(angles).forward };
3395
- }
3396
-
3397
3422
  // src/entities/triggers.ts
3398
3423
  var FRAME_TIME_SECONDS = 1 / 40;
3399
3424
  var THINK_INTERVAL = 0.1;
@@ -4751,14 +4776,6 @@ function monster_think(self, context) {
4751
4776
  self.nextthink = context.timeSeconds + 0.1;
4752
4777
  }
4753
4778
 
4754
- // src/imports.ts
4755
- var MulticastType = /* @__PURE__ */ ((MulticastType2) => {
4756
- MulticastType2[MulticastType2["All"] = 0] = "All";
4757
- MulticastType2[MulticastType2["Pvs"] = 1] = "Pvs";
4758
- MulticastType2[MulticastType2["Phs"] = 2] = "Phs";
4759
- return MulticastType2;
4760
- })(MulticastType || {});
4761
-
4762
4779
  // src/combat/damage.ts
4763
4780
  var EntityDamageFlags = /* @__PURE__ */ ((EntityDamageFlags2) => {
4764
4781
  EntityDamageFlags2[EntityDamageFlags2["GODMODE"] = 1] = "GODMODE";