quake2ts 0.0.437 → 0.0.438
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 +8 -8
- 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/assets/streamer.d.ts +17 -0
- package/packages/engine/dist/types/assets/streamer.d.ts.map +1 -0
- 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 +41 -0
- package/packages/game/dist/cjs/index.cjs.map +1 -1
- package/packages/game/dist/esm/index.js +41 -0
- package/packages/game/dist/esm/index.js.map +1 -1
- package/packages/game/dist/tsconfig.tsbuildinfo +1 -1
- package/packages/game/dist/types/combat/weapons/firing.d.ts.map +1 -1
- package/packages/game/dist/types/combat/weapons/registry.d.ts +16 -0
- package/packages/game/dist/types/combat/weapons/registry.d.ts.map +1 -0
- package/packages/game/dist/types/entities/system.d.ts +3 -0
- package/packages/game/dist/types/entities/system.d.ts.map +1 -1
- package/packages/game/dist/types/scripting/hooks.d.ts +24 -0
- package/packages/game/dist/types/scripting/hooks.d.ts.map +1 -0
|
@@ -4550,6 +4550,41 @@ var SpatialGrid = class {
|
|
|
4550
4550
|
}
|
|
4551
4551
|
};
|
|
4552
4552
|
|
|
4553
|
+
// src/scripting/hooks.ts
|
|
4554
|
+
var ScriptHookRegistry = class {
|
|
4555
|
+
constructor() {
|
|
4556
|
+
this.hooks = {};
|
|
4557
|
+
}
|
|
4558
|
+
register(hooks) {
|
|
4559
|
+
this.hooks = { ...this.hooks, ...hooks };
|
|
4560
|
+
}
|
|
4561
|
+
// Getters for specific hooks to avoid full object access if performance critical
|
|
4562
|
+
get onMapLoad() {
|
|
4563
|
+
return this.hooks.onMapLoad;
|
|
4564
|
+
}
|
|
4565
|
+
get onMapUnload() {
|
|
4566
|
+
return this.hooks.onMapUnload;
|
|
4567
|
+
}
|
|
4568
|
+
get onPlayerSpawn() {
|
|
4569
|
+
return this.hooks.onPlayerSpawn;
|
|
4570
|
+
}
|
|
4571
|
+
get onPlayerDeath() {
|
|
4572
|
+
return this.hooks.onPlayerDeath;
|
|
4573
|
+
}
|
|
4574
|
+
get onEntitySpawn() {
|
|
4575
|
+
return this.hooks.onEntitySpawn;
|
|
4576
|
+
}
|
|
4577
|
+
get onEntityRemove() {
|
|
4578
|
+
return this.hooks.onEntityRemove;
|
|
4579
|
+
}
|
|
4580
|
+
get onDamage() {
|
|
4581
|
+
return this.hooks.onDamage;
|
|
4582
|
+
}
|
|
4583
|
+
get onPickup() {
|
|
4584
|
+
return this.hooks.onPickup;
|
|
4585
|
+
}
|
|
4586
|
+
};
|
|
4587
|
+
|
|
4553
4588
|
// src/entities/system.ts
|
|
4554
4589
|
function computeBounds(entity) {
|
|
4555
4590
|
return {
|
|
@@ -4608,6 +4643,7 @@ var EntitySystem = class {
|
|
|
4608
4643
|
this.currentTimeSeconds = 0;
|
|
4609
4644
|
this.frameNumber = 0;
|
|
4610
4645
|
this.spawnCount = 0;
|
|
4646
|
+
this.scriptHooks = new ScriptHookRegistry();
|
|
4611
4647
|
// Persistent state for cross-level logic
|
|
4612
4648
|
this.crossLevelFlags = 0;
|
|
4613
4649
|
this.crossUnitFlags = 0;
|
|
@@ -4710,6 +4746,9 @@ var EntitySystem = class {
|
|
|
4710
4746
|
setSpawnRegistry(registry) {
|
|
4711
4747
|
this.spawnRegistry = registry;
|
|
4712
4748
|
}
|
|
4749
|
+
registerEntityClass(classname, factory) {
|
|
4750
|
+
this.spawnRegistry?.register(classname, factory);
|
|
4751
|
+
}
|
|
4713
4752
|
getSpawnFunction(classname) {
|
|
4714
4753
|
return this.spawnRegistry?.get(classname);
|
|
4715
4754
|
}
|
|
@@ -4760,9 +4799,11 @@ var EntitySystem = class {
|
|
|
4760
4799
|
this.spawnCount++;
|
|
4761
4800
|
ent.spawn_count = this.spawnCount;
|
|
4762
4801
|
ent.timestamp = this.currentTimeSeconds;
|
|
4802
|
+
this.scriptHooks.onEntitySpawn?.(ent);
|
|
4763
4803
|
return ent;
|
|
4764
4804
|
}
|
|
4765
4805
|
free(entity) {
|
|
4806
|
+
this.scriptHooks.onEntityRemove?.(entity);
|
|
4766
4807
|
this.unregisterTarget(entity);
|
|
4767
4808
|
this.thinkScheduler.cancel(entity);
|
|
4768
4809
|
this.spatialGrid.remove(entity);
|