@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.
@@ -2,7 +2,9 @@
2
2
 
3
3
  var shared = require('@quake2ts/shared');
4
4
 
5
- // src/entities/entity.ts
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.linkcount = 0;
897
- this.inUse = false;
898
- this.freePending = false;
899
- this.linkPrevious = null;
900
- this.linkNext = null;
901
- this.classname = "";
902
- this.spawnflags = 0;
903
- this.inventory = {};
904
- this.origin = copyVec3();
905
- this.old_origin = copyVec3();
906
- this.velocity = copyVec3();
907
- this.avelocity = copyVec3();
908
- this.angles = copyVec3();
909
- this.pos1 = copyVec3();
910
- this.pos2 = copyVec3();
911
- this.gravityVector = copyVec3();
912
- this.viewheight = 0;
913
- this.mins = copyVec3();
914
- this.maxs = copyVec3();
915
- this.absmin = copyVec3();
916
- this.absmax = copyVec3();
917
- this.size = copyVec3();
918
- this.mass = 0;
919
- this.gravity = 1;
920
- this.bounce = 1;
921
- this.movetype = 0 /* None */;
922
- this.movedir = copyVec3();
923
- this.modelindex = 0;
924
- this.frame = 0;
925
- this.skin = 0;
926
- this.effects = 0;
927
- this.renderfx = 0;
928
- this.health = 0;
929
- this.max_health = 0;
930
- this.spawn_count = 0;
931
- this.takedamage = false;
932
- this.dmg = 0;
933
- this.radius_dmg = 0;
934
- this.dmg_radius = 0;
935
- this.speed = 0;
936
- this.accel = 0;
937
- this.decel = 0;
938
- this.height = 0;
939
- this.deadflag = 0 /* Alive */;
940
- this.count = 0;
941
- this.wait = 0;
942
- this.delay = 0;
943
- this.random = 0;
944
- this.timestamp = 0;
945
- this.lip = 0;
946
- this.state = 0;
947
- this.style = 0;
948
- this.sounds = 0;
949
- this.noise_index = 0;
950
- this.attenuation = 0;
951
- this.volume = 0;
952
- this.fly_sound_debounce_time = 0;
953
- this.last_move_time = 0;
954
- this.damage_debounce_time = 0;
955
- this.enemy = null;
956
- this.movetarget = null;
957
- this.target_ent = null;
958
- this.goalentity = null;
959
- this.ideal_yaw = 0;
960
- this.yaw_speed = 0;
961
- this.search_time = 0;
962
- this.attack_finished_time = 0;
963
- this.pain_finished_time = 0;
964
- this.pain_debounce_time = 0;
965
- this.trail_time = 0;
966
- this.groundentity = null;
967
- this.groundentity_linkcount = 0;
968
- this.waterlevel = 0;
969
- this.watertype = 0;
970
- this.nextthink = 0;
971
- this.activator = null;
972
- this.alpha = 0;
973
- this.solid = 0 /* Not */;
974
- this.clipmask = 0;
975
- this.flags = 0;
976
- this.svflags = 0;
977
- this.monsterinfo = { ...DEFAULT_MONSTER_INFO, last_sighting: copyVec3() };
978
- this.hackflags = 0;
979
- this.plat2flags = 0;
980
- this.fov = 0;
981
- this.show_hostile = 0;
982
- this.light_level = 0;
983
- this.owner = null;
984
- this.beam = null;
985
- this.beam2 = null;
986
- this.chain = null;
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.freeList = [];
2989
- this.pendingFree = [];
2990
- this.activeHead = null;
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.queue = [];
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.cells = /* @__PURE__ */ new Map();
3230
- this.entityCells = /* @__PURE__ */ new Map();
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.targetNameIndex = /* @__PURE__ */ new Map();
3358
- this.currentTimeSeconds = 0;
3359
- this.currentDeltaSeconds = 0;
3360
- this.frameNumber = 0;
3361
- this.spawnCount = 0;
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.crossLevelFlags = 0;
3364
- this.crossUnitFlags = 0;
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.registry = /* @__PURE__ */ new Map();
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.timeMs = 0;
23268
- this.frame = 0;
23269
- this.stageHandlers = {
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.stageCounts = {
23312
+ });
23313
+ __publicField(this, "stageCounts", {
23275
23314
  prep: 0,
23276
23315
  simulate: 0,
23277
23316
  finish: 0
23278
- };
23279
- this.stageCompactionNeeded = {
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.state = ZERO_STATE;
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.records = /* @__PURE__ */ new Map();
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.db = null;
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.DEFAULT_DB_NAME = "quake2ts-saves";
24314
- _SaveStorage.DEFAULT_STORE = "saves";
24315
- _SaveStorage.QUICK_SLOT = "quicksave";
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.hooks = [];
25065
+ __publicField(this, "hooks", []);
25026
25066
  }
25027
25067
  /**
25028
25068
  * Register a new set of hooks.