quake2ts 0.0.186 → 0.0.187
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/client/dist/browser/index.global.js +5 -5
- package/packages/client/dist/browser/index.global.js.map +1 -1
- package/packages/game/dist/browser/index.global.js +2 -2
- package/packages/game/dist/browser/index.global.js.map +1 -1
- package/packages/game/dist/cjs/index.cjs +92 -19
- package/packages/game/dist/cjs/index.cjs.map +1 -1
- package/packages/game/dist/esm/index.js +92 -19
- package/packages/game/dist/esm/index.js.map +1 -1
- package/packages/game/dist/tsconfig.tsbuildinfo +1 -1
- package/packages/game/dist/types/entities/monsters/medic.d.ts +1 -0
- package/packages/game/dist/types/entities/monsters/medic.d.ts.map +1 -1
|
@@ -9183,9 +9183,11 @@ function registerMakronSpawns(registry) {
|
|
|
9183
9183
|
// src/entities/monsters/medic.ts
|
|
9184
9184
|
var MONSTER_TICK15 = 0.1;
|
|
9185
9185
|
function monster_ai_stand15(self, dist, context) {
|
|
9186
|
-
if (
|
|
9187
|
-
self
|
|
9188
|
-
|
|
9186
|
+
if (self.classname === "monster_medic") {
|
|
9187
|
+
if (medic_find_dead(self, context)) {
|
|
9188
|
+
self.monsterinfo.current_move = run_move13;
|
|
9189
|
+
return;
|
|
9190
|
+
}
|
|
9189
9191
|
}
|
|
9190
9192
|
ai_stand(self, MONSTER_TICK15, context);
|
|
9191
9193
|
}
|
|
@@ -9193,8 +9195,12 @@ function monster_ai_walk15(self, dist, context) {
|
|
|
9193
9195
|
ai_walk(self, dist, MONSTER_TICK15, context);
|
|
9194
9196
|
}
|
|
9195
9197
|
function monster_ai_run14(self, dist, context) {
|
|
9196
|
-
if (
|
|
9197
|
-
self
|
|
9198
|
+
if (self.classname === "monster_medic") {
|
|
9199
|
+
if (medic_find_dead(self, context)) {
|
|
9200
|
+
self.monsterinfo.current_move = run_move13;
|
|
9201
|
+
} else {
|
|
9202
|
+
ai_run(self, dist, MONSTER_TICK15, context);
|
|
9203
|
+
}
|
|
9198
9204
|
} else {
|
|
9199
9205
|
ai_run(self, dist, MONSTER_TICK15, context);
|
|
9200
9206
|
}
|
|
@@ -9210,6 +9216,7 @@ var walk_move13;
|
|
|
9210
9216
|
var run_move13;
|
|
9211
9217
|
var attack_hyper_move;
|
|
9212
9218
|
var attack_cable_move;
|
|
9219
|
+
var spawn_move;
|
|
9213
9220
|
var pain_move8;
|
|
9214
9221
|
var death_move12;
|
|
9215
9222
|
function medic_stand(self) {
|
|
@@ -9219,11 +9226,13 @@ function medic_walk(self) {
|
|
|
9219
9226
|
self.monsterinfo.current_move = walk_move13;
|
|
9220
9227
|
}
|
|
9221
9228
|
function medic_run(self) {
|
|
9222
|
-
if (self.
|
|
9223
|
-
|
|
9224
|
-
|
|
9225
|
-
|
|
9226
|
-
|
|
9229
|
+
if (self.classname === "monster_medic") {
|
|
9230
|
+
if (self.enemy && self.enemy.deadflag === 2 /* Dead */) {
|
|
9231
|
+
const dist = rangeTo(self, self.enemy);
|
|
9232
|
+
if (dist < 80) {
|
|
9233
|
+
self.monsterinfo.current_move = attack_cable_move;
|
|
9234
|
+
return;
|
|
9235
|
+
}
|
|
9227
9236
|
}
|
|
9228
9237
|
}
|
|
9229
9238
|
if (self.enemy && self.enemy.health > 0) {
|
|
@@ -9233,10 +9242,16 @@ function medic_run(self) {
|
|
|
9233
9242
|
}
|
|
9234
9243
|
}
|
|
9235
9244
|
function medic_attack(self) {
|
|
9236
|
-
if (self.enemy && self.enemy.deadflag === 2 /* Dead */) {
|
|
9245
|
+
if (self.classname === "monster_medic" && self.enemy && self.enemy.deadflag === 2 /* Dead */) {
|
|
9237
9246
|
self.monsterinfo.current_move = attack_cable_move;
|
|
9238
9247
|
return;
|
|
9239
9248
|
}
|
|
9249
|
+
if (self.classname === "monster_medic_commander") {
|
|
9250
|
+
if (Math.random() < 0.2) {
|
|
9251
|
+
self.monsterinfo.current_move = spawn_move;
|
|
9252
|
+
return;
|
|
9253
|
+
}
|
|
9254
|
+
}
|
|
9240
9255
|
self.monsterinfo.current_move = attack_hyper_move;
|
|
9241
9256
|
}
|
|
9242
9257
|
function medic_fire_blaster(self, context) {
|
|
@@ -9275,7 +9290,6 @@ function medic_cable_attack(self, context) {
|
|
|
9275
9290
|
te: TempEntity.MEDIC_CABLE_ATTACK,
|
|
9276
9291
|
entId: self.index,
|
|
9277
9292
|
targetId: self.enemy.index,
|
|
9278
|
-
// Assuming targetId for the beam target
|
|
9279
9293
|
start,
|
|
9280
9294
|
end
|
|
9281
9295
|
});
|
|
@@ -9303,14 +9317,13 @@ function medic_hook_retract(self, context) {
|
|
|
9303
9317
|
if (ent.monsterinfo && ent.monsterinfo.stand) {
|
|
9304
9318
|
ent.monsterinfo.stand(ent, context);
|
|
9305
9319
|
}
|
|
9320
|
+
ent.bad_medic = self;
|
|
9306
9321
|
} else {
|
|
9307
9322
|
const spawnContext = {
|
|
9308
9323
|
entities: context,
|
|
9309
9324
|
keyValues: { classname: ent.classname },
|
|
9310
|
-
// Minimal keyvalues
|
|
9311
9325
|
warn: (msg) => {
|
|
9312
9326
|
},
|
|
9313
|
-
// Suppress warnings
|
|
9314
9327
|
free: (e) => context.free(e)
|
|
9315
9328
|
};
|
|
9316
9329
|
const origin = { ...ent.origin };
|
|
@@ -9358,6 +9371,44 @@ function medic_find_dead(self, context) {
|
|
|
9358
9371
|
}
|
|
9359
9372
|
return false;
|
|
9360
9373
|
}
|
|
9374
|
+
function medic_call_reinforcements(self, context) {
|
|
9375
|
+
const r = Math.random();
|
|
9376
|
+
let chosenClass = "monster_soldier_light";
|
|
9377
|
+
if (r > 0.8) {
|
|
9378
|
+
chosenClass = "monster_soldier_ssg";
|
|
9379
|
+
} else if (r > 0.5) {
|
|
9380
|
+
chosenClass = "monster_soldier";
|
|
9381
|
+
}
|
|
9382
|
+
const spawnFunc = context.getSpawnFunction(chosenClass);
|
|
9383
|
+
if (spawnFunc) {
|
|
9384
|
+
const vectors = angleVectors(self.angles);
|
|
9385
|
+
const forwardDist = scaleVec3(vectors.forward, 64);
|
|
9386
|
+
const spawnOrigin = addVec3(self.origin, forwardDist);
|
|
9387
|
+
const adjustedOrigin = { ...spawnOrigin, z: spawnOrigin.z + 8 };
|
|
9388
|
+
const tr = context.trace(self.origin, { x: -16, y: -16, z: -24 }, { x: 16, y: 16, z: 32 }, adjustedOrigin, self, CONTENTS_SOLID | CONTENTS_MONSTER | CONTENTS_DEADMONSTER);
|
|
9389
|
+
if (tr.fraction < 1 || tr.startsolid || tr.allsolid) {
|
|
9390
|
+
return;
|
|
9391
|
+
}
|
|
9392
|
+
const ent = context.spawn();
|
|
9393
|
+
ent.origin = adjustedOrigin;
|
|
9394
|
+
ent.angles = { ...self.angles };
|
|
9395
|
+
const spawnContext = {
|
|
9396
|
+
entities: context,
|
|
9397
|
+
keyValues: { classname: chosenClass },
|
|
9398
|
+
warn: () => {
|
|
9399
|
+
},
|
|
9400
|
+
free: (e) => context.free(e)
|
|
9401
|
+
};
|
|
9402
|
+
spawnFunc(ent, spawnContext);
|
|
9403
|
+
ent.enemy = self.enemy;
|
|
9404
|
+
context.multicast(adjustedOrigin, 1 /* Pvs */, ServerCommand.muzzleflash, {
|
|
9405
|
+
entId: ent.index,
|
|
9406
|
+
flash_number: 0
|
|
9407
|
+
// generic flash
|
|
9408
|
+
});
|
|
9409
|
+
context.engine.sound?.(self, 0, "medic/medatck2.wav", 1, 1, 0);
|
|
9410
|
+
}
|
|
9411
|
+
}
|
|
9361
9412
|
function medic_die(self) {
|
|
9362
9413
|
self.monsterinfo.current_move = death_move12;
|
|
9363
9414
|
}
|
|
@@ -9419,8 +9470,6 @@ var attack_cable_frames = [
|
|
|
9419
9470
|
];
|
|
9420
9471
|
attack_cable_move = {
|
|
9421
9472
|
firstframe: 106,
|
|
9422
|
-
// FRAME_attack42 (starts at 0+30+40+20+16 = 106) ... wait, check original counts.
|
|
9423
|
-
// stand=30, walk=40, run=20, hyper=16. 30+40+20+16 = 106. Correct.
|
|
9424
9473
|
lastframe: 114,
|
|
9425
9474
|
frames: attack_cable_frames,
|
|
9426
9475
|
endfunc: medic_run
|
|
@@ -9435,13 +9484,25 @@ pain_move8 = {
|
|
|
9435
9484
|
frames: pain_frames8,
|
|
9436
9485
|
endfunc: medic_run
|
|
9437
9486
|
};
|
|
9438
|
-
var
|
|
9487
|
+
var spawn_frames = Array.from({ length: 23 }, (_, i) => ({
|
|
9488
|
+
ai: monster_ai_move15,
|
|
9489
|
+
dist: 0,
|
|
9490
|
+
think: i === 11 ? medic_call_reinforcements : null
|
|
9491
|
+
// Trigger halfway
|
|
9492
|
+
}));
|
|
9493
|
+
spawn_move = {
|
|
9494
|
+
firstframe: 122,
|
|
9495
|
+
lastframe: 144,
|
|
9496
|
+
frames: spawn_frames,
|
|
9497
|
+
endfunc: medic_run
|
|
9498
|
+
};
|
|
9499
|
+
var death_frames12 = Array.from({ length: 30 }, () => ({
|
|
9439
9500
|
ai: monster_ai_move15,
|
|
9440
9501
|
dist: 0
|
|
9441
9502
|
}));
|
|
9442
9503
|
death_move12 = {
|
|
9443
|
-
firstframe:
|
|
9444
|
-
lastframe:
|
|
9504
|
+
firstframe: 161,
|
|
9505
|
+
lastframe: 190,
|
|
9445
9506
|
frames: death_frames12,
|
|
9446
9507
|
endfunc: medic_dead
|
|
9447
9508
|
};
|
|
@@ -9459,6 +9520,10 @@ function SP_monster_medic(self, context) {
|
|
|
9459
9520
|
self.pain = (self2, other, kick, damage) => {
|
|
9460
9521
|
if (self2.health < self2.max_health / 2) {
|
|
9461
9522
|
self2.monsterinfo.current_move = pain_move8;
|
|
9523
|
+
if (Math.random() < 0.5) {
|
|
9524
|
+
const sound = self2.classname === "monster_medic_commander" ? "medic/medpain2.wav" : "medic/medpain1.wav";
|
|
9525
|
+
context.entities.sound?.(self2, 0, sound, 1, 1, 0);
|
|
9526
|
+
}
|
|
9462
9527
|
}
|
|
9463
9528
|
};
|
|
9464
9529
|
self.die = (self2, inflictor, attacker, damage, point) => {
|
|
@@ -9479,8 +9544,16 @@ function SP_monster_medic(self, context) {
|
|
|
9479
9544
|
medic_stand(self);
|
|
9480
9545
|
self.nextthink = self.timestamp + MONSTER_TICK15;
|
|
9481
9546
|
}
|
|
9547
|
+
function SP_monster_medic_commander(self, context) {
|
|
9548
|
+
SP_monster_medic(self, context);
|
|
9549
|
+
self.classname = "monster_medic_commander";
|
|
9550
|
+
self.health = 600;
|
|
9551
|
+
self.max_health = 600;
|
|
9552
|
+
self.skin = 1;
|
|
9553
|
+
}
|
|
9482
9554
|
function registerMedicSpawns(registry) {
|
|
9483
9555
|
registry.register("monster_medic", SP_monster_medic);
|
|
9556
|
+
registry.register("monster_medic_commander", SP_monster_medic_commander);
|
|
9484
9557
|
}
|
|
9485
9558
|
|
|
9486
9559
|
// src/entities/monsters/mutant.ts
|