quake2ts 0.0.441 → 0.0.443
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
|
@@ -2605,7 +2605,13 @@ var AIFlags = /* @__PURE__ */ ((AIFlags2) => {
|
|
|
2605
2605
|
AIFlags2[AIFlags2["CombatPoint"] = 8192] = "CombatPoint";
|
|
2606
2606
|
AIFlags2[AIFlags2["Medic"] = 16384] = "Medic";
|
|
2607
2607
|
AIFlags2[AIFlags2["Resurrecting"] = 32768] = "Resurrecting";
|
|
2608
|
+
AIFlags2[AIFlags2["SpawnedCarrier"] = 65536] = "SpawnedCarrier";
|
|
2609
|
+
AIFlags2[AIFlags2["IgnoreShots"] = 131072] = "IgnoreShots";
|
|
2610
|
+
AIFlags2[AIFlags2["AlternateFly"] = 262144] = "AlternateFly";
|
|
2608
2611
|
AIFlags2[AIFlags2["Dodging"] = 524288] = "Dodging";
|
|
2612
|
+
AIFlags2[AIFlags2["SpawnedMedicC"] = 8388608] = "SpawnedMedicC";
|
|
2613
|
+
AIFlags2[AIFlags2["HintPath"] = 16777216] = "HintPath";
|
|
2614
|
+
AIFlags2[AIFlags2["Blocked"] = 33554432] = "Blocked";
|
|
2609
2615
|
AIFlags2[AIFlags2["Pathing"] = 1073741824] = "Pathing";
|
|
2610
2616
|
return AIFlags2;
|
|
2611
2617
|
})(AIFlags || {});
|
|
@@ -3651,7 +3657,7 @@ function M_MoveStep(self, move, relink, context) {
|
|
|
3651
3657
|
return true;
|
|
3652
3658
|
}
|
|
3653
3659
|
if ((self.flags & (2 /* Swim */ | 1 /* Fly */)) !== 0) {
|
|
3654
|
-
return
|
|
3660
|
+
return SV_flystep(self, move, relink, context);
|
|
3655
3661
|
}
|
|
3656
3662
|
const oldOrigin = { ...self.origin };
|
|
3657
3663
|
const up = { ...self.origin, z: self.origin.z + STEPSIZE };
|
|
@@ -3693,7 +3699,9 @@ function M_MoveStep(self, move, relink, context) {
|
|
|
3693
3699
|
}
|
|
3694
3700
|
function M_walkmove(self, yawDegrees, distance4, context) {
|
|
3695
3701
|
const delta = yawVector(yawDegrees, distance4);
|
|
3696
|
-
|
|
3702
|
+
const retval = M_MoveStep(self, delta, true, context);
|
|
3703
|
+
self.monsterinfo.aiflags &= ~33554432 /* Blocked */;
|
|
3704
|
+
return retval;
|
|
3697
3705
|
}
|
|
3698
3706
|
function SV_StepDirection(self, yaw, dist, context) {
|
|
3699
3707
|
for (let i = 0; i <= 90; i += 45) {
|
|
@@ -3770,6 +3778,130 @@ function M_MoveToGoal(self, dist, context) {
|
|
|
3770
3778
|
}
|
|
3771
3779
|
return true;
|
|
3772
3780
|
}
|
|
3781
|
+
function G_IdealHoverPosition(ent, context) {
|
|
3782
|
+
if (!ent.enemy && !(ent.monsterinfo.aiflags & 16384 /* Medic */) || ent.monsterinfo.aiflags & (8192 /* CombatPoint */ | 4 /* SoundTarget */ | 16777216 /* HintPath */ | 1073741824 /* Pathing */)) {
|
|
3783
|
+
return { x: 0, y: 0, z: 0 };
|
|
3784
|
+
}
|
|
3785
|
+
const theta = context.rng.frandom() * 2 * Math.PI;
|
|
3786
|
+
let phi;
|
|
3787
|
+
if (ent.monsterinfo.fly_above) {
|
|
3788
|
+
phi = Math.acos(0.7 + context.rng.frandom() * 0.3);
|
|
3789
|
+
} else if (ent.monsterinfo.fly_buzzard || ent.monsterinfo.aiflags & 16384 /* Medic */) {
|
|
3790
|
+
phi = Math.acos(context.rng.frandom());
|
|
3791
|
+
} else {
|
|
3792
|
+
phi = Math.acos(context.rng.crandom() * 0.06);
|
|
3793
|
+
}
|
|
3794
|
+
const sinPhi = Math.sin(phi);
|
|
3795
|
+
const d = {
|
|
3796
|
+
x: sinPhi * Math.cos(theta),
|
|
3797
|
+
y: sinPhi * Math.sin(theta),
|
|
3798
|
+
z: Math.cos(phi)
|
|
3799
|
+
};
|
|
3800
|
+
const minDist = ent.monsterinfo.fly_min_distance ?? 0;
|
|
3801
|
+
const maxDist = ent.monsterinfo.fly_max_distance ?? 0;
|
|
3802
|
+
const dist = minDist + context.rng.frandom() * (maxDist - minDist);
|
|
3803
|
+
return scaleVec3(d, dist);
|
|
3804
|
+
}
|
|
3805
|
+
function SV_flystep(ent, move, relink, context) {
|
|
3806
|
+
if (ent.monsterinfo.aiflags & 262144 /* AlternateFly */) {
|
|
3807
|
+
}
|
|
3808
|
+
const oldOrg = { ...ent.origin };
|
|
3809
|
+
let minheight = 40;
|
|
3810
|
+
if (ent.classname === "monster_carrier") minheight = 104;
|
|
3811
|
+
for (let i = 0; i < 2; i++) {
|
|
3812
|
+
let newMove = { ...move };
|
|
3813
|
+
if (i === 0 && ent.enemy) {
|
|
3814
|
+
let goalEntity = ent.goalentity;
|
|
3815
|
+
if (!goalEntity) goalEntity = ent.enemy;
|
|
3816
|
+
let goalPos = goalEntity.origin;
|
|
3817
|
+
if (ent.monsterinfo.aiflags & 1073741824 /* Pathing */ && ent.monsterinfo.nav_path) {
|
|
3818
|
+
goalPos = ent.monsterinfo.nav_path.firstMovePoint;
|
|
3819
|
+
}
|
|
3820
|
+
const dz = ent.origin.z - goalPos.z;
|
|
3821
|
+
const dist = lengthVec3(move);
|
|
3822
|
+
if (goalEntity.client) {
|
|
3823
|
+
if (dz > minheight) {
|
|
3824
|
+
newMove = scaleVec3(newMove, 0.5);
|
|
3825
|
+
newMove.z -= dist;
|
|
3826
|
+
}
|
|
3827
|
+
if (!(ent.flags & 2 /* Swim */ && ent.waterlevel < 2)) {
|
|
3828
|
+
if (dz < minheight - 10) {
|
|
3829
|
+
newMove = scaleVec3(newMove, 0.5);
|
|
3830
|
+
newMove.z += dist;
|
|
3831
|
+
}
|
|
3832
|
+
}
|
|
3833
|
+
} else {
|
|
3834
|
+
if (ent.classname === "monster_fixbot") {
|
|
3835
|
+
} else {
|
|
3836
|
+
if (dz > 0) {
|
|
3837
|
+
newMove = scaleVec3(newMove, 0.5);
|
|
3838
|
+
newMove.z -= Math.min(dist, dz);
|
|
3839
|
+
} else if (dz < 0) {
|
|
3840
|
+
newMove = scaleVec3(newMove, 0.5);
|
|
3841
|
+
newMove.z += -Math.max(-dist, dz);
|
|
3842
|
+
}
|
|
3843
|
+
}
|
|
3844
|
+
}
|
|
3845
|
+
}
|
|
3846
|
+
const newOrg = addVec3(ent.origin, newMove);
|
|
3847
|
+
const trace = context.trace(ent.origin, ent.mins, ent.maxs, newOrg, ent, MASK_MONSTERSOLID);
|
|
3848
|
+
if (ent.flags & 1 /* Fly */) {
|
|
3849
|
+
if (!ent.waterlevel) {
|
|
3850
|
+
const test = { x: trace.endpos.x, y: trace.endpos.y, z: trace.endpos.z + ent.mins.z + 1 };
|
|
3851
|
+
if (context.pointcontents(test) & MASK_WATER) return false;
|
|
3852
|
+
}
|
|
3853
|
+
}
|
|
3854
|
+
if (ent.flags & 2 /* Swim */) {
|
|
3855
|
+
if (ent.waterlevel < 2) {
|
|
3856
|
+
const test = { x: trace.endpos.x, y: trace.endpos.y, z: trace.endpos.z + ent.mins.z + 1 };
|
|
3857
|
+
if (!(context.pointcontents(test) & MASK_WATER)) return false;
|
|
3858
|
+
}
|
|
3859
|
+
}
|
|
3860
|
+
if (trace.fraction === 1 && !trace.allsolid && !trace.startsolid) {
|
|
3861
|
+
ent.origin.x = trace.endpos.x;
|
|
3862
|
+
ent.origin.y = trace.endpos.y;
|
|
3863
|
+
ent.origin.z = trace.endpos.z;
|
|
3864
|
+
if (relink) {
|
|
3865
|
+
context.linkentity(ent);
|
|
3866
|
+
}
|
|
3867
|
+
return true;
|
|
3868
|
+
}
|
|
3869
|
+
if (!ent.enemy) break;
|
|
3870
|
+
}
|
|
3871
|
+
return false;
|
|
3872
|
+
}
|
|
3873
|
+
function M_droptofloor_generic(origin, mins, maxs, ceiling, ignore, mask, allow_partial, context) {
|
|
3874
|
+
if (context.trace(origin, mins, maxs, origin, ignore, mask).startsolid) {
|
|
3875
|
+
if (!ceiling) {
|
|
3876
|
+
origin.z += 1;
|
|
3877
|
+
} else {
|
|
3878
|
+
origin.z -= 1;
|
|
3879
|
+
}
|
|
3880
|
+
}
|
|
3881
|
+
const end = { ...origin };
|
|
3882
|
+
if (!ceiling) {
|
|
3883
|
+
end.z -= 256;
|
|
3884
|
+
} else {
|
|
3885
|
+
end.z += 256;
|
|
3886
|
+
}
|
|
3887
|
+
const trace = context.trace(origin, mins, maxs, end, ignore, mask);
|
|
3888
|
+
if (trace.fraction === 1 || trace.allsolid || !allow_partial && trace.startsolid) {
|
|
3889
|
+
return false;
|
|
3890
|
+
}
|
|
3891
|
+
origin.x = trace.endpos.x;
|
|
3892
|
+
origin.y = trace.endpos.y;
|
|
3893
|
+
origin.z = trace.endpos.z;
|
|
3894
|
+
return true;
|
|
3895
|
+
}
|
|
3896
|
+
function M_droptofloor(ent, context) {
|
|
3897
|
+
const mask = MASK_MONSTERSOLID;
|
|
3898
|
+
if (!M_droptofloor_generic(ent.origin, ent.mins, ent.maxs, ent.gravityVector.z > 0, ent, mask, true, context)) {
|
|
3899
|
+
return false;
|
|
3900
|
+
}
|
|
3901
|
+
context.linkentity(ent);
|
|
3902
|
+
CheckGround(ent, context);
|
|
3903
|
+
return true;
|
|
3904
|
+
}
|
|
3773
3905
|
|
|
3774
3906
|
// src/physics/collision.ts
|
|
3775
3907
|
function resolveImpact(ent, trace, system) {
|
|
@@ -25928,6 +26060,7 @@ export {
|
|
|
25928
26060
|
FLAG_ITEMS,
|
|
25929
26061
|
FL_NOTARGET,
|
|
25930
26062
|
FL_NOVISIBLE,
|
|
26063
|
+
G_IdealHoverPosition,
|
|
25931
26064
|
HEALTH_ITEMS,
|
|
25932
26065
|
KEY_ITEMS,
|
|
25933
26066
|
KeyId,
|
|
@@ -25941,6 +26074,8 @@ export {
|
|
|
25941
26074
|
M_MoveStep,
|
|
25942
26075
|
M_MoveToGoal,
|
|
25943
26076
|
M_MoveToPath,
|
|
26077
|
+
M_droptofloor,
|
|
26078
|
+
M_droptofloor_generic,
|
|
25944
26079
|
M_walkmove,
|
|
25945
26080
|
MonsterAttackState,
|
|
25946
26081
|
MoveType,
|
|
@@ -25963,6 +26098,7 @@ export {
|
|
|
25963
26098
|
SPAWNFLAG_MONSTER_AMBUSH,
|
|
25964
26099
|
SV_NewChaseDir,
|
|
25965
26100
|
SV_StepDirection,
|
|
26101
|
+
SV_flystep,
|
|
25966
26102
|
SaveStorage,
|
|
25967
26103
|
ServerFlags,
|
|
25968
26104
|
Solid,
|