quake2ts 0.0.214 → 0.0.216
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 +10 -10
- 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 +26 -22
- package/packages/game/dist/cjs/index.cjs.map +1 -1
- package/packages/game/dist/esm/index.js +26 -22
- 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/berserk.d.ts.map +1 -1
- package/packages/server/dist/index.cjs +51 -1
- package/packages/server/dist/index.d.cts +2 -0
- package/packages/server/dist/index.d.ts +2 -0
- package/packages/server/dist/index.js +52 -2
|
@@ -5470,6 +5470,7 @@ function throwGibs(sys, origin, damage) {
|
|
|
5470
5470
|
// src/entities/monsters/berserk.ts
|
|
5471
5471
|
var MONSTER_TICK = 0.1;
|
|
5472
5472
|
var MELEE_DISTANCE = 80;
|
|
5473
|
+
var SPAWNFLAG_BERSERK_NOJUMPING = 16;
|
|
5473
5474
|
var random2 = createRandomGenerator();
|
|
5474
5475
|
function frandom() {
|
|
5475
5476
|
return random2.frandom();
|
|
@@ -5691,6 +5692,25 @@ berserk_move_attack_club = {
|
|
|
5691
5692
|
frames: berserk_frames_attack_club,
|
|
5692
5693
|
endfunc: berserk_run
|
|
5693
5694
|
};
|
|
5695
|
+
function T_SlamRadiusDamage(inflictor, attacker, damage, radius, kick, context) {
|
|
5696
|
+
const entities = context.findByRadius(inflictor.origin, radius);
|
|
5697
|
+
for (const ent of entities) {
|
|
5698
|
+
if (ent === inflictor) continue;
|
|
5699
|
+
if (!ent.takedamage) continue;
|
|
5700
|
+
const dist = Math.sqrt(
|
|
5701
|
+
Math.pow(ent.origin.x - inflictor.origin.x, 2) + Math.pow(ent.origin.y - inflictor.origin.y, 2) + Math.pow(ent.origin.z - inflictor.origin.z, 2)
|
|
5702
|
+
);
|
|
5703
|
+
const amount = Math.max(0, 1 - dist / radius);
|
|
5704
|
+
if (amount <= 0) continue;
|
|
5705
|
+
const points = Math.max(1, damage * amount * amount);
|
|
5706
|
+
const k = kick * amount * amount;
|
|
5707
|
+
const dir = normalizeVec3(subtractVec3(ent.origin, inflictor.origin));
|
|
5708
|
+
T_Damage(ent, inflictor, attacker, dir, ent.origin, dir, points, k, 1 /* RADIUS */, 0 /* UNKNOWN */, context.timeSeconds, context.multicast.bind(context));
|
|
5709
|
+
if (ent.client) {
|
|
5710
|
+
ent.velocity = { ...ent.velocity, z: Math.max(270, ent.velocity.z) };
|
|
5711
|
+
}
|
|
5712
|
+
}
|
|
5713
|
+
}
|
|
5694
5714
|
function berserk_attack_slam(self, context) {
|
|
5695
5715
|
context.sound(self, 1, SOUNDS.thud, 1, 1, 0);
|
|
5696
5716
|
context.sound(self, 2, SOUNDS.explod, 0.75, 1, 0);
|
|
@@ -5705,34 +5725,17 @@ function berserk_attack_slam(self, context) {
|
|
|
5705
5725
|
context.multicast(tr.endpos, 2 /* Phs */, ServerCommand.temp_entity, TempEntity.BERSERK_SLAM, tr.endpos);
|
|
5706
5726
|
self.gravity = 1;
|
|
5707
5727
|
self.velocity = { x: 0, y: 0, z: 0 };
|
|
5708
|
-
|
|
5709
|
-
const kick = 300;
|
|
5710
|
-
const radius = 165;
|
|
5711
|
-
const entities = context.findByRadius(tr.endpos, radius * 2);
|
|
5712
|
-
for (const ent of entities) {
|
|
5713
|
-
if (ent === self) continue;
|
|
5714
|
-
if (!ent.takedamage) continue;
|
|
5715
|
-
const dist = Math.sqrt(
|
|
5716
|
-
Math.pow(ent.origin.x - tr.endpos.x, 2) + Math.pow(ent.origin.y - tr.endpos.y, 2) + Math.pow(ent.origin.z - tr.endpos.z, 2)
|
|
5717
|
-
);
|
|
5718
|
-
const amount = Math.max(0, 1 - dist / radius);
|
|
5719
|
-
if (amount <= 0) continue;
|
|
5720
|
-
const points = Math.max(1, damage * amount * amount);
|
|
5721
|
-
const k = kick * amount * amount;
|
|
5722
|
-
const dir = normalizeVec3(subtractVec3(ent.origin, tr.endpos));
|
|
5723
|
-
T_Damage(ent, self, self, dir, ent.origin, dir, points, k, 1 /* RADIUS */, 0 /* UNKNOWN */, context.timeSeconds, context.multicast.bind(context));
|
|
5724
|
-
if (ent.client) {
|
|
5725
|
-
const currentVel = { ...ent.velocity };
|
|
5726
|
-
currentVel.z = Math.max(270, currentVel.z);
|
|
5727
|
-
ent.velocity = currentVel;
|
|
5728
|
-
}
|
|
5729
|
-
}
|
|
5728
|
+
T_SlamRadiusDamage(self, self, 8, 165, 300, context);
|
|
5730
5729
|
}
|
|
5731
5730
|
function berserk_jump_touch(self, other, plane, surf, context) {
|
|
5732
5731
|
if (self.health <= 0) {
|
|
5733
5732
|
self.touch = void 0;
|
|
5734
5733
|
return;
|
|
5735
5734
|
}
|
|
5735
|
+
if (other && other.takedamage) {
|
|
5736
|
+
self.touch = void 0;
|
|
5737
|
+
berserk_attack_slam(self, context);
|
|
5738
|
+
}
|
|
5736
5739
|
}
|
|
5737
5740
|
function berserk_high_gravity(self, context) {
|
|
5738
5741
|
const base = 800;
|
|
@@ -5832,6 +5835,7 @@ function berserk_attack(self, context) {
|
|
|
5832
5835
|
if ((self.monsterinfo.melee_debounce_time || 0) <= context.timeSeconds && dist < MELEE_DISTANCE) {
|
|
5833
5836
|
berserk_melee(self, context);
|
|
5834
5837
|
} else if (self.timestamp < context.timeSeconds && brandom() && dist > 150) {
|
|
5838
|
+
if (self.spawnflags & SPAWNFLAG_BERSERK_NOJUMPING) return;
|
|
5835
5839
|
M_SetAnimation(self, berserk_move_attack_strike);
|
|
5836
5840
|
context.sound(self, 1, SOUNDS.jump, 1, 1, 0);
|
|
5837
5841
|
self.timestamp = context.timeSeconds + 5;
|