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
|
@@ -9017,9 +9017,11 @@ function registerMakronSpawns(registry) {
|
|
|
9017
9017
|
// src/entities/monsters/medic.ts
|
|
9018
9018
|
var MONSTER_TICK15 = 0.1;
|
|
9019
9019
|
function monster_ai_stand15(self, dist, context) {
|
|
9020
|
-
if (
|
|
9021
|
-
self
|
|
9022
|
-
|
|
9020
|
+
if (self.classname === "monster_medic") {
|
|
9021
|
+
if (medic_find_dead(self, context)) {
|
|
9022
|
+
self.monsterinfo.current_move = run_move13;
|
|
9023
|
+
return;
|
|
9024
|
+
}
|
|
9023
9025
|
}
|
|
9024
9026
|
ai_stand(self, MONSTER_TICK15, context);
|
|
9025
9027
|
}
|
|
@@ -9027,8 +9029,12 @@ function monster_ai_walk15(self, dist, context) {
|
|
|
9027
9029
|
ai_walk(self, dist, MONSTER_TICK15, context);
|
|
9028
9030
|
}
|
|
9029
9031
|
function monster_ai_run14(self, dist, context) {
|
|
9030
|
-
if (
|
|
9031
|
-
self
|
|
9032
|
+
if (self.classname === "monster_medic") {
|
|
9033
|
+
if (medic_find_dead(self, context)) {
|
|
9034
|
+
self.monsterinfo.current_move = run_move13;
|
|
9035
|
+
} else {
|
|
9036
|
+
ai_run(self, dist, MONSTER_TICK15, context);
|
|
9037
|
+
}
|
|
9032
9038
|
} else {
|
|
9033
9039
|
ai_run(self, dist, MONSTER_TICK15, context);
|
|
9034
9040
|
}
|
|
@@ -9044,6 +9050,7 @@ var walk_move13;
|
|
|
9044
9050
|
var run_move13;
|
|
9045
9051
|
var attack_hyper_move;
|
|
9046
9052
|
var attack_cable_move;
|
|
9053
|
+
var spawn_move;
|
|
9047
9054
|
var pain_move8;
|
|
9048
9055
|
var death_move12;
|
|
9049
9056
|
function medic_stand(self) {
|
|
@@ -9053,11 +9060,13 @@ function medic_walk(self) {
|
|
|
9053
9060
|
self.monsterinfo.current_move = walk_move13;
|
|
9054
9061
|
}
|
|
9055
9062
|
function medic_run(self) {
|
|
9056
|
-
if (self.
|
|
9057
|
-
|
|
9058
|
-
|
|
9059
|
-
|
|
9060
|
-
|
|
9063
|
+
if (self.classname === "monster_medic") {
|
|
9064
|
+
if (self.enemy && self.enemy.deadflag === 2 /* Dead */) {
|
|
9065
|
+
const dist = rangeTo(self, self.enemy);
|
|
9066
|
+
if (dist < 80) {
|
|
9067
|
+
self.monsterinfo.current_move = attack_cable_move;
|
|
9068
|
+
return;
|
|
9069
|
+
}
|
|
9061
9070
|
}
|
|
9062
9071
|
}
|
|
9063
9072
|
if (self.enemy && self.enemy.health > 0) {
|
|
@@ -9067,10 +9076,16 @@ function medic_run(self) {
|
|
|
9067
9076
|
}
|
|
9068
9077
|
}
|
|
9069
9078
|
function medic_attack(self) {
|
|
9070
|
-
if (self.enemy && self.enemy.deadflag === 2 /* Dead */) {
|
|
9079
|
+
if (self.classname === "monster_medic" && self.enemy && self.enemy.deadflag === 2 /* Dead */) {
|
|
9071
9080
|
self.monsterinfo.current_move = attack_cable_move;
|
|
9072
9081
|
return;
|
|
9073
9082
|
}
|
|
9083
|
+
if (self.classname === "monster_medic_commander") {
|
|
9084
|
+
if (Math.random() < 0.2) {
|
|
9085
|
+
self.monsterinfo.current_move = spawn_move;
|
|
9086
|
+
return;
|
|
9087
|
+
}
|
|
9088
|
+
}
|
|
9074
9089
|
self.monsterinfo.current_move = attack_hyper_move;
|
|
9075
9090
|
}
|
|
9076
9091
|
function medic_fire_blaster(self, context) {
|
|
@@ -9109,7 +9124,6 @@ function medic_cable_attack(self, context) {
|
|
|
9109
9124
|
te: TempEntity.MEDIC_CABLE_ATTACK,
|
|
9110
9125
|
entId: self.index,
|
|
9111
9126
|
targetId: self.enemy.index,
|
|
9112
|
-
// Assuming targetId for the beam target
|
|
9113
9127
|
start,
|
|
9114
9128
|
end
|
|
9115
9129
|
});
|
|
@@ -9137,14 +9151,13 @@ function medic_hook_retract(self, context) {
|
|
|
9137
9151
|
if (ent.monsterinfo && ent.monsterinfo.stand) {
|
|
9138
9152
|
ent.monsterinfo.stand(ent, context);
|
|
9139
9153
|
}
|
|
9154
|
+
ent.bad_medic = self;
|
|
9140
9155
|
} else {
|
|
9141
9156
|
const spawnContext = {
|
|
9142
9157
|
entities: context,
|
|
9143
9158
|
keyValues: { classname: ent.classname },
|
|
9144
|
-
// Minimal keyvalues
|
|
9145
9159
|
warn: (msg) => {
|
|
9146
9160
|
},
|
|
9147
|
-
// Suppress warnings
|
|
9148
9161
|
free: (e) => context.free(e)
|
|
9149
9162
|
};
|
|
9150
9163
|
const origin = { ...ent.origin };
|
|
@@ -9192,6 +9205,44 @@ function medic_find_dead(self, context) {
|
|
|
9192
9205
|
}
|
|
9193
9206
|
return false;
|
|
9194
9207
|
}
|
|
9208
|
+
function medic_call_reinforcements(self, context) {
|
|
9209
|
+
const r = Math.random();
|
|
9210
|
+
let chosenClass = "monster_soldier_light";
|
|
9211
|
+
if (r > 0.8) {
|
|
9212
|
+
chosenClass = "monster_soldier_ssg";
|
|
9213
|
+
} else if (r > 0.5) {
|
|
9214
|
+
chosenClass = "monster_soldier";
|
|
9215
|
+
}
|
|
9216
|
+
const spawnFunc = context.getSpawnFunction(chosenClass);
|
|
9217
|
+
if (spawnFunc) {
|
|
9218
|
+
const vectors = angleVectors(self.angles);
|
|
9219
|
+
const forwardDist = scaleVec3(vectors.forward, 64);
|
|
9220
|
+
const spawnOrigin = addVec3(self.origin, forwardDist);
|
|
9221
|
+
const adjustedOrigin = { ...spawnOrigin, z: spawnOrigin.z + 8 };
|
|
9222
|
+
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);
|
|
9223
|
+
if (tr.fraction < 1 || tr.startsolid || tr.allsolid) {
|
|
9224
|
+
return;
|
|
9225
|
+
}
|
|
9226
|
+
const ent = context.spawn();
|
|
9227
|
+
ent.origin = adjustedOrigin;
|
|
9228
|
+
ent.angles = { ...self.angles };
|
|
9229
|
+
const spawnContext = {
|
|
9230
|
+
entities: context,
|
|
9231
|
+
keyValues: { classname: chosenClass },
|
|
9232
|
+
warn: () => {
|
|
9233
|
+
},
|
|
9234
|
+
free: (e) => context.free(e)
|
|
9235
|
+
};
|
|
9236
|
+
spawnFunc(ent, spawnContext);
|
|
9237
|
+
ent.enemy = self.enemy;
|
|
9238
|
+
context.multicast(adjustedOrigin, 1 /* Pvs */, ServerCommand.muzzleflash, {
|
|
9239
|
+
entId: ent.index,
|
|
9240
|
+
flash_number: 0
|
|
9241
|
+
// generic flash
|
|
9242
|
+
});
|
|
9243
|
+
context.engine.sound?.(self, 0, "medic/medatck2.wav", 1, 1, 0);
|
|
9244
|
+
}
|
|
9245
|
+
}
|
|
9195
9246
|
function medic_die(self) {
|
|
9196
9247
|
self.monsterinfo.current_move = death_move12;
|
|
9197
9248
|
}
|
|
@@ -9253,8 +9304,6 @@ var attack_cable_frames = [
|
|
|
9253
9304
|
];
|
|
9254
9305
|
attack_cable_move = {
|
|
9255
9306
|
firstframe: 106,
|
|
9256
|
-
// FRAME_attack42 (starts at 0+30+40+20+16 = 106) ... wait, check original counts.
|
|
9257
|
-
// stand=30, walk=40, run=20, hyper=16. 30+40+20+16 = 106. Correct.
|
|
9258
9307
|
lastframe: 114,
|
|
9259
9308
|
frames: attack_cable_frames,
|
|
9260
9309
|
endfunc: medic_run
|
|
@@ -9269,13 +9318,25 @@ pain_move8 = {
|
|
|
9269
9318
|
frames: pain_frames8,
|
|
9270
9319
|
endfunc: medic_run
|
|
9271
9320
|
};
|
|
9272
|
-
var
|
|
9321
|
+
var spawn_frames = Array.from({ length: 23 }, (_, i) => ({
|
|
9322
|
+
ai: monster_ai_move15,
|
|
9323
|
+
dist: 0,
|
|
9324
|
+
think: i === 11 ? medic_call_reinforcements : null
|
|
9325
|
+
// Trigger halfway
|
|
9326
|
+
}));
|
|
9327
|
+
spawn_move = {
|
|
9328
|
+
firstframe: 122,
|
|
9329
|
+
lastframe: 144,
|
|
9330
|
+
frames: spawn_frames,
|
|
9331
|
+
endfunc: medic_run
|
|
9332
|
+
};
|
|
9333
|
+
var death_frames12 = Array.from({ length: 30 }, () => ({
|
|
9273
9334
|
ai: monster_ai_move15,
|
|
9274
9335
|
dist: 0
|
|
9275
9336
|
}));
|
|
9276
9337
|
death_move12 = {
|
|
9277
|
-
firstframe:
|
|
9278
|
-
lastframe:
|
|
9338
|
+
firstframe: 161,
|
|
9339
|
+
lastframe: 190,
|
|
9279
9340
|
frames: death_frames12,
|
|
9280
9341
|
endfunc: medic_dead
|
|
9281
9342
|
};
|
|
@@ -9293,6 +9354,10 @@ function SP_monster_medic(self, context) {
|
|
|
9293
9354
|
self.pain = (self2, other, kick, damage) => {
|
|
9294
9355
|
if (self2.health < self2.max_health / 2) {
|
|
9295
9356
|
self2.monsterinfo.current_move = pain_move8;
|
|
9357
|
+
if (Math.random() < 0.5) {
|
|
9358
|
+
const sound = self2.classname === "monster_medic_commander" ? "medic/medpain2.wav" : "medic/medpain1.wav";
|
|
9359
|
+
context.entities.sound?.(self2, 0, sound, 1, 1, 0);
|
|
9360
|
+
}
|
|
9296
9361
|
}
|
|
9297
9362
|
};
|
|
9298
9363
|
self.die = (self2, inflictor, attacker, damage, point) => {
|
|
@@ -9313,8 +9378,16 @@ function SP_monster_medic(self, context) {
|
|
|
9313
9378
|
medic_stand(self);
|
|
9314
9379
|
self.nextthink = self.timestamp + MONSTER_TICK15;
|
|
9315
9380
|
}
|
|
9381
|
+
function SP_monster_medic_commander(self, context) {
|
|
9382
|
+
SP_monster_medic(self, context);
|
|
9383
|
+
self.classname = "monster_medic_commander";
|
|
9384
|
+
self.health = 600;
|
|
9385
|
+
self.max_health = 600;
|
|
9386
|
+
self.skin = 1;
|
|
9387
|
+
}
|
|
9316
9388
|
function registerMedicSpawns(registry) {
|
|
9317
9389
|
registry.register("monster_medic", SP_monster_medic);
|
|
9390
|
+
registry.register("monster_medic_commander", SP_monster_medic_commander);
|
|
9318
9391
|
}
|
|
9319
9392
|
|
|
9320
9393
|
// src/entities/monsters/mutant.ts
|