quake2ts 0.0.441 → 0.0.442
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 +9 -9
- package/packages/client/dist/browser/index.global.js.map +1 -1
- package/packages/client/dist/tsconfig.tsbuildinfo +1 -1
- package/packages/engine/dist/tsconfig.tsbuildinfo +1 -1
- package/packages/engine/dist/types/editor/bsp-inspector.d.ts +1 -0
- package/packages/engine/dist/types/editor/bsp-inspector.d.ts.map +1 -1
- package/packages/game/dist/browser/index.global.js +4 -4
- package/packages/game/dist/browser/index.global.js.map +1 -1
- package/packages/game/dist/cjs/index.cjs +142 -2
- package/packages/game/dist/cjs/index.cjs.map +1 -1
- package/packages/game/dist/esm/index.js +138 -2
- package/packages/game/dist/esm/index.js.map +1 -1
- package/packages/game/dist/tsconfig.tsbuildinfo +1 -1
- package/packages/game/dist/types/ai/constants.d.ts +6 -0
- package/packages/game/dist/types/ai/constants.d.ts.map +1 -1
- package/packages/game/dist/types/ai/movement.d.ts +9 -0
- package/packages/game/dist/types/ai/movement.d.ts.map +1 -1
- package/packages/game/dist/types/editor/analysis.d.ts +20 -0
- package/packages/game/dist/types/editor/analysis.d.ts.map +1 -0
- package/packages/game/dist/types/editor/selection.d.ts.map +1 -1
- package/packages/game/dist/types/entities/entity.d.ts +5 -0
- package/packages/game/dist/types/entities/entity.d.ts.map +1 -1
|
@@ -2487,6 +2487,7 @@ __export(index_exports, {
|
|
|
2487
2487
|
FLAG_ITEMS: () => FLAG_ITEMS,
|
|
2488
2488
|
FL_NOTARGET: () => FL_NOTARGET,
|
|
2489
2489
|
FL_NOVISIBLE: () => FL_NOVISIBLE,
|
|
2490
|
+
G_IdealHoverPosition: () => G_IdealHoverPosition,
|
|
2490
2491
|
HEALTH_ITEMS: () => HEALTH_ITEMS,
|
|
2491
2492
|
KEY_ITEMS: () => KEY_ITEMS,
|
|
2492
2493
|
KeyId: () => KeyId,
|
|
@@ -2500,6 +2501,8 @@ __export(index_exports, {
|
|
|
2500
2501
|
M_MoveStep: () => M_MoveStep,
|
|
2501
2502
|
M_MoveToGoal: () => M_MoveToGoal,
|
|
2502
2503
|
M_MoveToPath: () => M_MoveToPath,
|
|
2504
|
+
M_droptofloor: () => M_droptofloor,
|
|
2505
|
+
M_droptofloor_generic: () => M_droptofloor_generic,
|
|
2503
2506
|
M_walkmove: () => M_walkmove,
|
|
2504
2507
|
MonsterAttackState: () => MonsterAttackState,
|
|
2505
2508
|
MoveType: () => MoveType,
|
|
@@ -2522,6 +2525,7 @@ __export(index_exports, {
|
|
|
2522
2525
|
SPAWNFLAG_MONSTER_AMBUSH: () => SPAWNFLAG_MONSTER_AMBUSH,
|
|
2523
2526
|
SV_NewChaseDir: () => SV_NewChaseDir,
|
|
2524
2527
|
SV_StepDirection: () => SV_StepDirection,
|
|
2528
|
+
SV_flystep: () => SV_flystep,
|
|
2525
2529
|
SaveStorage: () => SaveStorage,
|
|
2526
2530
|
ServerFlags: () => ServerFlags,
|
|
2527
2531
|
Solid: () => Solid,
|
|
@@ -2788,7 +2792,13 @@ var AIFlags = /* @__PURE__ */ ((AIFlags2) => {
|
|
|
2788
2792
|
AIFlags2[AIFlags2["CombatPoint"] = 8192] = "CombatPoint";
|
|
2789
2793
|
AIFlags2[AIFlags2["Medic"] = 16384] = "Medic";
|
|
2790
2794
|
AIFlags2[AIFlags2["Resurrecting"] = 32768] = "Resurrecting";
|
|
2795
|
+
AIFlags2[AIFlags2["SpawnedCarrier"] = 65536] = "SpawnedCarrier";
|
|
2796
|
+
AIFlags2[AIFlags2["IgnoreShots"] = 131072] = "IgnoreShots";
|
|
2797
|
+
AIFlags2[AIFlags2["AlternateFly"] = 262144] = "AlternateFly";
|
|
2791
2798
|
AIFlags2[AIFlags2["Dodging"] = 524288] = "Dodging";
|
|
2799
|
+
AIFlags2[AIFlags2["SpawnedMedicC"] = 8388608] = "SpawnedMedicC";
|
|
2800
|
+
AIFlags2[AIFlags2["HintPath"] = 16777216] = "HintPath";
|
|
2801
|
+
AIFlags2[AIFlags2["Blocked"] = 33554432] = "Blocked";
|
|
2792
2802
|
AIFlags2[AIFlags2["Pathing"] = 1073741824] = "Pathing";
|
|
2793
2803
|
return AIFlags2;
|
|
2794
2804
|
})(AIFlags || {});
|
|
@@ -3834,7 +3844,7 @@ function M_MoveStep(self, move, relink, context) {
|
|
|
3834
3844
|
return true;
|
|
3835
3845
|
}
|
|
3836
3846
|
if ((self.flags & (2 /* Swim */ | 1 /* Fly */)) !== 0) {
|
|
3837
|
-
return
|
|
3847
|
+
return SV_flystep(self, move, relink, context);
|
|
3838
3848
|
}
|
|
3839
3849
|
const oldOrigin = { ...self.origin };
|
|
3840
3850
|
const up = { ...self.origin, z: self.origin.z + STEPSIZE };
|
|
@@ -3876,7 +3886,9 @@ function M_MoveStep(self, move, relink, context) {
|
|
|
3876
3886
|
}
|
|
3877
3887
|
function M_walkmove(self, yawDegrees, distance4, context) {
|
|
3878
3888
|
const delta = yawVector(yawDegrees, distance4);
|
|
3879
|
-
|
|
3889
|
+
const retval = M_MoveStep(self, delta, true, context);
|
|
3890
|
+
self.monsterinfo.aiflags &= ~33554432 /* Blocked */;
|
|
3891
|
+
return retval;
|
|
3880
3892
|
}
|
|
3881
3893
|
function SV_StepDirection(self, yaw, dist, context) {
|
|
3882
3894
|
for (let i = 0; i <= 90; i += 45) {
|
|
@@ -3953,6 +3965,130 @@ function M_MoveToGoal(self, dist, context) {
|
|
|
3953
3965
|
}
|
|
3954
3966
|
return true;
|
|
3955
3967
|
}
|
|
3968
|
+
function G_IdealHoverPosition(ent, context) {
|
|
3969
|
+
if (!ent.enemy && !(ent.monsterinfo.aiflags & 16384 /* Medic */) || ent.monsterinfo.aiflags & (8192 /* CombatPoint */ | 4 /* SoundTarget */ | 16777216 /* HintPath */ | 1073741824 /* Pathing */)) {
|
|
3970
|
+
return { x: 0, y: 0, z: 0 };
|
|
3971
|
+
}
|
|
3972
|
+
const theta = context.rng.frandom() * 2 * Math.PI;
|
|
3973
|
+
let phi;
|
|
3974
|
+
if (ent.monsterinfo.fly_above) {
|
|
3975
|
+
phi = Math.acos(0.7 + context.rng.frandom() * 0.3);
|
|
3976
|
+
} else if (ent.monsterinfo.fly_buzzard || ent.monsterinfo.aiflags & 16384 /* Medic */) {
|
|
3977
|
+
phi = Math.acos(context.rng.frandom());
|
|
3978
|
+
} else {
|
|
3979
|
+
phi = Math.acos(context.rng.crandom() * 0.06);
|
|
3980
|
+
}
|
|
3981
|
+
const sinPhi = Math.sin(phi);
|
|
3982
|
+
const d = {
|
|
3983
|
+
x: sinPhi * Math.cos(theta),
|
|
3984
|
+
y: sinPhi * Math.sin(theta),
|
|
3985
|
+
z: Math.cos(phi)
|
|
3986
|
+
};
|
|
3987
|
+
const minDist = ent.monsterinfo.fly_min_distance ?? 0;
|
|
3988
|
+
const maxDist = ent.monsterinfo.fly_max_distance ?? 0;
|
|
3989
|
+
const dist = minDist + context.rng.frandom() * (maxDist - minDist);
|
|
3990
|
+
return scaleVec3(d, dist);
|
|
3991
|
+
}
|
|
3992
|
+
function SV_flystep(ent, move, relink, context) {
|
|
3993
|
+
if (ent.monsterinfo.aiflags & 262144 /* AlternateFly */) {
|
|
3994
|
+
}
|
|
3995
|
+
const oldOrg = { ...ent.origin };
|
|
3996
|
+
let minheight = 40;
|
|
3997
|
+
if (ent.classname === "monster_carrier") minheight = 104;
|
|
3998
|
+
for (let i = 0; i < 2; i++) {
|
|
3999
|
+
let newMove = { ...move };
|
|
4000
|
+
if (i === 0 && ent.enemy) {
|
|
4001
|
+
let goalEntity = ent.goalentity;
|
|
4002
|
+
if (!goalEntity) goalEntity = ent.enemy;
|
|
4003
|
+
let goalPos = goalEntity.origin;
|
|
4004
|
+
if (ent.monsterinfo.aiflags & 1073741824 /* Pathing */ && ent.monsterinfo.nav_path) {
|
|
4005
|
+
goalPos = ent.monsterinfo.nav_path.firstMovePoint;
|
|
4006
|
+
}
|
|
4007
|
+
const dz = ent.origin.z - goalPos.z;
|
|
4008
|
+
const dist = lengthVec3(move);
|
|
4009
|
+
if (goalEntity.client) {
|
|
4010
|
+
if (dz > minheight) {
|
|
4011
|
+
newMove = scaleVec3(newMove, 0.5);
|
|
4012
|
+
newMove.z -= dist;
|
|
4013
|
+
}
|
|
4014
|
+
if (!(ent.flags & 2 /* Swim */ && ent.waterlevel < 2)) {
|
|
4015
|
+
if (dz < minheight - 10) {
|
|
4016
|
+
newMove = scaleVec3(newMove, 0.5);
|
|
4017
|
+
newMove.z += dist;
|
|
4018
|
+
}
|
|
4019
|
+
}
|
|
4020
|
+
} else {
|
|
4021
|
+
if (ent.classname === "monster_fixbot") {
|
|
4022
|
+
} else {
|
|
4023
|
+
if (dz > 0) {
|
|
4024
|
+
newMove = scaleVec3(newMove, 0.5);
|
|
4025
|
+
newMove.z -= Math.min(dist, dz);
|
|
4026
|
+
} else if (dz < 0) {
|
|
4027
|
+
newMove = scaleVec3(newMove, 0.5);
|
|
4028
|
+
newMove.z += -Math.max(-dist, dz);
|
|
4029
|
+
}
|
|
4030
|
+
}
|
|
4031
|
+
}
|
|
4032
|
+
}
|
|
4033
|
+
const newOrg = addVec3(ent.origin, newMove);
|
|
4034
|
+
const trace = context.trace(ent.origin, ent.mins, ent.maxs, newOrg, ent, MASK_MONSTERSOLID);
|
|
4035
|
+
if (ent.flags & 1 /* Fly */) {
|
|
4036
|
+
if (!ent.waterlevel) {
|
|
4037
|
+
const test = { x: trace.endpos.x, y: trace.endpos.y, z: trace.endpos.z + ent.mins.z + 1 };
|
|
4038
|
+
if (context.pointcontents(test) & MASK_WATER) return false;
|
|
4039
|
+
}
|
|
4040
|
+
}
|
|
4041
|
+
if (ent.flags & 2 /* Swim */) {
|
|
4042
|
+
if (ent.waterlevel < 2) {
|
|
4043
|
+
const test = { x: trace.endpos.x, y: trace.endpos.y, z: trace.endpos.z + ent.mins.z + 1 };
|
|
4044
|
+
if (!(context.pointcontents(test) & MASK_WATER)) return false;
|
|
4045
|
+
}
|
|
4046
|
+
}
|
|
4047
|
+
if (trace.fraction === 1 && !trace.allsolid && !trace.startsolid) {
|
|
4048
|
+
ent.origin.x = trace.endpos.x;
|
|
4049
|
+
ent.origin.y = trace.endpos.y;
|
|
4050
|
+
ent.origin.z = trace.endpos.z;
|
|
4051
|
+
if (relink) {
|
|
4052
|
+
context.linkentity(ent);
|
|
4053
|
+
}
|
|
4054
|
+
return true;
|
|
4055
|
+
}
|
|
4056
|
+
if (!ent.enemy) break;
|
|
4057
|
+
}
|
|
4058
|
+
return false;
|
|
4059
|
+
}
|
|
4060
|
+
function M_droptofloor_generic(origin, mins, maxs, ceiling, ignore, mask, allow_partial, context) {
|
|
4061
|
+
if (context.trace(origin, mins, maxs, origin, ignore, mask).startsolid) {
|
|
4062
|
+
if (!ceiling) {
|
|
4063
|
+
origin.z += 1;
|
|
4064
|
+
} else {
|
|
4065
|
+
origin.z -= 1;
|
|
4066
|
+
}
|
|
4067
|
+
}
|
|
4068
|
+
const end = { ...origin };
|
|
4069
|
+
if (!ceiling) {
|
|
4070
|
+
end.z -= 256;
|
|
4071
|
+
} else {
|
|
4072
|
+
end.z += 256;
|
|
4073
|
+
}
|
|
4074
|
+
const trace = context.trace(origin, mins, maxs, end, ignore, mask);
|
|
4075
|
+
if (trace.fraction === 1 || trace.allsolid || !allow_partial && trace.startsolid) {
|
|
4076
|
+
return false;
|
|
4077
|
+
}
|
|
4078
|
+
origin.x = trace.endpos.x;
|
|
4079
|
+
origin.y = trace.endpos.y;
|
|
4080
|
+
origin.z = trace.endpos.z;
|
|
4081
|
+
return true;
|
|
4082
|
+
}
|
|
4083
|
+
function M_droptofloor(ent, context) {
|
|
4084
|
+
const mask = MASK_MONSTERSOLID;
|
|
4085
|
+
if (!M_droptofloor_generic(ent.origin, ent.mins, ent.maxs, ent.gravityVector.z > 0, ent, mask, true, context)) {
|
|
4086
|
+
return false;
|
|
4087
|
+
}
|
|
4088
|
+
context.linkentity(ent);
|
|
4089
|
+
CheckGround(ent, context);
|
|
4090
|
+
return true;
|
|
4091
|
+
}
|
|
3956
4092
|
|
|
3957
4093
|
// src/physics/collision.ts
|
|
3958
4094
|
function resolveImpact(ent, trace, system) {
|
|
@@ -26112,6 +26248,7 @@ function createGame(imports, engine, options) {
|
|
|
26112
26248
|
FLAG_ITEMS,
|
|
26113
26249
|
FL_NOTARGET,
|
|
26114
26250
|
FL_NOVISIBLE,
|
|
26251
|
+
G_IdealHoverPosition,
|
|
26115
26252
|
HEALTH_ITEMS,
|
|
26116
26253
|
KEY_ITEMS,
|
|
26117
26254
|
KeyId,
|
|
@@ -26125,6 +26262,8 @@ function createGame(imports, engine, options) {
|
|
|
26125
26262
|
M_MoveStep,
|
|
26126
26263
|
M_MoveToGoal,
|
|
26127
26264
|
M_MoveToPath,
|
|
26265
|
+
M_droptofloor,
|
|
26266
|
+
M_droptofloor_generic,
|
|
26128
26267
|
M_walkmove,
|
|
26129
26268
|
MonsterAttackState,
|
|
26130
26269
|
MoveType,
|
|
@@ -26147,6 +26286,7 @@ function createGame(imports, engine, options) {
|
|
|
26147
26286
|
SPAWNFLAG_MONSTER_AMBUSH,
|
|
26148
26287
|
SV_NewChaseDir,
|
|
26149
26288
|
SV_StepDirection,
|
|
26289
|
+
SV_flystep,
|
|
26150
26290
|
SaveStorage,
|
|
26151
26291
|
ServerFlags,
|
|
26152
26292
|
Solid,
|