@quake2ts/game 0.0.869 → 0.0.873
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/dist/browser/index.global.js +5 -5
- package/dist/browser/index.global.js.map +1 -1
- package/dist/cjs/index.cjs +161 -121
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/esm/index.js +161 -121
- package/dist/esm/index.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +6 -6
package/dist/esm/index.js
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { AmmoItemId, AmmoType, ZERO_VEC3, createRandomGenerator, WeaponId, PowerupId, normalizeVec3, subtractVec3, vectorToAngles, angleVectors, vectorToYaw, scaleVec3, addVec3, lengthVec3, copyVec3 as copyVec3$1, SoundChannel, ATTN_NORM as ATTN_NORM$1, MASK_SHOT, distanceBetweenBoxesSquared, dotVec3, ServerCommand, TempEntity, MASK_SOLID, angleMod, CONTENTS_MONSTER, CONTENTS_PLAYER, CONTENTS_DEADMONSTER, RenderFx, degToRad, MASK_MONSTERSOLID, closestPointToBox, CONTENTS_SLIME, CONTENTS_LAVA, MASK_WATER, CONTENTS_SOLID, CONTENTS_WATER, AMMO_TYPE_COUNT, WaterLevel, boxesIntersect, RandomGenerator, BinaryWriter, writePlayerState, writeDeltaEntity, PmType, clipVelocityVec3, rotatePointAroundVector, MZ_GRENADE, ATTN_IDLE, ConfigStringIndex, CvarFlags, applyPmove, MASK_CURRENT, CONTENTS_CURRENT_0, CONTENTS_CURRENT_90, CONTENTS_CURRENT_180, CONTENTS_CURRENT_270, CONTENTS_CURRENT_UP, CONTENTS_CURRENT_DOWN, distance, PlayerStat, WEAPON_WHEEL_ORDER, AMMO_MAX, G_SetAmmoStat, G_SetPowerupStat, MZ_SHOTGUN, MZ_SSHOTGUN, MZ_MACHINEGUN, MZ_ROCKET, MZ_HYPERBLASTER, MZ_RAILGUN, MZ_BFG, MZ_BLASTER, MASK_PROJECTILE, MZ_CHAINGUN1 } from '@quake2ts/shared';
|
|
2
2
|
export { AMMO_TYPE_COUNT, AmmoItemId, AmmoType, PowerupId, WeaponId } from '@quake2ts/shared';
|
|
3
3
|
|
|
4
|
-
|
|
4
|
+
var __defProp = Object.defineProperty;
|
|
5
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
6
|
+
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
5
7
|
var AMMO_ITEM_DEFINITIONS = {
|
|
6
8
|
[AmmoItemId.Shells]: { id: AmmoItemId.Shells, ammoType: AmmoType.Shells, quantity: 10, weaponAmmo: false },
|
|
7
9
|
[AmmoItemId.Bullets]: { id: AmmoItemId.Bullets, ammoType: AmmoType.Bullets, quantity: 50, weaponAmmo: false },
|
|
@@ -892,97 +894,119 @@ var DEFAULT_MONSTER_INFO = Object.freeze({
|
|
|
892
894
|
});
|
|
893
895
|
var Entity = class {
|
|
894
896
|
constructor(index) {
|
|
895
|
-
this
|
|
896
|
-
this
|
|
897
|
-
this
|
|
898
|
-
this
|
|
899
|
-
this
|
|
900
|
-
this
|
|
901
|
-
this
|
|
902
|
-
this
|
|
903
|
-
this
|
|
904
|
-
this
|
|
905
|
-
this
|
|
906
|
-
this
|
|
907
|
-
this
|
|
908
|
-
this
|
|
909
|
-
this
|
|
910
|
-
this
|
|
911
|
-
this
|
|
912
|
-
this
|
|
913
|
-
this
|
|
914
|
-
this
|
|
915
|
-
this
|
|
916
|
-
this
|
|
917
|
-
this
|
|
918
|
-
this
|
|
919
|
-
this
|
|
920
|
-
this
|
|
921
|
-
this
|
|
922
|
-
this
|
|
923
|
-
this
|
|
924
|
-
this
|
|
925
|
-
this
|
|
926
|
-
this
|
|
927
|
-
this
|
|
928
|
-
this
|
|
929
|
-
this
|
|
930
|
-
this
|
|
931
|
-
this
|
|
932
|
-
this
|
|
933
|
-
this
|
|
934
|
-
this
|
|
935
|
-
this
|
|
936
|
-
this
|
|
937
|
-
this
|
|
938
|
-
this
|
|
939
|
-
this
|
|
940
|
-
this
|
|
941
|
-
this
|
|
942
|
-
this
|
|
943
|
-
this
|
|
944
|
-
this
|
|
945
|
-
this
|
|
946
|
-
this
|
|
947
|
-
this
|
|
948
|
-
this
|
|
949
|
-
this
|
|
950
|
-
this
|
|
951
|
-
this
|
|
952
|
-
this
|
|
953
|
-
this
|
|
954
|
-
this
|
|
955
|
-
this
|
|
956
|
-
this
|
|
957
|
-
this
|
|
958
|
-
this
|
|
959
|
-
this
|
|
960
|
-
this
|
|
961
|
-
this
|
|
962
|
-
this
|
|
963
|
-
this
|
|
964
|
-
this
|
|
965
|
-
this
|
|
966
|
-
this
|
|
967
|
-
this
|
|
968
|
-
this
|
|
969
|
-
this
|
|
970
|
-
this
|
|
971
|
-
this
|
|
972
|
-
this
|
|
973
|
-
this
|
|
974
|
-
this
|
|
975
|
-
this
|
|
976
|
-
this
|
|
977
|
-
this
|
|
978
|
-
this
|
|
979
|
-
this
|
|
980
|
-
this
|
|
981
|
-
this
|
|
982
|
-
this
|
|
983
|
-
this
|
|
984
|
-
this
|
|
985
|
-
this
|
|
897
|
+
__publicField(this, "index");
|
|
898
|
+
__publicField(this, "linkcount", 0);
|
|
899
|
+
__publicField(this, "inUse", false);
|
|
900
|
+
__publicField(this, "freePending", false);
|
|
901
|
+
__publicField(this, "linkPrevious", null);
|
|
902
|
+
__publicField(this, "linkNext", null);
|
|
903
|
+
__publicField(this, "classname", "");
|
|
904
|
+
__publicField(this, "spawnflags", 0);
|
|
905
|
+
__publicField(this, "target");
|
|
906
|
+
__publicField(this, "targetname");
|
|
907
|
+
__publicField(this, "killtarget");
|
|
908
|
+
__publicField(this, "team");
|
|
909
|
+
__publicField(this, "message");
|
|
910
|
+
__publicField(this, "pathtarget");
|
|
911
|
+
__publicField(this, "model");
|
|
912
|
+
__publicField(this, "item");
|
|
913
|
+
__publicField(this, "map");
|
|
914
|
+
__publicField(this, "inventory", {});
|
|
915
|
+
__publicField(this, "origin", copyVec3());
|
|
916
|
+
__publicField(this, "old_origin", copyVec3());
|
|
917
|
+
__publicField(this, "velocity", copyVec3());
|
|
918
|
+
__publicField(this, "avelocity", copyVec3());
|
|
919
|
+
__publicField(this, "angles", copyVec3());
|
|
920
|
+
__publicField(this, "pos1", copyVec3());
|
|
921
|
+
__publicField(this, "pos2", copyVec3());
|
|
922
|
+
__publicField(this, "gravityVector", copyVec3());
|
|
923
|
+
__publicField(this, "viewheight", 0);
|
|
924
|
+
__publicField(this, "mins", copyVec3());
|
|
925
|
+
__publicField(this, "maxs", copyVec3());
|
|
926
|
+
__publicField(this, "absmin", copyVec3());
|
|
927
|
+
__publicField(this, "absmax", copyVec3());
|
|
928
|
+
__publicField(this, "size", copyVec3());
|
|
929
|
+
__publicField(this, "mass", 0);
|
|
930
|
+
__publicField(this, "gravity", 1);
|
|
931
|
+
__publicField(this, "bounce", 1);
|
|
932
|
+
__publicField(this, "movetype", 0 /* None */);
|
|
933
|
+
__publicField(this, "movedir", copyVec3());
|
|
934
|
+
__publicField(this, "modelindex", 0);
|
|
935
|
+
__publicField(this, "frame", 0);
|
|
936
|
+
__publicField(this, "skin", 0);
|
|
937
|
+
__publicField(this, "effects", 0);
|
|
938
|
+
__publicField(this, "renderfx", 0);
|
|
939
|
+
__publicField(this, "health", 0);
|
|
940
|
+
__publicField(this, "max_health", 0);
|
|
941
|
+
__publicField(this, "spawn_count", 0);
|
|
942
|
+
__publicField(this, "takedamage", false);
|
|
943
|
+
__publicField(this, "dmg", 0);
|
|
944
|
+
__publicField(this, "radius_dmg", 0);
|
|
945
|
+
__publicField(this, "dmg_radius", 0);
|
|
946
|
+
__publicField(this, "speed", 0);
|
|
947
|
+
__publicField(this, "accel", 0);
|
|
948
|
+
__publicField(this, "decel", 0);
|
|
949
|
+
__publicField(this, "height", 0);
|
|
950
|
+
__publicField(this, "deadflag", 0 /* Alive */);
|
|
951
|
+
__publicField(this, "count", 0);
|
|
952
|
+
__publicField(this, "wait", 0);
|
|
953
|
+
__publicField(this, "delay", 0);
|
|
954
|
+
__publicField(this, "random", 0);
|
|
955
|
+
__publicField(this, "timestamp", 0);
|
|
956
|
+
__publicField(this, "lip", 0);
|
|
957
|
+
__publicField(this, "state", 0);
|
|
958
|
+
__publicField(this, "style", 0);
|
|
959
|
+
__publicField(this, "sounds", 0);
|
|
960
|
+
__publicField(this, "noise_index", 0);
|
|
961
|
+
__publicField(this, "attenuation", 0);
|
|
962
|
+
__publicField(this, "volume", 0);
|
|
963
|
+
__publicField(this, "fly_sound_debounce_time", 0);
|
|
964
|
+
__publicField(this, "last_move_time", 0);
|
|
965
|
+
__publicField(this, "damage_debounce_time", 0);
|
|
966
|
+
__publicField(this, "enemy", null);
|
|
967
|
+
__publicField(this, "movetarget", null);
|
|
968
|
+
__publicField(this, "target_ent", null);
|
|
969
|
+
__publicField(this, "goalentity", null);
|
|
970
|
+
__publicField(this, "ideal_yaw", 0);
|
|
971
|
+
__publicField(this, "yaw_speed", 0);
|
|
972
|
+
__publicField(this, "search_time", 0);
|
|
973
|
+
__publicField(this, "attack_finished_time", 0);
|
|
974
|
+
__publicField(this, "pain_finished_time", 0);
|
|
975
|
+
__publicField(this, "pain_debounce_time", 0);
|
|
976
|
+
__publicField(this, "trail_time", 0);
|
|
977
|
+
__publicField(this, "groundentity", null);
|
|
978
|
+
__publicField(this, "groundentity_linkcount", 0);
|
|
979
|
+
__publicField(this, "waterlevel", 0);
|
|
980
|
+
__publicField(this, "watertype", 0);
|
|
981
|
+
__publicField(this, "nextthink", 0);
|
|
982
|
+
__publicField(this, "think");
|
|
983
|
+
__publicField(this, "touch");
|
|
984
|
+
__publicField(this, "use");
|
|
985
|
+
__publicField(this, "blocked");
|
|
986
|
+
__publicField(this, "pain");
|
|
987
|
+
__publicField(this, "die");
|
|
988
|
+
__publicField(this, "postthink");
|
|
989
|
+
__publicField(this, "activator", null);
|
|
990
|
+
__publicField(this, "alpha", 0);
|
|
991
|
+
__publicField(this, "solid", 0 /* Not */);
|
|
992
|
+
__publicField(this, "clipmask", 0);
|
|
993
|
+
__publicField(this, "flags", 0);
|
|
994
|
+
__publicField(this, "svflags", 0);
|
|
995
|
+
__publicField(this, "monsterinfo", { ...DEFAULT_MONSTER_INFO, last_sighting: copyVec3() });
|
|
996
|
+
__publicField(this, "moveinfo");
|
|
997
|
+
__publicField(this, "hackflags", 0);
|
|
998
|
+
__publicField(this, "plat2flags", 0);
|
|
999
|
+
__publicField(this, "fov", 0);
|
|
1000
|
+
__publicField(this, "combattarget");
|
|
1001
|
+
__publicField(this, "show_hostile", 0);
|
|
1002
|
+
__publicField(this, "light_level", 0);
|
|
1003
|
+
__publicField(this, "owner", null);
|
|
1004
|
+
__publicField(this, "beam", null);
|
|
1005
|
+
__publicField(this, "beam2", null);
|
|
1006
|
+
__publicField(this, "chain", null);
|
|
1007
|
+
__publicField(this, "client");
|
|
1008
|
+
__publicField(this, "_regularArmor");
|
|
1009
|
+
__publicField(this, "_powerArmor");
|
|
986
1010
|
this.index = index;
|
|
987
1011
|
}
|
|
988
1012
|
get regularArmor() {
|
|
@@ -2984,9 +3008,10 @@ var MAX_EDICTS = 2048;
|
|
|
2984
3008
|
var WORLD_INDEX = 0;
|
|
2985
3009
|
var EntityPool = class {
|
|
2986
3010
|
constructor(maxEntities = MAX_EDICTS) {
|
|
2987
|
-
this
|
|
2988
|
-
this
|
|
2989
|
-
this
|
|
3011
|
+
__publicField(this, "entities");
|
|
3012
|
+
__publicField(this, "freeList", []);
|
|
3013
|
+
__publicField(this, "pendingFree", []);
|
|
3014
|
+
__publicField(this, "activeHead", null);
|
|
2990
3015
|
if (maxEntities < 1 || !Number.isInteger(maxEntities)) {
|
|
2991
3016
|
throw new Error("EntityPool requires a positive integer size");
|
|
2992
3017
|
}
|
|
@@ -3165,7 +3190,7 @@ var EntityPool = class {
|
|
|
3165
3190
|
// src/entities/thinkScheduler.ts
|
|
3166
3191
|
var ThinkScheduler = class {
|
|
3167
3192
|
constructor() {
|
|
3168
|
-
this
|
|
3193
|
+
__publicField(this, "queue", []);
|
|
3169
3194
|
}
|
|
3170
3195
|
schedule(entity, timeSeconds) {
|
|
3171
3196
|
entity.nextthink = timeSeconds;
|
|
@@ -3225,8 +3250,8 @@ function getCellKey(x, y, z) {
|
|
|
3225
3250
|
var SpatialGrid = class {
|
|
3226
3251
|
constructor(cellSize = CELL_SIZE) {
|
|
3227
3252
|
this.cellSize = cellSize;
|
|
3228
|
-
this
|
|
3229
|
-
this
|
|
3253
|
+
__publicField(this, "cells", /* @__PURE__ */ new Map());
|
|
3254
|
+
__publicField(this, "entityCells", /* @__PURE__ */ new Map());
|
|
3230
3255
|
}
|
|
3231
3256
|
getCellRange(min, max) {
|
|
3232
3257
|
return [Math.floor(min / this.cellSize), Math.floor(max / this.cellSize)];
|
|
@@ -3353,14 +3378,28 @@ function deserializeInventory(value) {
|
|
|
3353
3378
|
var EntitySystem = class {
|
|
3354
3379
|
constructor(engine, imports, gravity, maxEntities, callbackRegistry, deathmatch, skill, random5, coop, friendlyFire = false) {
|
|
3355
3380
|
this.friendlyFire = friendlyFire;
|
|
3356
|
-
this
|
|
3357
|
-
this
|
|
3358
|
-
this
|
|
3359
|
-
this
|
|
3360
|
-
this
|
|
3381
|
+
__publicField(this, "pool");
|
|
3382
|
+
__publicField(this, "thinkScheduler");
|
|
3383
|
+
__publicField(this, "targetNameIndex", /* @__PURE__ */ new Map());
|
|
3384
|
+
__publicField(this, "random");
|
|
3385
|
+
__publicField(this, "callbackToName");
|
|
3386
|
+
__publicField(this, "spawnRegistry");
|
|
3387
|
+
__publicField(this, "currentTimeSeconds", 0);
|
|
3388
|
+
__publicField(this, "currentDeltaSeconds", 0);
|
|
3389
|
+
__publicField(this, "frameNumber", 0);
|
|
3390
|
+
__publicField(this, "spawnCount", 0);
|
|
3391
|
+
__publicField(this, "spatialGrid");
|
|
3392
|
+
__publicField(this, "targetAwareness");
|
|
3361
3393
|
// Persistent state for cross-level logic
|
|
3362
|
-
this
|
|
3363
|
-
this
|
|
3394
|
+
__publicField(this, "crossLevelFlags", 0);
|
|
3395
|
+
__publicField(this, "crossUnitFlags", 0);
|
|
3396
|
+
__publicField(this, "level");
|
|
3397
|
+
__publicField(this, "engine");
|
|
3398
|
+
__publicField(this, "imports");
|
|
3399
|
+
__publicField(this, "gravity");
|
|
3400
|
+
__publicField(this, "deathmatch");
|
|
3401
|
+
__publicField(this, "skill");
|
|
3402
|
+
__publicField(this, "coop");
|
|
3364
3403
|
this.pool = new EntityPool(maxEntities);
|
|
3365
3404
|
this.thinkScheduler = new ThinkScheduler();
|
|
3366
3405
|
this.engine = engine;
|
|
@@ -23107,7 +23146,7 @@ function parseEntityLump(text) {
|
|
|
23107
23146
|
}
|
|
23108
23147
|
var SpawnRegistry = class {
|
|
23109
23148
|
constructor() {
|
|
23110
|
-
this
|
|
23149
|
+
__publicField(this, "registry", /* @__PURE__ */ new Map());
|
|
23111
23150
|
}
|
|
23112
23151
|
register(classname, spawn) {
|
|
23113
23152
|
this.registry.set(classname, spawn);
|
|
@@ -23263,23 +23302,23 @@ var orderedStageNames = [
|
|
|
23263
23302
|
];
|
|
23264
23303
|
var GameFrameLoop = class {
|
|
23265
23304
|
constructor(initialStages) {
|
|
23266
|
-
this
|
|
23267
|
-
this
|
|
23268
|
-
this
|
|
23305
|
+
__publicField(this, "timeMs", 0);
|
|
23306
|
+
__publicField(this, "frame", 0);
|
|
23307
|
+
__publicField(this, "stageHandlers", {
|
|
23269
23308
|
prep: [],
|
|
23270
23309
|
simulate: [],
|
|
23271
23310
|
finish: []
|
|
23272
|
-
};
|
|
23273
|
-
this
|
|
23311
|
+
});
|
|
23312
|
+
__publicField(this, "stageCounts", {
|
|
23274
23313
|
prep: 0,
|
|
23275
23314
|
simulate: 0,
|
|
23276
23315
|
finish: 0
|
|
23277
|
-
};
|
|
23278
|
-
this
|
|
23316
|
+
});
|
|
23317
|
+
__publicField(this, "stageCompactionNeeded", {
|
|
23279
23318
|
prep: false,
|
|
23280
23319
|
simulate: false,
|
|
23281
23320
|
finish: false
|
|
23282
|
-
};
|
|
23321
|
+
});
|
|
23283
23322
|
if (initialStages) {
|
|
23284
23323
|
for (const stageName of orderedStageNames) {
|
|
23285
23324
|
const handler = initialStages[stageName];
|
|
@@ -23367,7 +23406,7 @@ var ZERO_STATE = {
|
|
|
23367
23406
|
};
|
|
23368
23407
|
var LevelClock = class {
|
|
23369
23408
|
constructor() {
|
|
23370
|
-
this
|
|
23409
|
+
__publicField(this, "state", ZERO_STATE);
|
|
23371
23410
|
}
|
|
23372
23411
|
start(startTimeMs) {
|
|
23373
23412
|
const startSeconds = startTimeMs / 1e3;
|
|
@@ -24162,7 +24201,7 @@ function estimateSizeBytes(save) {
|
|
|
24162
24201
|
}
|
|
24163
24202
|
var MemorySaveAdapter = class {
|
|
24164
24203
|
constructor() {
|
|
24165
|
-
this
|
|
24204
|
+
__publicField(this, "records", /* @__PURE__ */ new Map());
|
|
24166
24205
|
}
|
|
24167
24206
|
async init() {
|
|
24168
24207
|
return Promise.resolve();
|
|
@@ -24202,7 +24241,7 @@ var IndexedDbSaveAdapter = class {
|
|
|
24202
24241
|
this.indexedDB = indexedDB;
|
|
24203
24242
|
this.dbName = dbName;
|
|
24204
24243
|
this.storeName = storeName;
|
|
24205
|
-
this
|
|
24244
|
+
__publicField(this, "db", null);
|
|
24206
24245
|
}
|
|
24207
24246
|
async init() {
|
|
24208
24247
|
if (this.db) {
|
|
@@ -24261,6 +24300,7 @@ var IndexedDbSaveAdapter = class {
|
|
|
24261
24300
|
};
|
|
24262
24301
|
var _SaveStorage = class _SaveStorage {
|
|
24263
24302
|
constructor(options = {}) {
|
|
24303
|
+
__publicField(this, "adapter");
|
|
24264
24304
|
const { dbName = _SaveStorage.DEFAULT_DB_NAME, storeName = _SaveStorage.DEFAULT_STORE } = options;
|
|
24265
24305
|
const indexedDBFactory = options.indexedDB ?? globalThis.indexedDB;
|
|
24266
24306
|
if (indexedDBFactory) {
|
|
@@ -24309,9 +24349,9 @@ var _SaveStorage = class _SaveStorage {
|
|
|
24309
24349
|
return this.load(_SaveStorage.QUICK_SLOT, options);
|
|
24310
24350
|
}
|
|
24311
24351
|
};
|
|
24312
|
-
_SaveStorage
|
|
24313
|
-
_SaveStorage
|
|
24314
|
-
_SaveStorage
|
|
24352
|
+
__publicField(_SaveStorage, "DEFAULT_DB_NAME", "quake2ts-saves");
|
|
24353
|
+
__publicField(_SaveStorage, "DEFAULT_STORE", "saves");
|
|
24354
|
+
__publicField(_SaveStorage, "QUICK_SLOT", "quicksave");
|
|
24315
24355
|
var SaveStorage = _SaveStorage;
|
|
24316
24356
|
|
|
24317
24357
|
// src/entities/templates.ts
|
|
@@ -25021,7 +25061,7 @@ function populatePlayerStats(player, timeSeconds) {
|
|
|
25021
25061
|
// src/scripting/hooks.ts
|
|
25022
25062
|
var ScriptHookRegistry = class {
|
|
25023
25063
|
constructor() {
|
|
25024
|
-
this
|
|
25064
|
+
__publicField(this, "hooks", []);
|
|
25025
25065
|
}
|
|
25026
25066
|
/**
|
|
25027
25067
|
* Register a new set of hooks.
|