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