quake2ts 0.0.263 → 0.0.266

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 (43) hide show
  1. package/package.json +1 -1
  2. package/packages/client/dist/browser/index.global.js +13 -13
  3. package/packages/client/dist/browser/index.global.js.map +1 -1
  4. package/packages/client/dist/cjs/index.cjs +25 -12
  5. package/packages/client/dist/cjs/index.cjs.map +1 -1
  6. package/packages/client/dist/esm/index.js +25 -12
  7. package/packages/client/dist/esm/index.js.map +1 -1
  8. package/packages/client/dist/tsconfig.tsbuildinfo +1 -1
  9. package/packages/engine/dist/browser/index.global.js +6 -6
  10. package/packages/engine/dist/browser/index.global.js.map +1 -1
  11. package/packages/engine/dist/cjs/index.cjs +25 -12
  12. package/packages/engine/dist/cjs/index.cjs.map +1 -1
  13. package/packages/engine/dist/esm/index.js +25 -12
  14. package/packages/engine/dist/esm/index.js.map +1 -1
  15. package/packages/engine/dist/tsconfig.tsbuildinfo +1 -1
  16. package/packages/engine/dist/types/demo/parser.d.ts +2 -0
  17. package/packages/engine/dist/types/demo/parser.d.ts.map +1 -1
  18. package/packages/engine/dist/types/demo/playback.d.ts +1 -0
  19. package/packages/engine/dist/types/demo/playback.d.ts.map +1 -1
  20. package/packages/game/dist/browser/index.global.js +3 -2
  21. package/packages/game/dist/browser/index.global.js.map +1 -1
  22. package/packages/game/dist/cjs/index.cjs +984 -284
  23. package/packages/game/dist/cjs/index.cjs.map +1 -1
  24. package/packages/game/dist/esm/index.js +986 -286
  25. package/packages/game/dist/esm/index.js.map +1 -1
  26. package/packages/game/dist/tsconfig.tsbuildinfo +1 -1
  27. package/packages/game/dist/types/combat/weapons/animation.d.ts +9 -0
  28. package/packages/game/dist/types/combat/weapons/animation.d.ts.map +1 -1
  29. package/packages/game/dist/types/combat/weapons/firing.d.ts.map +1 -1
  30. package/packages/game/dist/types/combat/weapons/switching.d.ts +1 -0
  31. package/packages/game/dist/types/combat/weapons/switching.d.ts.map +1 -1
  32. package/packages/game/dist/types/entities/entity.d.ts +2 -1
  33. package/packages/game/dist/types/entities/entity.d.ts.map +1 -1
  34. package/packages/game/dist/types/entities/monsters/actor.d.ts +6 -0
  35. package/packages/game/dist/types/entities/monsters/actor.d.ts.map +1 -0
  36. package/packages/game/dist/types/entities/monsters/index.d.ts.map +1 -1
  37. package/packages/game/dist/types/entities/monsters/jorg.d.ts.map +1 -1
  38. package/packages/game/dist/types/entities/monsters/makron.d.ts.map +1 -1
  39. package/packages/game/dist/types/entities/player.d.ts +2 -0
  40. package/packages/game/dist/types/entities/player.d.ts.map +1 -1
  41. package/packages/game/dist/types/entities/player_anim.d.ts +50 -0
  42. package/packages/game/dist/types/entities/player_anim.d.ts.map +1 -0
  43. package/packages/game/dist/types/index.d.ts.map +1 -1
@@ -294,15 +294,15 @@ function rotatePointAroundVector(dir, point, degrees) {
294
294
  const vf = normalizeVec3(dir);
295
295
  const vr = perpendicularVec3(vf);
296
296
  const vup = crossVec3(vr, vf);
297
- const m2 = [
297
+ const m3 = [
298
298
  [vr.x, vup.x, vf.x],
299
299
  [vr.y, vup.y, vf.y],
300
300
  [vr.z, vup.z, vf.z]
301
301
  ];
302
302
  const im = [
303
- [m2[0][0], m2[1][0], m2[2][0]],
304
- [m2[0][1], m2[1][1], m2[2][1]],
305
- [m2[0][2], m2[1][2], m2[2][2]]
303
+ [m3[0][0], m3[1][0], m3[2][0]],
304
+ [m3[0][1], m3[1][1], m3[2][1]],
305
+ [m3[0][2], m3[1][2], m3[2][2]]
306
306
  ];
307
307
  const radians = degrees * DEG_TO_RAD;
308
308
  const cos = Math.cos(radians);
@@ -312,7 +312,7 @@ function rotatePointAroundVector(dir, point, degrees) {
312
312
  [-sin, cos, 0],
313
313
  [0, 0, 1]
314
314
  ];
315
- const rot = concatRotationMatrices(concatRotationMatrices(m2, zrot), im);
315
+ const rot = concatRotationMatrices(concatRotationMatrices(m3, zrot), im);
316
316
  return {
317
317
  x: rot[0][0] * point.x + rot[0][1] * point.y + rot[0][2] * point.z,
318
318
  y: rot[1][0] * point.x + rot[1][1] * point.y + rot[1][2] * point.z,
@@ -10101,11 +10101,11 @@ function registerInfantrySpawns(registry) {
10101
10101
  registry.register("monster_infantry", SP_monster_infantry);
10102
10102
  }
10103
10103
 
10104
- // src/entities/monsters/jorg.ts
10104
+ // src/entities/monsters/makron.ts
10105
10105
  var MONSTER_TICK13 = 0.1;
10106
- var JORG_MACHINEGUN_R1_OFFSET = { x: 40, y: -20, z: 20 };
10107
- var JORG_MACHINEGUN_L1_OFFSET = { x: 40, y: 20, z: 20 };
10108
- var JORG_BFG_OFFSET = { x: 30, y: 0, z: 40 };
10106
+ var MAKRON_BFG_OFFSET = { x: 30, y: 28, z: 24 };
10107
+ var MAKRON_BLASTER_OFFSET_1 = { x: 26, y: 16, z: 24 };
10108
+ var MAKRON_RAILGUN_OFFSET = { x: 26, y: -14, z: 24 };
10109
10109
  function monster_ai_stand13(self, dist, context) {
10110
10110
  ai_stand(self, MONSTER_TICK13, context);
10111
10111
  }
@@ -10124,24 +10124,269 @@ function monster_ai_move13(self, dist, context) {
10124
10124
  var stand_move12;
10125
10125
  var walk_move11;
10126
10126
  var run_move11;
10127
+ var attack_bfg_move;
10128
+ var attack_hyperblaster_move;
10129
+ var attack_railgun_move;
10130
+ var pain4_move;
10131
+ var pain5_move;
10132
+ var pain6_move;
10133
+ var death_move10;
10134
+ var sight_move;
10135
+ function makron_stand(self) {
10136
+ self.monsterinfo.current_move = stand_move12;
10137
+ }
10138
+ function makron_walk(self) {
10139
+ self.monsterinfo.current_move = walk_move11;
10140
+ }
10141
+ function makron_run(self) {
10142
+ if (self.enemy && self.enemy.health > 0) {
10143
+ self.monsterinfo.current_move = run_move11;
10144
+ } else {
10145
+ self.monsterinfo.current_move = stand_move12;
10146
+ }
10147
+ }
10148
+ function makron_attack(self) {
10149
+ if (!self.enemy) return;
10150
+ const r = Math.random();
10151
+ if (r <= 0.3) {
10152
+ self.monsterinfo.current_move = attack_bfg_move;
10153
+ } else if (r <= 0.6) {
10154
+ self.monsterinfo.current_move = attack_hyperblaster_move;
10155
+ } else {
10156
+ self.monsterinfo.current_move = attack_railgun_move;
10157
+ }
10158
+ }
10159
+ function getProjectedOffset2(self, offset) {
10160
+ const { forward, right, up } = angleVectors(self.angles);
10161
+ const start = { ...self.origin };
10162
+ const x = scaleVec3(forward, offset.x);
10163
+ const y = scaleVec3(right, offset.y);
10164
+ const z = scaleVec3(up, offset.z);
10165
+ return addVec3(addVec3(addVec3(start, x), y), z);
10166
+ }
10167
+ function makron_fire_bfg(self, context) {
10168
+ if (!self.enemy) return;
10169
+ context.engine.sound?.(self, 0, "makron/bfg_fire.wav", 1, 1, 0);
10170
+ const start = getProjectedOffset2(self, MAKRON_BFG_OFFSET);
10171
+ const target = { ...self.enemy.origin };
10172
+ target.z += self.enemy.viewheight || 0;
10173
+ const dir = normalizeVec3(subtractVec3(target, start));
10174
+ monster_fire_bfg(self, start, dir, 50, 300, 100, 300, 0, context);
10175
+ }
10176
+ function makron_fire_railgun(self, context) {
10177
+ if (!self.pos1) return;
10178
+ context.engine.sound?.(self, 0, "makron/rail_fire.wav", 1, 1, 0);
10179
+ const start = getProjectedOffset2(self, MAKRON_RAILGUN_OFFSET);
10180
+ const dir = normalizeVec3(subtractVec3(self.pos1, start));
10181
+ monster_fire_railgun(self, start, dir, 50, 100, 0, context);
10182
+ }
10183
+ function makron_save_loc(self) {
10184
+ if (!self.enemy) return;
10185
+ self.pos1 = { ...self.enemy.origin };
10186
+ self.pos1 = { ...self.pos1, z: self.pos1.z + (self.enemy.viewheight || 0) };
10187
+ }
10188
+ function makron_fire_hyperblaster(self, context) {
10189
+ context.engine.sound?.(self, 0, "makron/blaster.wav", 1, 1, 0);
10190
+ const start = getProjectedOffset2(self, MAKRON_BLASTER_OFFSET_1);
10191
+ const relFrame = (self.monsterinfo.nextframe || 0) - attack_hyperblaster_move.firstframe;
10192
+ let yawDelta = 0;
10193
+ let dir;
10194
+ if (self.enemy) {
10195
+ const target = { ...self.enemy.origin };
10196
+ target.z += self.enemy.viewheight || 0;
10197
+ const vec = subtractVec3(target, start);
10198
+ const baseAngles = vectorToAngles(vec);
10199
+ const enemyAngles = { ...baseAngles };
10200
+ if (relFrame <= 12) {
10201
+ enemyAngles.y -= 5 * (relFrame - 4);
10202
+ } else {
10203
+ enemyAngles.y -= 40 - 5 * (relFrame - 12);
10204
+ }
10205
+ const forward = angleVectors(enemyAngles).forward;
10206
+ dir = forward;
10207
+ } else {
10208
+ const { forward } = angleVectors(self.angles);
10209
+ dir = forward;
10210
+ }
10211
+ monster_fire_blaster(self, start, dir, 15, 1e3, 0, 0, context, 1 /* BLASTER */);
10212
+ }
10213
+ function makron_pain(self, other, kick, damage, context) {
10214
+ if (self.health < self.max_health / 2) {
10215
+ self.skin = 1;
10216
+ }
10217
+ if (self.timestamp < (self.pain_finished_time || 0)) return;
10218
+ if (damage <= 25 && Math.random() < 0.2) return;
10219
+ self.pain_finished_time = self.timestamp + 3;
10220
+ if (damage <= 40) {
10221
+ context.engine.sound?.(self, 0, "makron/pain1.wav", 1, 1, 0);
10222
+ self.monsterinfo.current_move = pain4_move;
10223
+ } else if (damage <= 110) {
10224
+ context.engine.sound?.(self, 0, "makron/pain2.wav", 1, 1, 0);
10225
+ self.monsterinfo.current_move = pain5_move;
10226
+ } else {
10227
+ if (Math.random() <= 0.45) {
10228
+ context.engine.sound?.(self, 0, "makron/pain3.wav", 1, 1, 0);
10229
+ self.monsterinfo.current_move = pain6_move;
10230
+ }
10231
+ }
10232
+ }
10233
+ function makron_torso_think(self, context) {
10234
+ if (++self.frame >= 365)
10235
+ self.frame = 346;
10236
+ self.nextthink = context.timeSeconds + 0.1;
10237
+ if (self.angles.x > 0)
10238
+ self.angles = { ...self.angles, x: Math.max(0, self.angles.x - 15) };
10239
+ }
10240
+ function makron_torso(ent, context) {
10241
+ ent.frame = 346;
10242
+ ent.model = "models/monsters/boss3/rider/tris.md2";
10243
+ ent.skin = 1;
10244
+ ent.think = makron_torso_think;
10245
+ ent.nextthink = context.timeSeconds + 0.1;
10246
+ context.sound(ent, 0, "makron/spine.wav", 1, 1, 0);
10247
+ ent.movetype = 7 /* Toss */;
10248
+ const { forward, up } = angleVectors(ent.angles);
10249
+ const vUp = scaleVec3(up, 120);
10250
+ const vFwd = scaleVec3(forward, -120);
10251
+ ent.velocity = addVec3(addVec3(ent.velocity, vUp), vFwd);
10252
+ ent.origin = addVec3(ent.origin, scaleVec3(forward, -10));
10253
+ ent.angles = { ...ent.angles, x: 90 };
10254
+ ent.avelocity = ZERO_VEC3;
10255
+ context.linkentity(ent);
10256
+ }
10257
+ function makron_spawn_torso(self, context) {
10258
+ const tempent = context.spawn();
10259
+ tempent.classname = "makron_torso";
10260
+ tempent.origin = { ...self.origin };
10261
+ tempent.angles = { ...self.angles };
10262
+ tempent.origin.z += self.maxs.z - 15;
10263
+ makron_torso(tempent, context);
10264
+ }
10265
+ function makron_die(self, context) {
10266
+ context.engine.sound?.(self, 0, "makron/death.wav", 1, 1, 0);
10267
+ makron_spawn_torso(self, context);
10268
+ self.monsterinfo.current_move = death_move10;
10269
+ self.mins = { x: -60, y: -60, z: 0 };
10270
+ self.maxs = { x: 60, y: 60, z: 48 };
10271
+ }
10272
+ function makron_dead(self) {
10273
+ self.monsterinfo.nextframe = death_move10.lastframe;
10274
+ self.nextthink = -1;
10275
+ }
10276
+ var stand_frames12 = Array.from({ length: 60 }, () => ({ ai: monster_ai_stand13, dist: 0 }));
10277
+ stand_move12 = { firstframe: 0, lastframe: 59, frames: stand_frames12, endfunc: makron_stand };
10278
+ var walk_frames11 = Array.from({ length: 10 }, () => ({ ai: monster_ai_walk13, dist: 8 }));
10279
+ walk_move11 = { firstframe: 60, lastframe: 69, frames: walk_frames11, endfunc: makron_walk };
10280
+ var run_frames10 = Array.from({ length: 10 }, () => ({ ai: monster_ai_run12, dist: 8 }));
10281
+ run_move11 = { firstframe: 60, lastframe: 69, frames: run_frames10, endfunc: makron_run };
10282
+ var attack_bfg_frames = Array.from({ length: 8 }, (_, i) => ({
10283
+ ai: monster_ai_charge13,
10284
+ dist: 0,
10285
+ think: i === 3 ? makron_fire_bfg : null
10286
+ }));
10287
+ attack_bfg_move = { firstframe: 70, lastframe: 77, frames: attack_bfg_frames, endfunc: makron_run };
10288
+ var attack_hyperblaster_frames = Array.from({ length: 26 }, (_, i) => ({
10289
+ ai: monster_ai_move13,
10290
+ dist: 0,
10291
+ think: i >= 4 && i <= 20 ? makron_fire_hyperblaster : null
10292
+ }));
10293
+ attack_hyperblaster_move = { firstframe: 78, lastframe: 103, frames: attack_hyperblaster_frames, endfunc: makron_run };
10294
+ var attack_railgun_frames = Array.from({ length: 16 }, (_, i) => ({
10295
+ ai: monster_ai_charge13,
10296
+ dist: 0,
10297
+ think: i === 7 ? makron_save_loc : i === 8 ? makron_fire_railgun : null
10298
+ }));
10299
+ attack_railgun_move = { firstframe: 104, lastframe: 119, frames: attack_railgun_frames, endfunc: makron_run };
10300
+ var pain4_frames = Array.from({ length: 4 }, () => ({ ai: monster_ai_move13, dist: 0 }));
10301
+ pain4_move = { firstframe: 120, lastframe: 123, frames: pain4_frames, endfunc: makron_run };
10302
+ var pain5_frames = Array.from({ length: 4 }, () => ({ ai: monster_ai_move13, dist: 0 }));
10303
+ pain5_move = { firstframe: 124, lastframe: 127, frames: pain5_frames, endfunc: makron_run };
10304
+ var pain6_frames = Array.from({ length: 27 }, () => ({ ai: monster_ai_move13, dist: 0 }));
10305
+ pain6_move = { firstframe: 128, lastframe: 154, frames: pain6_frames, endfunc: makron_run };
10306
+ var death_frames10 = Array.from({ length: 95 }, () => ({ ai: monster_ai_move13, dist: 0 }));
10307
+ death_move10 = { firstframe: 155, lastframe: 249, frames: death_frames10, endfunc: makron_dead };
10308
+ var sight_frames = Array.from({ length: 13 }, () => ({ ai: monster_ai_move13, dist: 0 }));
10309
+ sight_move = { firstframe: 250, lastframe: 262, frames: sight_frames, endfunc: makron_run };
10310
+ function SP_monster_makron(self, context) {
10311
+ self.classname = "monster_makron";
10312
+ self.model = "models/monsters/boss3/rider/tris.md2";
10313
+ self.mins = { x: -30, y: -30, z: 0 };
10314
+ self.maxs = { x: 30, y: 30, z: 90 };
10315
+ self.movetype = 5 /* Step */;
10316
+ self.solid = 2 /* BoundingBox */;
10317
+ self.health = 3e3;
10318
+ self.max_health = 3e3;
10319
+ self.mass = 500;
10320
+ self.takedamage = true;
10321
+ self.viewheight = 90;
10322
+ self.pain = (ent, other, kick, dmg) => makron_pain(ent, other, kick, dmg, context.entities);
10323
+ self.die = (self2, inflictor, attacker, damage, point) => {
10324
+ if (self2.health <= -2e3) {
10325
+ throwGibs(context.entities, self2.origin, damage);
10326
+ context.entities.free(self2);
10327
+ return;
10328
+ }
10329
+ self2.deadflag = 2 /* Dead */;
10330
+ self2.solid = 0 /* Not */;
10331
+ makron_die(self2, context.entities);
10332
+ };
10333
+ self.monsterinfo.stand = makron_stand;
10334
+ self.monsterinfo.walk = makron_walk;
10335
+ self.monsterinfo.run = makron_run;
10336
+ self.monsterinfo.attack = makron_attack;
10337
+ self.monsterinfo.sight = (self2, other) => {
10338
+ context.entities.sound?.(self2, 0, "makron/sight.wav", 1, 1, 0);
10339
+ self2.monsterinfo.current_move = sight_move;
10340
+ };
10341
+ self.think = monster_think;
10342
+ self.monsterinfo.current_move = sight_move;
10343
+ self.nextthink = self.timestamp + MONSTER_TICK13;
10344
+ }
10345
+ function registerMakronSpawns(registry) {
10346
+ registry.register("monster_makron", SP_monster_makron);
10347
+ }
10348
+
10349
+ // src/entities/monsters/jorg.ts
10350
+ var MONSTER_TICK14 = 0.1;
10351
+ var JORG_MACHINEGUN_R1_OFFSET = { x: 40, y: -20, z: 20 };
10352
+ var JORG_MACHINEGUN_L1_OFFSET = { x: 40, y: 20, z: 20 };
10353
+ var JORG_BFG_OFFSET = { x: 30, y: 0, z: 40 };
10354
+ function monster_ai_stand14(self, dist, context) {
10355
+ ai_stand(self, MONSTER_TICK14, context);
10356
+ }
10357
+ function monster_ai_walk14(self, dist, context) {
10358
+ ai_walk(self, dist, MONSTER_TICK14, context);
10359
+ }
10360
+ function monster_ai_run13(self, dist, context) {
10361
+ ai_run(self, dist, MONSTER_TICK14, context);
10362
+ }
10363
+ function monster_ai_charge14(self, dist, context) {
10364
+ ai_charge(self, dist, MONSTER_TICK14, context);
10365
+ }
10366
+ function monster_ai_move14(self, dist, context) {
10367
+ ai_move(self, dist);
10368
+ }
10369
+ var stand_move13;
10370
+ var walk_move12;
10371
+ var run_move12;
10127
10372
  var attack1_move3;
10128
10373
  var attack1_end_move;
10129
10374
  var attack2_move2;
10130
10375
  var pain1_move5;
10131
10376
  var pain2_move5;
10132
10377
  var pain3_move4;
10133
- var death_move10;
10378
+ var death_move11;
10134
10379
  function jorg_stand(self) {
10135
- self.monsterinfo.current_move = stand_move12;
10380
+ self.monsterinfo.current_move = stand_move13;
10136
10381
  }
10137
10382
  function jorg_walk(self) {
10138
- self.monsterinfo.current_move = walk_move11;
10383
+ self.monsterinfo.current_move = walk_move12;
10139
10384
  }
10140
10385
  function jorg_run(self) {
10141
10386
  if (self.enemy && self.enemy.health > 0) {
10142
- self.monsterinfo.current_move = run_move11;
10387
+ self.monsterinfo.current_move = run_move12;
10143
10388
  } else {
10144
- self.monsterinfo.current_move = stand_move12;
10389
+ self.monsterinfo.current_move = stand_move13;
10145
10390
  }
10146
10391
  }
10147
10392
  function jorg_attack(self, context) {
@@ -10169,7 +10414,7 @@ function jorg_reattack1(self, context) {
10169
10414
  self.monsterinfo.current_move = attack1_end_move;
10170
10415
  }
10171
10416
  }
10172
- function getProjectedOffset2(self, offset) {
10417
+ function getProjectedOffset3(self, offset) {
10173
10418
  const { forward, right, up } = angleVectors(self.angles);
10174
10419
  const start = { ...self.origin };
10175
10420
  const x = scaleVec3(forward, offset.x);
@@ -10179,16 +10424,16 @@ function getProjectedOffset2(self, offset) {
10179
10424
  }
10180
10425
  function jorg_fire_bullet(self, context) {
10181
10426
  if (!self.enemy) return;
10182
- const startL = getProjectedOffset2(self, JORG_MACHINEGUN_L1_OFFSET);
10427
+ const startL = getProjectedOffset3(self, JORG_MACHINEGUN_L1_OFFSET);
10183
10428
  const dirL = normalizeVec3(subtractVec3(self.enemy.origin, startL));
10184
10429
  monster_fire_bullet_v2(self, startL, dirL, 6, 4, 0.05, 0.05, 0, context, 4 /* MACHINEGUN */);
10185
- const startR = getProjectedOffset2(self, JORG_MACHINEGUN_R1_OFFSET);
10430
+ const startR = getProjectedOffset3(self, JORG_MACHINEGUN_R1_OFFSET);
10186
10431
  const dirR = normalizeVec3(subtractVec3(self.enemy.origin, startR));
10187
10432
  monster_fire_bullet_v2(self, startR, dirR, 6, 4, 0.05, 0.05, 0, context, 4 /* MACHINEGUN */);
10188
10433
  }
10189
10434
  function jorg_fire_bfg(self, context) {
10190
10435
  if (!self.enemy) return;
10191
- const start = getProjectedOffset2(self, JORG_BFG_OFFSET);
10436
+ const start = getProjectedOffset3(self, JORG_BFG_OFFSET);
10192
10437
  const target = { ...self.enemy.origin };
10193
10438
  target.z += self.enemy.viewheight || 0;
10194
10439
  const dir = normalizeVec3(subtractVec3(target, start));
@@ -10219,52 +10464,66 @@ function jorg_pain(self, other, kick, damage, context) {
10219
10464
  }
10220
10465
  function jorg_die(self, context) {
10221
10466
  context.engine.sound?.(self, 0, "boss3/bs3deth1.wav", 1, 1, 0);
10222
- self.monsterinfo.current_move = death_move10;
10467
+ self.monsterinfo.current_move = death_move11;
10223
10468
  }
10224
10469
  function jorg_dead(self) {
10225
- self.monsterinfo.nextframe = death_move10.lastframe;
10470
+ self.monsterinfo.nextframe = death_move11.lastframe;
10226
10471
  self.nextthink = -1;
10227
10472
  }
10228
10473
  function makron_toss(self, context) {
10229
10474
  const makron = context.spawn();
10230
10475
  makron.classname = "monster_makron";
10231
10476
  makron.origin = { ...self.origin };
10232
- makron.angles = { ...self.angles };
10233
- }
10234
- var stand_frames12 = Array.from({ length: 51 }, () => ({ ai: monster_ai_stand13, dist: 0 }));
10235
- stand_move12 = { firstframe: 0, lastframe: 50, frames: stand_frames12, endfunc: jorg_stand };
10236
- var walk_frames11 = Array.from({ length: 14 }, () => ({ ai: monster_ai_walk13, dist: 10 }));
10237
- walk_move11 = { firstframe: 51, lastframe: 64, frames: walk_frames11, endfunc: jorg_walk };
10238
- var run_frames10 = Array.from({ length: 14 }, () => ({ ai: monster_ai_run12, dist: 10 }));
10239
- run_move11 = { firstframe: 51, lastframe: 64, frames: run_frames10, endfunc: jorg_run };
10240
- var attack1_start_frames = Array.from({ length: 8 }, () => ({ ai: monster_ai_charge13, dist: 0 }));
10477
+ makron.target = self.target;
10478
+ makron.enemy = self.enemy;
10479
+ const spawnContext = { entities: context };
10480
+ SP_monster_makron(makron, spawnContext);
10481
+ if (makron.enemy && makron.enemy.health > 0) {
10482
+ const vec = subtractVec3(makron.enemy.origin, makron.origin);
10483
+ makron.angles = { ...makron.angles, y: vectorToYaw(vec) };
10484
+ const dir = normalizeVec3(vec);
10485
+ const vel = scaleVec3(dir, 400);
10486
+ makron.velocity = { x: vel.x, y: vel.y, z: 200 };
10487
+ makron.groundentity = null;
10488
+ if (makron.monsterinfo.sight) {
10489
+ makron.monsterinfo.sight(makron, makron.enemy);
10490
+ }
10491
+ }
10492
+ }
10493
+ var stand_frames13 = Array.from({ length: 51 }, () => ({ ai: monster_ai_stand14, dist: 0 }));
10494
+ stand_move13 = { firstframe: 0, lastframe: 50, frames: stand_frames13, endfunc: jorg_stand };
10495
+ var walk_frames12 = Array.from({ length: 14 }, () => ({ ai: monster_ai_walk14, dist: 10 }));
10496
+ walk_move12 = { firstframe: 51, lastframe: 64, frames: walk_frames12, endfunc: jorg_walk };
10497
+ var run_frames11 = Array.from({ length: 14 }, () => ({ ai: monster_ai_run13, dist: 10 }));
10498
+ run_move12 = { firstframe: 51, lastframe: 64, frames: run_frames11, endfunc: jorg_run };
10499
+ var attack1_start_frames = Array.from({ length: 8 }, () => ({ ai: monster_ai_charge14, dist: 0 }));
10241
10500
  var attack1_start_move = { firstframe: 65, lastframe: 72, frames: attack1_start_frames, endfunc: null };
10242
- var attack1_frames3 = Array.from({ length: 6 }, () => ({ ai: monster_ai_charge13, dist: 0, think: jorg_fire_bullet }));
10501
+ var attack1_frames3 = Array.from({ length: 6 }, () => ({ ai: monster_ai_charge14, dist: 0, think: jorg_fire_bullet }));
10243
10502
  attack1_move3 = { firstframe: 73, lastframe: 78, frames: attack1_frames3, endfunc: jorg_reattack1 };
10244
10503
  attack1_start_move.endfunc = (self) => {
10245
10504
  self.monsterinfo.current_move = attack1_move3;
10246
10505
  };
10247
- var attack1_end_frames = Array.from({ length: 4 }, () => ({ ai: monster_ai_move13, dist: 0 }));
10506
+ var attack1_end_frames = Array.from({ length: 4 }, () => ({ ai: monster_ai_move14, dist: 0 }));
10248
10507
  attack1_end_move = { firstframe: 79, lastframe: 82, frames: attack1_end_frames, endfunc: jorg_run };
10249
10508
  var attack2_frames2 = Array.from({ length: 13 }, (_, i) => ({
10250
- ai: monster_ai_charge13,
10509
+ ai: monster_ai_charge14,
10251
10510
  dist: 0,
10252
10511
  think: i === 6 ? jorg_fire_bfg : null
10253
10512
  }));
10254
10513
  attack2_move2 = { firstframe: 83, lastframe: 95, frames: attack2_frames2, endfunc: jorg_run };
10255
- var pain1_frames5 = Array.from({ length: 3 }, () => ({ ai: monster_ai_move13, dist: 0 }));
10514
+ var pain1_frames5 = Array.from({ length: 3 }, () => ({ ai: monster_ai_move14, dist: 0 }));
10256
10515
  pain1_move5 = { firstframe: 96, lastframe: 98, frames: pain1_frames5, endfunc: jorg_run };
10257
- var pain2_frames5 = Array.from({ length: 3 }, () => ({ ai: monster_ai_move13, dist: 0 }));
10516
+ var pain2_frames5 = Array.from({ length: 3 }, () => ({ ai: monster_ai_move14, dist: 0 }));
10258
10517
  pain2_move5 = { firstframe: 99, lastframe: 101, frames: pain2_frames5, endfunc: jorg_run };
10259
- var pain3_frames4 = Array.from({ length: 25 }, () => ({ ai: monster_ai_move13, dist: 0 }));
10518
+ var pain3_frames4 = Array.from({ length: 25 }, () => ({ ai: monster_ai_move14, dist: 0 }));
10260
10519
  pain3_move4 = { firstframe: 102, lastframe: 126, frames: pain3_frames4, endfunc: jorg_run };
10261
- var death_frames10 = Array.from({ length: 50 }, (_, i) => ({
10262
- ai: monster_ai_move13,
10520
+ var death_frames11 = Array.from({ length: 50 }, (_, i) => ({
10521
+ ai: monster_ai_move14,
10263
10522
  dist: 0,
10264
10523
  think: i === 49 ? ((self, ctx) => {
10265
10524
  }) : i === 48 ? makron_toss : null
10266
10525
  }));
10267
- death_move10 = { firstframe: 127, lastframe: 176, frames: death_frames10, endfunc: jorg_dead };
10526
+ death_move11 = { firstframe: 127, lastframe: 176, frames: death_frames11, endfunc: jorg_dead };
10268
10527
  function SP_monster_jorg(self, context) {
10269
10528
  self.classname = "monster_jorg";
10270
10529
  self.model = "models/monsters/boss3/jorg/tris.md2";
@@ -10297,14 +10556,14 @@ function SP_monster_jorg(self, context) {
10297
10556
  };
10298
10557
  self.think = monster_think;
10299
10558
  jorg_stand(self);
10300
- self.nextthink = self.timestamp + MONSTER_TICK13;
10559
+ self.nextthink = self.timestamp + MONSTER_TICK14;
10301
10560
  }
10302
10561
  function registerJorgSpawns(registry) {
10303
10562
  registry.register("monster_jorg", SP_monster_jorg);
10304
10563
  }
10305
10564
 
10306
10565
  // src/entities/monsters/insane.ts
10307
- var MONSTER_TICK14 = 0.1;
10566
+ var MONSTER_TICK15 = 0.1;
10308
10567
  var SPAWNFLAG_INSANE_CRAWL = 4;
10309
10568
  var SPAWNFLAG_INSANE_CRUCIFIED = 8;
10310
10569
  var SPAWNFLAG_INSANE_STAND_GROUND = 16;
@@ -10474,7 +10733,7 @@ function insane_dead(self, context) {
10474
10733
  function m(ai, dist = 0, think) {
10475
10734
  return { ai: (s, d, c) => {
10476
10735
  if (think) think(s, c);
10477
- ai(s, dist, MONSTER_TICK14, c);
10736
+ ai(s, dist, MONSTER_TICK15, c);
10478
10737
  }, dist };
10479
10738
  }
10480
10739
  var frames_stand_normal = [
@@ -10713,7 +10972,7 @@ insane_move_run_normal = {
10713
10972
  frames: frames_walk_normal.map((f) => ({
10714
10973
  ai: (s, d, c) => {
10715
10974
  if (f.ai === frames_walk_normal[0].ai) insane_scream(s, c);
10716
- ai_run(s, d, MONSTER_TICK14, c);
10975
+ ai_run(s, d, MONSTER_TICK15, c);
10717
10976
  },
10718
10977
  dist: f.dist
10719
10978
  })),
@@ -10759,7 +11018,7 @@ insane_move_run_insane = {
10759
11018
  frames: frames_walk_insane.map((f) => ({
10760
11019
  ai: (s, d, c) => {
10761
11020
  if (f.ai === frames_walk_insane[0].ai) insane_scream(s, c);
10762
- ai_run(s, d, MONSTER_TICK14, c);
11021
+ ai_run(s, d, MONSTER_TICK15, c);
10763
11022
  },
10764
11023
  dist: f.dist
10765
11024
  })),
@@ -10986,7 +11245,7 @@ function SP_misc_insane(self, context) {
10986
11245
  self.monsterinfo.current_move = insane_move_stand_normal;
10987
11246
  self.monsterinfo.scale = 1;
10988
11247
  self.think = monster_think;
10989
- self.nextthink = context.entities.timeSeconds + MONSTER_TICK14;
11248
+ self.nextthink = context.entities.timeSeconds + MONSTER_TICK15;
10990
11249
  if (self.spawnflags & SPAWNFLAG_INSANE_CRUCIFIED) {
10991
11250
  self.mass = 1e5;
10992
11251
  }
@@ -10996,218 +11255,548 @@ function registerInsaneSpawns(registry) {
10996
11255
  registry.register("misc_insane", SP_misc_insane);
10997
11256
  }
10998
11257
 
10999
- // src/entities/monsters/makron.ts
11000
- var MONSTER_TICK15 = 0.1;
11001
- var MAKRON_BFG_OFFSET = { x: 30, y: 28, z: 24 };
11002
- var MAKRON_BLASTER_OFFSET_1 = { x: 26, y: 16, z: 24 };
11003
- var MAKRON_RAILGUN_OFFSET = { x: 26, y: -14, z: 24 };
11004
- function monster_ai_stand14(self, dist, context) {
11005
- ai_stand(self, MONSTER_TICK15, context);
11006
- }
11007
- function monster_ai_walk14(self, dist, context) {
11008
- ai_walk(self, dist, MONSTER_TICK15, context);
11009
- }
11010
- function monster_ai_run13(self, dist, context) {
11011
- ai_run(self, dist, MONSTER_TICK15, context);
11012
- }
11013
- function monster_ai_charge14(self, dist, context) {
11014
- ai_charge(self, dist, MONSTER_TICK15, context);
11015
- }
11016
- function monster_ai_move14(self, dist, context) {
11017
- ai_move(self, dist);
11258
+ // src/entities/monsters/actor.ts
11259
+ var MONSTER_TICK16 = 0.1;
11260
+ var MZ2_ACTOR_MACHINEGUN_1 = 0;
11261
+ var actor_names = [
11262
+ "Hellrot",
11263
+ "Tokay",
11264
+ "Killme",
11265
+ "Disruptor",
11266
+ "Adrianator",
11267
+ "Rambear",
11268
+ "Titus",
11269
+ "Bitterman"
11270
+ ];
11271
+ var FRAME_stand101 = 0;
11272
+ var FRAME_stand140 = 39;
11273
+ var FRAME_walk01 = 40;
11274
+ var FRAME_walk08 = 47;
11275
+ var FRAME_run02 = 48;
11276
+ var FRAME_run07 = 53;
11277
+ var FRAME_pain101 = 54;
11278
+ var FRAME_pain103 = 56;
11279
+ var FRAME_pain201 = 57;
11280
+ var FRAME_pain203 = 59;
11281
+ var FRAME_pain301 = 60;
11282
+ var FRAME_pain303 = 62;
11283
+ var FRAME_flip01 = 63;
11284
+ var FRAME_flip14 = 76;
11285
+ var FRAME_taunt01 = 77;
11286
+ var FRAME_taunt17 = 93;
11287
+ var FRAME_death101 = 94;
11288
+ var FRAME_death107 = 100;
11289
+ var FRAME_death201 = 101;
11290
+ var FRAME_death213 = 113;
11291
+ var FRAME_attak01 = 114;
11292
+ var FRAME_attak04 = 117;
11293
+ var actor_move_stand;
11294
+ var actor_move_walk;
11295
+ var actor_move_run;
11296
+ var actor_move_pain1;
11297
+ var actor_move_pain2;
11298
+ var actor_move_pain3;
11299
+ var actor_move_flipoff;
11300
+ var actor_move_taunt;
11301
+ var actor_move_death1;
11302
+ var actor_move_death2;
11303
+ var actor_move_attack;
11304
+ function m2(ai, dist = 0, think) {
11305
+ return { ai: (s, d, c) => {
11306
+ if (think) think(s, c);
11307
+ ai(s, dist, MONSTER_TICK16, c);
11308
+ }, dist };
11018
11309
  }
11019
- var stand_move13;
11020
- var walk_move12;
11021
- var run_move12;
11022
- var attack_bfg_move;
11023
- var attack_hyperblaster_move;
11024
- var attack_railgun_move;
11025
- var pain4_move;
11026
- var pain5_move;
11027
- var pain6_move;
11028
- var death_move11;
11029
- var sight_move;
11030
- function makron_stand(self) {
11031
- self.monsterinfo.current_move = stand_move13;
11310
+ function actor_stand(self, context) {
11311
+ self.monsterinfo.current_move = actor_move_stand;
11312
+ if (context.timeSeconds < 1) {
11313
+ self.frame = FRAME_stand101 + Math.floor(Math.random() * (FRAME_stand140 - FRAME_stand101 + 1));
11314
+ }
11032
11315
  }
11033
- function makron_walk(self) {
11034
- self.monsterinfo.current_move = walk_move12;
11316
+ function actor_walk(self, context) {
11317
+ self.monsterinfo.current_move = actor_move_walk;
11035
11318
  }
11036
- function makron_run(self) {
11037
- if (self.enemy && self.enemy.health > 0) {
11038
- self.monsterinfo.current_move = run_move12;
11039
- } else {
11040
- self.monsterinfo.current_move = stand_move13;
11319
+ function actor_run(self, context) {
11320
+ if (context.timeSeconds < self.pain_debounce_time && !self.enemy) {
11321
+ if (self.movetarget)
11322
+ actor_walk(self, context);
11323
+ else
11324
+ actor_stand(self, context);
11325
+ return;
11041
11326
  }
11042
- }
11043
- function makron_attack(self) {
11044
- if (!self.enemy) return;
11045
- const r = Math.random();
11046
- if (r <= 0.3) {
11047
- self.monsterinfo.current_move = attack_bfg_move;
11048
- } else if (r <= 0.6) {
11049
- self.monsterinfo.current_move = attack_hyperblaster_move;
11050
- } else {
11051
- self.monsterinfo.current_move = attack_railgun_move;
11327
+ if (self.monsterinfo.aiflags & 1 /* StandGround */) {
11328
+ actor_stand(self, context);
11329
+ return;
11052
11330
  }
11331
+ self.monsterinfo.current_move = actor_move_run;
11053
11332
  }
11054
- function getProjectedOffset3(self, offset) {
11055
- const { forward, right, up } = angleVectors(self.angles);
11056
- const start = { ...self.origin };
11057
- const x = scaleVec3(forward, offset.x);
11058
- const y = scaleVec3(right, offset.y);
11059
- const z = scaleVec3(up, offset.z);
11060
- return addVec3(addVec3(addVec3(start, x), y), z);
11061
- }
11062
- function makron_fire_bfg(self, context) {
11063
- if (!self.enemy) return;
11064
- context.engine.sound?.(self, 0, "makron/bfg_fire.wav", 1, 1, 0);
11065
- const start = getProjectedOffset3(self, MAKRON_BFG_OFFSET);
11066
- const target = { ...self.enemy.origin };
11067
- target.z += self.enemy.viewheight || 0;
11068
- const dir = normalizeVec3(subtractVec3(target, start));
11069
- monster_fire_bfg(self, start, dir, 50, 300, 100, 300, 0, context);
11070
- }
11071
- function makron_fire_railgun(self, context) {
11072
- if (!self.pos1) return;
11073
- context.engine.sound?.(self, 0, "makron/rail_fire.wav", 1, 1, 0);
11074
- const start = getProjectedOffset3(self, MAKRON_RAILGUN_OFFSET);
11075
- const dir = normalizeVec3(subtractVec3(self.pos1, start));
11076
- monster_fire_railgun(self, start, dir, 50, 100, 0, context);
11333
+ var messages = [
11334
+ "Watch it",
11335
+ "#$@*&",
11336
+ "Idiot",
11337
+ "Check your targets"
11338
+ ];
11339
+ function actor_pain(self, other, kick, damage) {
11340
+ const context = self.monsterinfo.context;
11341
+ if (!context) return;
11342
+ if (context.timeSeconds < self.pain_debounce_time)
11343
+ return;
11344
+ self.pain_debounce_time = context.timeSeconds + 3;
11345
+ const random10 = Math.random();
11346
+ if (other && other.client && random10 < 0.4) {
11347
+ const v = subtractVec3(other.origin, self.origin);
11348
+ self.ideal_yaw = vectorToYaw(v);
11349
+ if (Math.random() < 0.5)
11350
+ self.monsterinfo.current_move = actor_move_flipoff;
11351
+ else
11352
+ self.monsterinfo.current_move = actor_move_taunt;
11353
+ const name = actor_names[Math.floor(Math.random() * actor_names.length)];
11354
+ const message = messages[Math.floor(Math.random() * messages.length)];
11355
+ context.centerprintf(other, `${name}: ${message}!
11356
+ `);
11357
+ return;
11358
+ }
11359
+ const n = Math.floor(Math.random() * 3);
11360
+ if (n === 0)
11361
+ self.monsterinfo.current_move = actor_move_pain1;
11362
+ else if (n === 1)
11363
+ self.monsterinfo.current_move = actor_move_pain2;
11364
+ else
11365
+ self.monsterinfo.current_move = actor_move_pain3;
11077
11366
  }
11078
- function makron_save_loc(self) {
11079
- if (!self.enemy) return;
11080
- self.pos1 = { ...self.enemy.origin };
11081
- self.pos1 = { ...self.pos1, z: self.pos1.z + (self.enemy.viewheight || 0) };
11367
+ function actor_setskin(self, context) {
11368
+ if (self.health < self.max_health / 2)
11369
+ self.skin = 1;
11370
+ else
11371
+ self.skin = 0;
11082
11372
  }
11083
- function makron_fire_hyperblaster(self, context) {
11084
- context.engine.sound?.(self, 0, "makron/blaster.wav", 1, 1, 0);
11085
- const start = getProjectedOffset3(self, MAKRON_BLASTER_OFFSET_1);
11086
- const relFrame = (self.monsterinfo.nextframe || 0) - attack_hyperblaster_move.firstframe;
11087
- let yawDelta = 0;
11373
+ function actorMachineGun(self, context) {
11374
+ const flashOffset = { x: 0, y: 0, z: 0 };
11375
+ const vectors = angleVectors(self.angles);
11376
+ const forward = vectors.forward;
11377
+ const start = copyVec3(self.origin);
11378
+ start.z += self.viewheight;
11088
11379
  let dir;
11089
11380
  if (self.enemy) {
11090
- const target = { ...self.enemy.origin };
11091
- target.z += self.enemy.viewheight || 0;
11092
- const vec = subtractVec3(target, start);
11093
- const baseAngles = vectorToAngles(vec);
11094
- const enemyAngles = { ...baseAngles };
11095
- if (relFrame <= 12) {
11096
- enemyAngles.y -= 5 * (relFrame - 4);
11381
+ let target;
11382
+ if (self.enemy.health > 0) {
11383
+ target = subtractVec3(self.enemy.origin, scaleVec3(self.enemy.velocity, 0.2));
11384
+ target.z += self.enemy.viewheight;
11097
11385
  } else {
11098
- enemyAngles.y -= 40 - 5 * (relFrame - 12);
11386
+ target = copyVec3(self.enemy.absmin);
11387
+ target.z += self.enemy.size.z / 2 + 1;
11099
11388
  }
11100
- const forward = angleVectors(enemyAngles).forward;
11101
- dir = forward;
11389
+ dir = subtractVec3(target, start);
11390
+ dir = normalizeVec3(dir);
11102
11391
  } else {
11103
- const { forward } = angleVectors(self.angles);
11104
11392
  dir = forward;
11105
11393
  }
11106
- monster_fire_blaster(self, start, dir, 15, 1e3, 0, 0, context, 1 /* BLASTER */);
11394
+ monster_fire_bullet(self, start, dir, 3, 4, 0, 0, MZ2_ACTOR_MACHINEGUN_1, context);
11107
11395
  }
11108
- function makron_pain(self, other, kick, damage, context) {
11109
- if (self.health < self.max_health / 2) {
11110
- self.skin = 1;
11111
- }
11112
- if (self.timestamp < (self.pain_finished_time || 0)) return;
11113
- if (damage <= 25 && Math.random() < 0.2) return;
11114
- self.pain_finished_time = self.timestamp + 3;
11115
- if (damage <= 40) {
11116
- context.engine.sound?.(self, 0, "makron/pain1.wav", 1, 1, 0);
11117
- self.monsterinfo.current_move = pain4_move;
11118
- } else if (damage <= 110) {
11119
- context.engine.sound?.(self, 0, "makron/pain2.wav", 1, 1, 0);
11120
- self.monsterinfo.current_move = pain5_move;
11121
- } else {
11122
- if (Math.random() <= 0.45) {
11123
- context.engine.sound?.(self, 0, "makron/pain3.wav", 1, 1, 0);
11124
- self.monsterinfo.current_move = pain6_move;
11125
- }
11126
- }
11396
+ function actor_dead(self, context) {
11397
+ self.mins = { x: -16, y: -16, z: -24 };
11398
+ self.maxs = { x: 16, y: 16, z: -8 };
11399
+ self.movetype = 7 /* Toss */;
11400
+ self.svflags |= 1;
11401
+ self.nextthink = -1;
11402
+ context.linkentity(self);
11127
11403
  }
11128
- function makron_die(self, context) {
11129
- context.engine.sound?.(self, 0, "makron/death.wav", 1, 1, 0);
11130
- self.monsterinfo.current_move = death_move11;
11404
+ function actor_die(self, inflictor, attacker, damage, point, mod) {
11405
+ const context = self.monsterinfo.context;
11406
+ if (!context) return;
11407
+ if (self.health <= -80) {
11408
+ throwGibs(context, self.origin, damage);
11409
+ self.deadflag = 2 /* Dead */;
11410
+ return;
11411
+ }
11412
+ if (self.deadflag === 2 /* Dead */)
11413
+ return;
11414
+ self.deadflag = 2 /* Dead */;
11415
+ self.takedamage = true;
11416
+ if (Math.random() < 0.5)
11417
+ self.monsterinfo.current_move = actor_move_death1;
11418
+ else
11419
+ self.monsterinfo.current_move = actor_move_death2;
11420
+ }
11421
+ function actor_fire(self, context) {
11422
+ actorMachineGun(self, context);
11423
+ const fire_wait = self.monsterinfo.fire_wait ?? 0;
11424
+ if (context.timeSeconds >= fire_wait)
11425
+ self.monsterinfo.aiflags &= ~128 /* HoldFrame */;
11426
+ else
11427
+ self.monsterinfo.aiflags |= 128 /* HoldFrame */;
11131
11428
  }
11132
- function makron_dead(self) {
11133
- self.monsterinfo.nextframe = death_move11.lastframe;
11134
- self.nextthink = -1;
11429
+ function actor_attack(self, context) {
11430
+ self.monsterinfo.current_move = actor_move_attack;
11431
+ self.monsterinfo.fire_wait = context.timeSeconds + 1 + Math.random() * 1.6;
11135
11432
  }
11136
- var stand_frames13 = Array.from({ length: 60 }, () => ({ ai: monster_ai_stand14, dist: 0 }));
11137
- stand_move13 = { firstframe: 0, lastframe: 59, frames: stand_frames13, endfunc: makron_stand };
11138
- var walk_frames12 = Array.from({ length: 10 }, () => ({ ai: monster_ai_walk14, dist: 8 }));
11139
- walk_move12 = { firstframe: 60, lastframe: 69, frames: walk_frames12, endfunc: makron_walk };
11140
- var run_frames11 = Array.from({ length: 10 }, () => ({ ai: monster_ai_run13, dist: 8 }));
11141
- run_move12 = { firstframe: 60, lastframe: 69, frames: run_frames11, endfunc: makron_run };
11142
- var attack_bfg_frames = Array.from({ length: 8 }, (_, i) => ({
11143
- ai: monster_ai_charge14,
11144
- dist: 0,
11145
- think: i === 3 ? makron_fire_bfg : null
11146
- }));
11147
- attack_bfg_move = { firstframe: 70, lastframe: 77, frames: attack_bfg_frames, endfunc: makron_run };
11148
- var attack_hyperblaster_frames = Array.from({ length: 26 }, (_, i) => ({
11149
- ai: monster_ai_move14,
11150
- dist: 0,
11151
- think: i >= 4 && i <= 20 ? makron_fire_hyperblaster : null
11152
- }));
11153
- attack_hyperblaster_move = { firstframe: 78, lastframe: 103, frames: attack_hyperblaster_frames, endfunc: makron_run };
11154
- var attack_railgun_frames = Array.from({ length: 16 }, (_, i) => ({
11155
- ai: monster_ai_charge14,
11156
- dist: 0,
11157
- think: i === 7 ? makron_save_loc : i === 8 ? makron_fire_railgun : null
11158
- }));
11159
- attack_railgun_move = { firstframe: 104, lastframe: 119, frames: attack_railgun_frames, endfunc: makron_run };
11160
- var pain4_frames = Array.from({ length: 4 }, () => ({ ai: monster_ai_move14, dist: 0 }));
11161
- pain4_move = { firstframe: 120, lastframe: 123, frames: pain4_frames, endfunc: makron_run };
11162
- var pain5_frames = Array.from({ length: 4 }, () => ({ ai: monster_ai_move14, dist: 0 }));
11163
- pain5_move = { firstframe: 124, lastframe: 127, frames: pain5_frames, endfunc: makron_run };
11164
- var pain6_frames = Array.from({ length: 27 }, () => ({ ai: monster_ai_move14, dist: 0 }));
11165
- pain6_move = { firstframe: 128, lastframe: 154, frames: pain6_frames, endfunc: makron_run };
11166
- var death_frames11 = Array.from({ length: 95 }, () => ({ ai: monster_ai_move14, dist: 0 }));
11167
- death_move11 = { firstframe: 155, lastframe: 249, frames: death_frames11, endfunc: makron_dead };
11168
- var sight_frames = Array.from({ length: 13 }, () => ({ ai: monster_ai_move14, dist: 0 }));
11169
- sight_move = { firstframe: 250, lastframe: 262, frames: sight_frames, endfunc: makron_run };
11170
- function SP_monster_makron(self, context) {
11171
- self.classname = "monster_makron";
11172
- self.model = "models/monsters/boss3/rider/tris.md2";
11173
- self.mins = { x: -30, y: -30, z: 0 };
11174
- self.maxs = { x: 30, y: 30, z: 90 };
11433
+ function actor_use(self, other, activator) {
11434
+ const context = self.monsterinfo.context;
11435
+ const target = context.pickTarget(self.target);
11436
+ self.goalentity = target;
11437
+ self.movetarget = target;
11438
+ if (!self.movetarget || self.movetarget.classname !== "target_actor") {
11439
+ console.log(`${self.classname}: bad target ${self.target}`);
11440
+ self.target = void 0;
11441
+ self.monsterinfo.pausetime = 1e8;
11442
+ if (self.monsterinfo.stand) self.monsterinfo.stand(self, context);
11443
+ return;
11444
+ }
11445
+ const goalPos = self.goalentity ? self.goalentity.origin : self.movetarget ? self.movetarget.origin : self.origin;
11446
+ const v = subtractVec3(goalPos, self.origin);
11447
+ self.ideal_yaw = vectorToYaw(v);
11448
+ self.angles.y = self.ideal_yaw;
11449
+ if (self.monsterinfo.walk) self.monsterinfo.walk(self, context);
11450
+ self.target = void 0;
11451
+ }
11452
+ function actor_stand_wrapper(self, context) {
11453
+ actor_stand(self, context);
11454
+ }
11455
+ var frames_stand = [
11456
+ m2(ai_stand),
11457
+ m2(ai_stand),
11458
+ m2(ai_stand),
11459
+ m2(ai_stand),
11460
+ m2(ai_stand),
11461
+ m2(ai_stand),
11462
+ m2(ai_stand),
11463
+ m2(ai_stand),
11464
+ m2(ai_stand),
11465
+ m2(ai_stand),
11466
+ m2(ai_stand),
11467
+ m2(ai_stand),
11468
+ m2(ai_stand),
11469
+ m2(ai_stand),
11470
+ m2(ai_stand),
11471
+ m2(ai_stand),
11472
+ m2(ai_stand),
11473
+ m2(ai_stand),
11474
+ m2(ai_stand),
11475
+ m2(ai_stand),
11476
+ m2(ai_stand),
11477
+ m2(ai_stand),
11478
+ m2(ai_stand),
11479
+ m2(ai_stand),
11480
+ m2(ai_stand),
11481
+ m2(ai_stand),
11482
+ m2(ai_stand),
11483
+ m2(ai_stand),
11484
+ m2(ai_stand),
11485
+ m2(ai_stand),
11486
+ m2(ai_stand),
11487
+ m2(ai_stand),
11488
+ m2(ai_stand),
11489
+ m2(ai_stand),
11490
+ m2(ai_stand),
11491
+ m2(ai_stand),
11492
+ m2(ai_stand),
11493
+ m2(ai_stand),
11494
+ m2(ai_stand),
11495
+ m2(ai_stand)
11496
+ ];
11497
+ actor_move_stand = {
11498
+ firstframe: FRAME_stand101,
11499
+ lastframe: FRAME_stand140,
11500
+ frames: frames_stand,
11501
+ endfunc: null
11502
+ };
11503
+ var frames_walk = [
11504
+ m2(ai_walk),
11505
+ m2(ai_walk, 6),
11506
+ m2(ai_walk, 10),
11507
+ m2(ai_walk, 3),
11508
+ m2(ai_walk, 2),
11509
+ m2(ai_walk, 7),
11510
+ m2(ai_walk, 10),
11511
+ m2(ai_walk, 1)
11512
+ ];
11513
+ actor_move_walk = {
11514
+ firstframe: FRAME_walk01,
11515
+ lastframe: FRAME_walk08,
11516
+ frames: frames_walk,
11517
+ endfunc: null
11518
+ };
11519
+ var frames_run = [
11520
+ m2(ai_run, 4),
11521
+ m2(ai_run, 15),
11522
+ m2(ai_run, 15),
11523
+ m2(ai_run, 8),
11524
+ m2(ai_run, 20),
11525
+ m2(ai_run, 15)
11526
+ ];
11527
+ actor_move_run = {
11528
+ firstframe: FRAME_run02,
11529
+ lastframe: FRAME_run07,
11530
+ frames: frames_run,
11531
+ endfunc: null
11532
+ };
11533
+ var frames_pain1 = [
11534
+ m2(ai_move, -5),
11535
+ m2(ai_move, 4),
11536
+ m2(ai_move, 1)
11537
+ ];
11538
+ actor_move_pain1 = {
11539
+ firstframe: FRAME_pain101,
11540
+ lastframe: FRAME_pain103,
11541
+ frames: frames_pain1,
11542
+ endfunc: actor_run
11543
+ };
11544
+ var frames_pain2 = [
11545
+ m2(ai_move, -4),
11546
+ m2(ai_move, 4),
11547
+ m2(ai_move)
11548
+ ];
11549
+ actor_move_pain2 = {
11550
+ firstframe: FRAME_pain201,
11551
+ lastframe: FRAME_pain203,
11552
+ frames: frames_pain2,
11553
+ endfunc: actor_run
11554
+ };
11555
+ var frames_pain3 = [
11556
+ m2(ai_move, -1),
11557
+ m2(ai_move, 1),
11558
+ m2(ai_move, 0)
11559
+ ];
11560
+ actor_move_pain3 = {
11561
+ firstframe: FRAME_pain301,
11562
+ lastframe: FRAME_pain303,
11563
+ frames: frames_pain3,
11564
+ endfunc: actor_run
11565
+ };
11566
+ var frames_flipoff = [
11567
+ m2(ai_turn),
11568
+ m2(ai_turn),
11569
+ m2(ai_turn),
11570
+ m2(ai_turn),
11571
+ m2(ai_turn),
11572
+ m2(ai_turn),
11573
+ m2(ai_turn),
11574
+ m2(ai_turn),
11575
+ m2(ai_turn),
11576
+ m2(ai_turn),
11577
+ m2(ai_turn),
11578
+ m2(ai_turn),
11579
+ m2(ai_turn),
11580
+ m2(ai_turn)
11581
+ ];
11582
+ actor_move_flipoff = {
11583
+ firstframe: FRAME_flip01,
11584
+ lastframe: FRAME_flip14,
11585
+ frames: frames_flipoff,
11586
+ endfunc: actor_run
11587
+ };
11588
+ var frames_taunt = [
11589
+ m2(ai_turn),
11590
+ m2(ai_turn),
11591
+ m2(ai_turn),
11592
+ m2(ai_turn),
11593
+ m2(ai_turn),
11594
+ m2(ai_turn),
11595
+ m2(ai_turn),
11596
+ m2(ai_turn),
11597
+ m2(ai_turn),
11598
+ m2(ai_turn),
11599
+ m2(ai_turn),
11600
+ m2(ai_turn),
11601
+ m2(ai_turn),
11602
+ m2(ai_turn),
11603
+ m2(ai_turn),
11604
+ m2(ai_turn),
11605
+ m2(ai_turn)
11606
+ ];
11607
+ actor_move_taunt = {
11608
+ firstframe: FRAME_taunt01,
11609
+ lastframe: FRAME_taunt17,
11610
+ frames: frames_taunt,
11611
+ endfunc: actor_run
11612
+ };
11613
+ var frames_death1 = [
11614
+ m2(ai_move),
11615
+ m2(ai_move),
11616
+ m2(ai_move, -13),
11617
+ m2(ai_move, 14),
11618
+ m2(ai_move, 3),
11619
+ m2(ai_move, -2),
11620
+ m2(ai_move, 1)
11621
+ ];
11622
+ actor_move_death1 = {
11623
+ firstframe: FRAME_death101,
11624
+ lastframe: FRAME_death107,
11625
+ frames: frames_death1,
11626
+ endfunc: actor_dead
11627
+ };
11628
+ var frames_death2 = [
11629
+ m2(ai_move),
11630
+ m2(ai_move, 7),
11631
+ m2(ai_move, -6),
11632
+ m2(ai_move, -5),
11633
+ m2(ai_move, 1),
11634
+ m2(ai_move),
11635
+ m2(ai_move, -1),
11636
+ m2(ai_move, -2),
11637
+ m2(ai_move, -1),
11638
+ m2(ai_move, -9),
11639
+ m2(ai_move, -13),
11640
+ m2(ai_move, -13),
11641
+ m2(ai_move)
11642
+ ];
11643
+ actor_move_death2 = {
11644
+ firstframe: FRAME_death201,
11645
+ lastframe: FRAME_death213,
11646
+ frames: frames_death2,
11647
+ endfunc: actor_dead
11648
+ };
11649
+ var frames_attack = [
11650
+ m2(ai_charge, -2, actor_fire),
11651
+ m2(ai_charge, -2),
11652
+ m2(ai_charge, 3),
11653
+ m2(ai_charge, 2)
11654
+ ];
11655
+ actor_move_attack = {
11656
+ firstframe: FRAME_attak01,
11657
+ lastframe: FRAME_attak04,
11658
+ frames: frames_attack,
11659
+ endfunc: actor_run
11660
+ };
11661
+ function SP_misc_actor(self, context) {
11662
+ if (!self.targetname) {
11663
+ console.log(`${self.classname}: no targetname`);
11664
+ context.entities.free(self);
11665
+ return;
11666
+ }
11667
+ if (!self.target) {
11668
+ console.log(`${self.classname}: no target`);
11669
+ context.entities.free(self);
11670
+ return;
11671
+ }
11672
+ self.movetarget = null;
11175
11673
  self.movetype = 5 /* Step */;
11176
11674
  self.solid = 2 /* BoundingBox */;
11177
- self.health = 3e3;
11178
- self.max_health = 3e3;
11179
- self.mass = 500;
11180
- self.takedamage = true;
11181
- self.viewheight = 90;
11182
- self.pain = (ent, other, kick, dmg) => makron_pain(ent, other, kick, dmg, context.entities);
11183
- self.die = (self2, inflictor, attacker, damage, point) => {
11184
- if (self2.health <= -2e3) {
11185
- throwGibs(context.entities, self2.origin, damage);
11186
- context.entities.free(self2);
11187
- return;
11188
- }
11189
- self2.deadflag = 2 /* Dead */;
11190
- self2.solid = 0 /* Not */;
11191
- makron_die(self2, context.entities);
11675
+ self.model = "players/male/tris.md2";
11676
+ self.mins = { x: -16, y: -16, z: -24 };
11677
+ self.maxs = { x: 16, y: 16, z: 32 };
11678
+ if (!self.health)
11679
+ self.health = 100;
11680
+ self.max_health = self.health;
11681
+ self.mass = 200;
11682
+ self.pain = actor_pain;
11683
+ self.die = actor_die;
11684
+ self.monsterinfo = {
11685
+ ...self.monsterinfo,
11686
+ // Preserve default properties like last_sighting, trail_time, pausetime
11687
+ stand: (s) => actor_stand_wrapper(s, context.entities),
11688
+ // Wrap to match signature
11689
+ walk: actor_walk,
11690
+ run: actor_run,
11691
+ attack: actor_attack,
11692
+ melee: void 0,
11693
+ sight: void 0,
11694
+ setskin: (s) => actor_setskin(s, context.entities),
11695
+ // Wrap to match signature
11696
+ aiflags: 256 /* GoodGuy */,
11697
+ scale: 1
11698
+ // MODEL_SCALE
11192
11699
  };
11193
- self.monsterinfo.stand = makron_stand;
11194
- self.monsterinfo.walk = makron_walk;
11195
- self.monsterinfo.run = makron_run;
11196
- self.monsterinfo.attack = makron_attack;
11197
- self.monsterinfo.sight = (self2, other) => {
11198
- context.entities.sound?.(self2, 0, "makron/sight.wav", 1, 1, 0);
11199
- self2.monsterinfo.current_move = sight_move;
11700
+ self.monsterinfo.context = context.entities;
11701
+ context.entities.linkentity(self);
11702
+ self.monsterinfo.current_move = actor_move_stand;
11703
+ self.think = (s) => {
11704
+ const c = s.monsterinfo.context;
11705
+ if (c) monster_think(s, c);
11200
11706
  };
11201
- self.think = monster_think;
11202
- self.monsterinfo.current_move = sight_move;
11203
- self.nextthink = self.timestamp + MONSTER_TICK15;
11707
+ self.nextthink = context.entities.timeSeconds + MONSTER_TICK16;
11708
+ self.use = (self2, other, activator = null) => actor_use(self2, other, activator);
11709
+ }
11710
+ var SPAWNFLAG_TARGET_ACTOR_JUMP = 1;
11711
+ var SPAWNFLAG_TARGET_ACTOR_SHOOT = 2;
11712
+ var SPAWNFLAG_TARGET_ACTOR_ATTACK = 4;
11713
+ var SPAWNFLAG_TARGET_ACTOR_HOLD = 16;
11714
+ var SPAWNFLAG_TARGET_ACTOR_BRUTAL = 32;
11715
+ function target_actor_touch(self, other, plane, surf) {
11716
+ if (!other) return;
11717
+ const context = self.monsterinfo.context;
11718
+ if (other.movetarget !== self)
11719
+ return;
11720
+ if (other.enemy)
11721
+ return;
11722
+ other.goalentity = null;
11723
+ other.movetarget = null;
11724
+ if (self.message) {
11725
+ const name = actor_names[Math.floor(Math.random() * actor_names.length)];
11726
+ }
11727
+ if (self.spawnflags & SPAWNFLAG_TARGET_ACTOR_JUMP) {
11728
+ const v = other.velocity;
11729
+ v.x = self.movedir.x * self.speed;
11730
+ v.y = self.movedir.y * self.speed;
11731
+ if (other.groundentity) {
11732
+ other.groundentity = null;
11733
+ v.z = self.movedir.z;
11734
+ context.sound(other, 2, "player/male/jump1.wav", 1, 1, 0);
11735
+ }
11736
+ }
11737
+ if (self.spawnflags & SPAWNFLAG_TARGET_ACTOR_SHOOT) {
11738
+ } else if (self.spawnflags & SPAWNFLAG_TARGET_ACTOR_ATTACK) {
11739
+ other.enemy = context.pickTarget(self.pathtarget);
11740
+ if (other.enemy) {
11741
+ other.goalentity = other.enemy;
11742
+ if (self.spawnflags & SPAWNFLAG_TARGET_ACTOR_BRUTAL)
11743
+ other.monsterinfo.aiflags |= 512 /* Brutal */;
11744
+ if (self.spawnflags & SPAWNFLAG_TARGET_ACTOR_HOLD) {
11745
+ other.monsterinfo.aiflags |= 1 /* StandGround */;
11746
+ actor_stand(other, context);
11747
+ } else {
11748
+ actor_run(other, context);
11749
+ }
11750
+ }
11751
+ }
11752
+ if (!(self.spawnflags & (SPAWNFLAG_TARGET_ACTOR_ATTACK | SPAWNFLAG_TARGET_ACTOR_SHOOT)) && self.pathtarget) {
11753
+ const savetarget = self.target;
11754
+ self.target = self.pathtarget;
11755
+ context.useTargets(self, other);
11756
+ self.target = savetarget;
11757
+ }
11758
+ other.movetarget = context.pickTarget(self.target);
11759
+ if (!other.goalentity)
11760
+ other.goalentity = other.movetarget;
11761
+ if (!other.movetarget && !other.enemy) {
11762
+ other.monsterinfo.pausetime = 1e8;
11763
+ if (other.monsterinfo.stand) other.monsterinfo.stand(other, context);
11764
+ } else if (other.movetarget === other.goalentity && other.movetarget) {
11765
+ const v = subtractVec3(other.movetarget.origin, other.origin);
11766
+ other.ideal_yaw = vectorToYaw(v);
11767
+ }
11204
11768
  }
11205
- function registerMakronSpawns(registry) {
11206
- registry.register("monster_makron", SP_monster_makron);
11769
+ function SP_target_actor(self, context) {
11770
+ if (!self.targetname)
11771
+ console.log(`${self.classname}: no targetname`);
11772
+ self.solid = 1 /* Trigger */;
11773
+ self.touch = target_actor_touch;
11774
+ self.mins = { x: -8, y: -8, z: -8 };
11775
+ self.maxs = { x: 8, y: 8, z: 8 };
11776
+ self.svflags = 1 << 6;
11777
+ self.monsterinfo = {
11778
+ ...self.monsterinfo
11779
+ };
11780
+ self.monsterinfo.context = context.entities;
11781
+ if (self.spawnflags & SPAWNFLAG_TARGET_ACTOR_JUMP) {
11782
+ if (!self.speed)
11783
+ self.speed = 200;
11784
+ const height = self.height || 200;
11785
+ if (self.angles.y === 0)
11786
+ self.angles.y = 360;
11787
+ const dir = setMovedir(self.angles);
11788
+ dir.z = height;
11789
+ self.movedir = dir;
11790
+ }
11791
+ context.entities.linkentity(self);
11792
+ }
11793
+ function registerActorSpawns(registry) {
11794
+ registry.register("misc_actor", SP_misc_actor);
11795
+ registry.register("target_actor", SP_target_actor);
11207
11796
  }
11208
11797
 
11209
11798
  // src/entities/monsters/medic.ts
11210
- var MONSTER_TICK16 = 0.1;
11799
+ var MONSTER_TICK17 = 0.1;
11211
11800
  function monster_ai_stand15(self, dist, context) {
11212
11801
  if (self.classname === "monster_medic") {
11213
11802
  if (medic_find_dead(self, context)) {
@@ -11215,24 +11804,24 @@ function monster_ai_stand15(self, dist, context) {
11215
11804
  return;
11216
11805
  }
11217
11806
  }
11218
- ai_stand(self, MONSTER_TICK16, context);
11807
+ ai_stand(self, MONSTER_TICK17, context);
11219
11808
  }
11220
11809
  function monster_ai_walk15(self, dist, context) {
11221
- ai_walk(self, dist, MONSTER_TICK16, context);
11810
+ ai_walk(self, dist, MONSTER_TICK17, context);
11222
11811
  }
11223
11812
  function monster_ai_run14(self, dist, context) {
11224
11813
  if (self.classname === "monster_medic") {
11225
11814
  if (medic_find_dead(self, context)) {
11226
11815
  self.monsterinfo.current_move = run_move13;
11227
11816
  } else {
11228
- ai_run(self, dist, MONSTER_TICK16, context);
11817
+ ai_run(self, dist, MONSTER_TICK17, context);
11229
11818
  }
11230
11819
  } else {
11231
- ai_run(self, dist, MONSTER_TICK16, context);
11820
+ ai_run(self, dist, MONSTER_TICK17, context);
11232
11821
  }
11233
11822
  }
11234
11823
  function monster_ai_charge15(self, dist, context) {
11235
- ai_charge(self, dist, MONSTER_TICK16, context);
11824
+ ai_charge(self, dist, MONSTER_TICK17, context);
11236
11825
  }
11237
11826
  function monster_ai_move15(self, dist, context) {
11238
11827
  ai_move(self, dist);
@@ -11568,7 +12157,7 @@ function SP_monster_medic(self, context) {
11568
12157
  self.monsterinfo.attack = medic_attack;
11569
12158
  self.think = monster_think;
11570
12159
  medic_stand(self);
11571
- self.nextthink = self.timestamp + MONSTER_TICK16;
12160
+ self.nextthink = self.timestamp + MONSTER_TICK17;
11572
12161
  }
11573
12162
  function SP_monster_medic_commander(self, context) {
11574
12163
  SP_monster_medic(self, context);
@@ -11583,25 +12172,25 @@ function registerMedicSpawns(registry) {
11583
12172
  }
11584
12173
 
11585
12174
  // src/entities/monsters/mutant.ts
11586
- var MONSTER_TICK17 = 0.1;
12175
+ var MONSTER_TICK18 = 0.1;
11587
12176
  var random6 = () => Math.random();
11588
12177
  function monster_ai_stand16(self, dist, context) {
11589
- ai_stand(self, MONSTER_TICK17, context);
12178
+ ai_stand(self, MONSTER_TICK18, context);
11590
12179
  }
11591
12180
  function monster_ai_walk16(self, dist, context) {
11592
- ai_walk(self, dist, MONSTER_TICK17, context);
12181
+ ai_walk(self, dist, MONSTER_TICK18, context);
11593
12182
  }
11594
12183
  function monster_ai_run15(self, dist, context) {
11595
- ai_run(self, dist, MONSTER_TICK17, context);
12184
+ ai_run(self, dist, MONSTER_TICK18, context);
11596
12185
  }
11597
12186
  function monster_ai_charge16(self, dist, context) {
11598
- ai_charge(self, dist, MONSTER_TICK17, context);
12187
+ ai_charge(self, dist, MONSTER_TICK18, context);
11599
12188
  }
11600
12189
  function monster_ai_move16(self, dist, context) {
11601
12190
  ai_move(self, dist);
11602
12191
  }
11603
12192
  function monster_ai_face(self, dist, context) {
11604
- ai_face(self, null, dist, MONSTER_TICK17);
12193
+ ai_face(self, null, dist, MONSTER_TICK18);
11605
12194
  }
11606
12195
  var stand_move15;
11607
12196
  var walk_move14;
@@ -11965,26 +12554,26 @@ function SP_monster_mutant(self, context) {
11965
12554
  self.monsterinfo.idle = mutant_stand;
11966
12555
  self.think = monster_think;
11967
12556
  mutant_stand(self);
11968
- self.nextthink = self.timestamp + MONSTER_TICK17;
12557
+ self.nextthink = self.timestamp + MONSTER_TICK18;
11969
12558
  }
11970
12559
  function registerMutantSpawns(registry) {
11971
12560
  registry.register("monster_mutant", SP_monster_mutant);
11972
12561
  }
11973
12562
 
11974
12563
  // src/entities/monsters/parasite.ts
11975
- var MONSTER_TICK18 = 0.1;
12564
+ var MONSTER_TICK19 = 0.1;
11976
12565
  var random7 = () => Math.random();
11977
12566
  function monster_ai_stand17(self, dist, context) {
11978
- ai_stand(self, MONSTER_TICK18, context);
12567
+ ai_stand(self, MONSTER_TICK19, context);
11979
12568
  }
11980
12569
  function monster_ai_walk17(self, dist, context) {
11981
- ai_walk(self, dist, MONSTER_TICK18, context);
12570
+ ai_walk(self, dist, MONSTER_TICK19, context);
11982
12571
  }
11983
12572
  function monster_ai_run16(self, dist, context) {
11984
- ai_run(self, dist, MONSTER_TICK18, context);
12573
+ ai_run(self, dist, MONSTER_TICK19, context);
11985
12574
  }
11986
12575
  function monster_ai_charge17(self, dist, context) {
11987
- ai_charge(self, dist, MONSTER_TICK18, context);
12576
+ ai_charge(self, dist, MONSTER_TICK19, context);
11988
12577
  }
11989
12578
  function monster_ai_move17(self, dist, context) {
11990
12579
  ai_move(self, dist);
@@ -12361,28 +12950,28 @@ function SP_monster_parasite(self, context) {
12361
12950
  self.monsterinfo.idle = parasite_idle;
12362
12951
  self.think = monster_think;
12363
12952
  parasite_stand(self);
12364
- self.nextthink = self.timestamp + MONSTER_TICK18;
12953
+ self.nextthink = self.timestamp + MONSTER_TICK19;
12365
12954
  }
12366
12955
  function registerParasiteSpawns(registry) {
12367
12956
  registry.register("monster_parasite", SP_monster_parasite);
12368
12957
  }
12369
12958
 
12370
12959
  // src/entities/monsters/soldier.ts
12371
- var MONSTER_TICK19 = 0.1;
12960
+ var MONSTER_TICK20 = 0.1;
12372
12961
  var SOLDIER_LIGHT = 1;
12373
12962
  var SOLDIER_SSG = 2;
12374
12963
  var SOLDIER_MACHINEGUN = 4;
12375
12964
  function monster_ai_stand18(self, dist, context) {
12376
- ai_stand(self, MONSTER_TICK19, context);
12965
+ ai_stand(self, MONSTER_TICK20, context);
12377
12966
  }
12378
12967
  function monster_ai_walk18(self, dist, context) {
12379
- ai_walk(self, dist, MONSTER_TICK19, context);
12968
+ ai_walk(self, dist, MONSTER_TICK20, context);
12380
12969
  }
12381
12970
  function monster_ai_run17(self, dist, context) {
12382
- ai_run(self, dist, MONSTER_TICK19, context);
12971
+ ai_run(self, dist, MONSTER_TICK20, context);
12383
12972
  }
12384
12973
  function monster_ai_charge18(self, dist, context) {
12385
- ai_charge(self, dist, MONSTER_TICK19, context);
12974
+ ai_charge(self, dist, MONSTER_TICK20, context);
12386
12975
  }
12387
12976
  function monster_ai_move18(self, dist, context) {
12388
12977
  ai_move(self, dist);
@@ -12666,7 +13255,7 @@ function SP_monster_soldier(self, context) {
12666
13255
  };
12667
13256
  self.think = monster_think;
12668
13257
  soldier_stand(self);
12669
- self.nextthink = self.timestamp + MONSTER_TICK19;
13258
+ self.nextthink = self.timestamp + MONSTER_TICK20;
12670
13259
  }
12671
13260
  function SP_monster_soldier_light(self, context) {
12672
13261
  self.spawnflags |= SOLDIER_LIGHT;
@@ -12706,12 +13295,12 @@ function registerMonsterSpawns(registry) {
12706
13295
  }
12707
13296
 
12708
13297
  // src/entities/monsters/supertank.ts
12709
- var MONSTER_TICK20 = 0.1;
13298
+ var MONSTER_TICK21 = 0.1;
12710
13299
  var SUPERTANK_MACHINEGUN_OFFSET = { x: 30, y: 30, z: 40 };
12711
13300
  var SUPERTANK_ROCKET_OFFSET = { x: 30, y: -30, z: 40 };
12712
13301
  var SUPERTANK_GRENADE_OFFSET = { x: 20, y: 0, z: 70 };
12713
13302
  function monster_ai_stand19(self, dist, context) {
12714
- ai_stand(self, MONSTER_TICK20, context);
13303
+ ai_stand(self, MONSTER_TICK21, context);
12715
13304
  }
12716
13305
  function monster_ai_run18(self, dist, context) {
12717
13306
  if (self.enemy && self.enemy.health > 0) {
@@ -12721,7 +13310,7 @@ function monster_ai_run18(self, dist, context) {
12721
13310
  }
12722
13311
  }
12723
13312
  function monster_ai_charge19(self, dist, context) {
12724
- ai_charge(self, dist, MONSTER_TICK20, context);
13313
+ ai_charge(self, dist, MONSTER_TICK21, context);
12725
13314
  }
12726
13315
  function monster_ai_move19(self, dist, context) {
12727
13316
  ai_move(self, dist);
@@ -12917,7 +13506,7 @@ function SP_monster_supertank(self, context) {
12917
13506
  };
12918
13507
  self.think = monster_think;
12919
13508
  supertank_stand(self);
12920
- self.nextthink = self.timestamp + MONSTER_TICK20;
13509
+ self.nextthink = self.timestamp + MONSTER_TICK21;
12921
13510
  }
12922
13511
  function registerSupertankSpawns(registry) {
12923
13512
  registry.register("monster_supertank", SP_monster_supertank);
@@ -12930,7 +13519,7 @@ function registerSupertankSpawns(registry) {
12930
13519
  }
12931
13520
 
12932
13521
  // src/entities/monsters/tank.ts
12933
- var MONSTER_TICK21 = 0.1;
13522
+ var MONSTER_TICK22 = 0.1;
12934
13523
  function M_AdjustBlindfireTarget(self, start, target, right, context) {
12935
13524
  const tr = context.trace(start, target, ZERO_VEC3, ZERO_VEC3, self, MASK_SHOT);
12936
13525
  if (!tr.startsolid && !tr.allsolid && tr.fraction >= 0.5) {
@@ -12957,10 +13546,10 @@ function tank_blind_check(self, context) {
12957
13546
  }
12958
13547
  }
12959
13548
  function monster_ai_stand20(self, dist, context) {
12960
- ai_stand(self, MONSTER_TICK21, context);
13549
+ ai_stand(self, MONSTER_TICK22, context);
12961
13550
  }
12962
13551
  function monster_ai_walk19(self, dist, context) {
12963
- ai_walk(self, dist, MONSTER_TICK21, context);
13552
+ ai_walk(self, dist, MONSTER_TICK22, context);
12964
13553
  }
12965
13554
  function monster_ai_run19(self, dist, context) {
12966
13555
  if (self.enemy && self.enemy.health > 0) {
@@ -12970,7 +13559,7 @@ function monster_ai_run19(self, dist, context) {
12970
13559
  }
12971
13560
  }
12972
13561
  function monster_ai_charge20(self, dist, context) {
12973
- ai_charge(self, dist, MONSTER_TICK21, context);
13562
+ ai_charge(self, dist, MONSTER_TICK22, context);
12974
13563
  }
12975
13564
  function monster_ai_move20(self, dist, context) {
12976
13565
  ai_move(self, dist);
@@ -13281,7 +13870,7 @@ function SP_monster_tank(self, context) {
13281
13870
  self.monsterinfo.blindfire = true;
13282
13871
  self.think = monster_think;
13283
13872
  tank_stand(self);
13284
- self.nextthink = self.timestamp + MONSTER_TICK21;
13873
+ self.nextthink = self.timestamp + MONSTER_TICK22;
13285
13874
  }
13286
13875
  function registerTankSpawns(registry) {
13287
13876
  registry.register("monster_tank", SP_monster_tank);
@@ -13300,15 +13889,15 @@ function registerTankCommanderSpawns(registry) {
13300
13889
  }
13301
13890
 
13302
13891
  // src/entities/monsters/turret.ts
13303
- var MONSTER_TICK22 = 0.1;
13892
+ var MONSTER_TICK23 = 0.1;
13304
13893
  function monster_ai_stand21(self, dist, context) {
13305
- ai_stand(self, MONSTER_TICK22, context);
13894
+ ai_stand(self, MONSTER_TICK23, context);
13306
13895
  }
13307
13896
  function monster_ai_run20(self, dist, context) {
13308
- ai_run(self, dist, MONSTER_TICK22, context);
13897
+ ai_run(self, dist, MONSTER_TICK23, context);
13309
13898
  }
13310
13899
  function monster_ai_charge21(self, dist, context) {
13311
- ai_charge(self, dist, MONSTER_TICK22, context);
13900
+ ai_charge(self, dist, MONSTER_TICK23, context);
13312
13901
  }
13313
13902
  var stand_move20;
13314
13903
  var run_move19;
@@ -13444,7 +14033,7 @@ function SP_monster_turret(self, context) {
13444
14033
  };
13445
14034
  self.think = monster_think;
13446
14035
  turret_stand(self);
13447
- self.nextthink = self.timestamp + MONSTER_TICK22;
14036
+ self.nextthink = self.timestamp + MONSTER_TICK23;
13448
14037
  }
13449
14038
  function registerTurretSpawns(registry) {
13450
14039
  registry.register("monster_turret", SP_monster_turret);
@@ -13475,6 +14064,7 @@ function registerMonsterSpawns2(registry) {
13475
14064
  registerJorgSpawns(registry);
13476
14065
  registerMakronSpawns(registry);
13477
14066
  registerInsaneSpawns(registry);
14067
+ registerActorSpawns(registry);
13478
14068
  }
13479
14069
 
13480
14070
  // src/entities/worldspawn.ts
@@ -14922,7 +15512,97 @@ function ClientObituary(self, inflictor, attacker, mod, sys) {
14922
15512
  }
14923
15513
  }
14924
15514
 
15515
+ // src/entities/player_anim.ts
15516
+ var FRAME_stand01 = 0;
15517
+ var FRAME_stand402 = 39;
15518
+ var FRAME_run1 = 40;
15519
+ var FRAME_run6 = 45;
15520
+ var FRAME_pain1012 = 54;
15521
+ var FRAME_pain104 = 57;
15522
+ var FRAME_pain2012 = 58;
15523
+ var FRAME_pain204 = 61;
15524
+ var FRAME_pain3012 = 62;
15525
+ var FRAME_pain304 = 65;
15526
+ var FRAME_death1012 = 66;
15527
+ var FRAME_death106 = 71;
15528
+ var FRAME_death2012 = 72;
15529
+ var FRAME_death206 = 77;
15530
+ var FRAME_death301 = 78;
15531
+ var FRAME_death306 = 83;
15532
+ var ANIM_BASIC = 0;
15533
+ var ANIM_PAIN = 2;
15534
+ var ANIM_DEATH = 3;
15535
+
15536
+ // src/combat/weapons/firing.ts
15537
+ var random9 = createRandomGenerator();
15538
+
14925
15539
  // src/entities/player.ts
15540
+ function P_PlayerThink(ent, sys) {
15541
+ if (!ent.client) return;
15542
+ const client = ent.client;
15543
+ let animChanged = false;
15544
+ if (ent.deadflag) {
15545
+ } else {
15546
+ const speed = Math.sqrt(ent.velocity.x * ent.velocity.x + ent.velocity.y * ent.velocity.y);
15547
+ const moving = speed > 10;
15548
+ if (client.anim_priority === ANIM_BASIC || client.anim_priority === void 0) {
15549
+ if (moving) {
15550
+ if (ent.frame < FRAME_run1 || ent.frame > FRAME_run6) {
15551
+ ent.frame = FRAME_run1;
15552
+ client.anim_end = FRAME_run6;
15553
+ client.anim_priority = ANIM_BASIC;
15554
+ animChanged = true;
15555
+ }
15556
+ } else {
15557
+ if (ent.frame >= FRAME_run1 && ent.frame <= FRAME_run6 || client.anim_priority === ANIM_BASIC && client.anim_end !== FRAME_stand402 || client.anim_priority === void 0) {
15558
+ ent.frame = FRAME_stand01;
15559
+ client.anim_end = FRAME_stand402;
15560
+ client.anim_priority = ANIM_BASIC;
15561
+ animChanged = true;
15562
+ }
15563
+ }
15564
+ }
15565
+ }
15566
+ if (animChanged) {
15567
+ return;
15568
+ }
15569
+ if (client.anim_end !== void 0 && client.anim_end !== ent.frame) {
15570
+ if (ent.frame < client.anim_end) {
15571
+ ent.frame++;
15572
+ } else if (ent.frame > client.anim_end) {
15573
+ ent.frame--;
15574
+ }
15575
+ } else if (client.anim_end === ent.frame) {
15576
+ if (client.anim_priority === ANIM_BASIC) {
15577
+ if (ent.frame === FRAME_run6) ent.frame = FRAME_run1;
15578
+ else if (ent.frame === FRAME_stand402) ent.frame = FRAME_stand01;
15579
+ } else {
15580
+ if (client.anim_priority !== ANIM_DEATH) {
15581
+ client.anim_priority = ANIM_BASIC;
15582
+ }
15583
+ }
15584
+ }
15585
+ }
15586
+ function player_pain(self, damage) {
15587
+ if (!self.client) return;
15588
+ if (self.health < 40) {
15589
+ }
15590
+ if (self.client.anim_priority && self.client.anim_priority >= ANIM_PAIN) {
15591
+ return;
15592
+ }
15593
+ self.client.anim_priority = ANIM_PAIN;
15594
+ const r = random9.frandom();
15595
+ if (r < 0.33) {
15596
+ self.frame = FRAME_pain1012;
15597
+ self.client.anim_end = FRAME_pain104;
15598
+ } else if (r < 0.66) {
15599
+ self.frame = FRAME_pain2012;
15600
+ self.client.anim_end = FRAME_pain204;
15601
+ } else {
15602
+ self.frame = FRAME_pain3012;
15603
+ self.client.anim_end = FRAME_pain304;
15604
+ }
15605
+ }
14926
15606
  function player_die(self, inflictor, attacker, damage, point, mod, sys) {
14927
15607
  self.deadflag = 2 /* Dead */;
14928
15608
  self.solid = 0 /* Not */;
@@ -14930,8 +15610,24 @@ function player_die(self, inflictor, attacker, damage, point, mod, sys) {
14930
15610
  self.takedamage = false;
14931
15611
  if (self.health < -40 && sys) {
14932
15612
  throwGibs(sys, self.origin, damage);
15613
+ return;
15614
+ }
15615
+ if (self.client) {
15616
+ self.client.anim_priority = ANIM_DEATH;
15617
+ const r = random9.frandom();
15618
+ if (r < 0.33) {
15619
+ self.frame = FRAME_death1012;
15620
+ self.client.anim_end = FRAME_death106;
15621
+ } else if (r < 0.66) {
15622
+ self.frame = FRAME_death2012;
15623
+ self.client.anim_end = FRAME_death206;
15624
+ } else {
15625
+ self.frame = FRAME_death301;
15626
+ self.client.anim_end = FRAME_death306;
15627
+ }
15628
+ } else {
15629
+ self.frame = 0;
14933
15630
  }
14934
- self.frame = 0;
14935
15631
  if (sys) {
14936
15632
  ClientObituary(self, inflictor, attacker, mod, sys);
14937
15633
  }
@@ -14965,6 +15661,7 @@ function player_think(self, sys) {
14965
15661
  weaponItem.think(self, sys);
14966
15662
  }
14967
15663
  }
15664
+ P_PlayerThink(self, sys);
14968
15665
  self.nextthink = sys.timeSeconds + 0.1;
14969
15666
  sys.scheduleThink(self, self.nextthink);
14970
15667
  }
@@ -15311,7 +16008,7 @@ var WEAPONS = {
15311
16008
  };
15312
16009
 
15313
16010
  // src/index.ts
15314
- var ZERO_VEC37 = { x: 0, y: 0, z: 0 };
16011
+ var ZERO_VEC36 = { x: 0, y: 0, z: 0 };
15315
16012
  function createGame(imports, engine, options) {
15316
16013
  const gravity = options.gravity;
15317
16014
  const deathmatch = options.deathmatch ?? false;
@@ -15380,8 +16077,8 @@ function createGame(imports, engine, options) {
15380
16077
  };
15381
16078
  entities.runFrame();
15382
16079
  });
15383
- let origin = { ...ZERO_VEC37 };
15384
- let velocity = { ...ZERO_VEC37 };
16080
+ let origin = { ...ZERO_VEC36 };
16081
+ let velocity = { ...ZERO_VEC36 };
15385
16082
  const calculateBlend = (player, time) => {
15386
16083
  const blend = [0, 0, 0, 0];
15387
16084
  if (!player || !player.client) return blend;
@@ -15463,10 +16160,10 @@ function createGame(imports, engine, options) {
15463
16160
  // TODO
15464
16161
  damageIndicators: [],
15465
16162
  stats: player ? populatePlayerStats(player, levelClock.current.timeSeconds) : [],
15466
- kick_angles: player?.client?.kick_angles ?? ZERO_VEC37,
15467
- kick_origin: player?.client?.kick_origin ?? ZERO_VEC37,
15468
- gunoffset: ZERO_VEC37,
15469
- gunangles: ZERO_VEC37,
16163
+ kick_angles: player?.client?.kick_angles ?? ZERO_VEC36,
16164
+ kick_origin: player?.client?.kick_origin ?? ZERO_VEC36,
16165
+ gunoffset: ZERO_VEC36,
16166
+ gunangles: ZERO_VEC36,
15470
16167
  gunindex: 0,
15471
16168
  gun_frame: player?.client?.gun_frame ?? 0,
15472
16169
  rdflags: player?.client?.rdflags ?? 0,
@@ -15480,8 +16177,8 @@ function createGame(imports, engine, options) {
15480
16177
  const resetState = (startTimeMs) => {
15481
16178
  frameLoop.reset(startTimeMs);
15482
16179
  levelClock.start(startTimeMs);
15483
- origin = { ...ZERO_VEC37 };
15484
- velocity = { ...ZERO_VEC37 };
16180
+ origin = { ...ZERO_VEC36 };
16181
+ velocity = { ...ZERO_VEC36 };
15485
16182
  entities.beginFrame(startTimeMs / 1e3);
15486
16183
  entities.runFrame();
15487
16184
  };
@@ -15509,10 +16206,10 @@ function createGame(imports, engine, options) {
15509
16206
  blend: [0, 0, 0, 0],
15510
16207
  // Stubs
15511
16208
  stats: populatePlayerStats(player, levelClock.current.timeSeconds),
15512
- kick_angles: ZERO_VEC37,
15513
- kick_origin: ZERO_VEC37,
15514
- gunoffset: ZERO_VEC37,
15515
- gunangles: ZERO_VEC37,
16209
+ kick_angles: ZERO_VEC36,
16210
+ kick_origin: ZERO_VEC36,
16211
+ gunoffset: ZERO_VEC36,
16212
+ gunangles: ZERO_VEC36,
15516
16213
  gunindex: 0,
15517
16214
  pm_type: 0,
15518
16215
  pm_time: 0,
@@ -15570,6 +16267,9 @@ function createGame(imports, engine, options) {
15570
16267
  player.die = (self, inflictor, attacker, damage, point, mod) => {
15571
16268
  player_die(self, inflictor, attacker, damage, point, mod, entities);
15572
16269
  };
16270
+ player.pain = (self, other, kick, damage) => {
16271
+ player_pain(self, damage);
16272
+ };
15573
16273
  player.think = (self) => {
15574
16274
  player_think(self, entities);
15575
16275
  };
@@ -15639,8 +16339,8 @@ function createGame(imports, engine, options) {
15639
16339
  rng,
15640
16340
  player: player?.client?.inventory
15641
16341
  });
15642
- origin = player ? { ...player.origin } : { ...ZERO_VEC37 };
15643
- velocity = player ? { ...player.velocity } : { ...ZERO_VEC37 };
16342
+ origin = player ? { ...player.origin } : { ...ZERO_VEC36 };
16343
+ velocity = player ? { ...player.velocity } : { ...ZERO_VEC36 };
15644
16344
  frameLoop.reset(save.level.timeSeconds * 1e3);
15645
16345
  }
15646
16346
  };