quake2ts 0.0.496 → 0.0.497
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 +16 -16
- package/packages/client/dist/browser/index.global.js.map +1 -1
- package/packages/client/dist/tsconfig.tsbuildinfo +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 +196 -32
- package/packages/game/dist/cjs/index.cjs.map +1 -1
- package/packages/game/dist/esm/index.js +196 -32
- package/packages/game/dist/esm/index.js.map +1 -1
- package/packages/game/dist/tsconfig.tsbuildinfo +1 -1
- package/packages/game/dist/types/entities/player.d.ts.map +1 -1
- package/packages/game/dist/types/entities/playerStats.d.ts.map +1 -1
- package/packages/game/dist/types/entities/projectiles.d.ts +5 -0
- package/packages/game/dist/types/entities/projectiles.d.ts.map +1 -1
- package/packages/game/dist/types/entities/system.d.ts +1 -0
- package/packages/game/dist/types/entities/system.d.ts.map +1 -1
- package/packages/game/dist/types/inventory/items.d.ts.map +1 -1
- package/packages/game/dist/types/inventory/playerInventory.d.ts +1 -0
- package/packages/game/dist/types/inventory/playerInventory.d.ts.map +1 -1
- package/packages/game/dist/types/modes/ctf/capture.d.ts.map +1 -1
- package/packages/game/dist/types/modes/ctf/grapple.d.ts +13 -0
- package/packages/game/dist/types/modes/ctf/grapple.d.ts.map +1 -0
- package/packages/game/dist/types/modes/ctf/pickup.d.ts.map +1 -1
- package/packages/game/dist/types/modes/ctf/scoreboard.d.ts +34 -0
- package/packages/game/dist/types/modes/ctf/scoreboard.d.ts.map +1 -0
|
@@ -811,36 +811,36 @@ var MAX_ITEMS = 256;
|
|
|
811
811
|
var MAX_GENERAL = MAX_CLIENTS * 2;
|
|
812
812
|
var MAX_SHADOW_LIGHTS = 256;
|
|
813
813
|
var MAX_WHEEL_ITEMS = 32;
|
|
814
|
-
var ConfigStringIndex = ((
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
return
|
|
814
|
+
var ConfigStringIndex = ((ConfigStringIndex22) => {
|
|
815
|
+
ConfigStringIndex22[ConfigStringIndex22["Name"] = 0] = "Name";
|
|
816
|
+
ConfigStringIndex22[ConfigStringIndex22["CdTrack"] = 1] = "CdTrack";
|
|
817
|
+
ConfigStringIndex22[ConfigStringIndex22["Sky"] = 2] = "Sky";
|
|
818
|
+
ConfigStringIndex22[ConfigStringIndex22["SkyAxis"] = 3] = "SkyAxis";
|
|
819
|
+
ConfigStringIndex22[ConfigStringIndex22["SkyRotate"] = 4] = "SkyRotate";
|
|
820
|
+
ConfigStringIndex22[ConfigStringIndex22["StatusBar"] = 5] = "StatusBar";
|
|
821
|
+
ConfigStringIndex22[ConfigStringIndex22["HealthBarName"] = 55] = "HealthBarName";
|
|
822
|
+
ConfigStringIndex22[ConfigStringIndex22["CONFIG_N64_PHYSICS"] = 56] = "CONFIG_N64_PHYSICS";
|
|
823
|
+
ConfigStringIndex22[ConfigStringIndex22["CONFIG_CTF_TEAMS"] = 57] = "CONFIG_CTF_TEAMS";
|
|
824
|
+
ConfigStringIndex22[ConfigStringIndex22["CONFIG_COOP_RESPAWN_STRING"] = 58] = "CONFIG_COOP_RESPAWN_STRING";
|
|
825
|
+
ConfigStringIndex22[ConfigStringIndex22["Story"] = 54] = "Story";
|
|
826
|
+
ConfigStringIndex22[ConfigStringIndex22["AirAccel"] = 59] = "AirAccel";
|
|
827
|
+
ConfigStringIndex22[ConfigStringIndex22["MaxClients"] = 60] = "MaxClients";
|
|
828
|
+
ConfigStringIndex22[ConfigStringIndex22["MapChecksum"] = 61] = "MapChecksum";
|
|
829
|
+
ConfigStringIndex22[ConfigStringIndex22["Models"] = 62] = "Models";
|
|
830
|
+
ConfigStringIndex22[ConfigStringIndex22["Sounds"] = 62 + MAX_MODELS] = "Sounds";
|
|
831
|
+
ConfigStringIndex22[ConfigStringIndex22["Images"] = ConfigStringIndex22.Sounds + MAX_SOUNDS] = "Images";
|
|
832
|
+
ConfigStringIndex22[ConfigStringIndex22["Lights"] = ConfigStringIndex22.Images + MAX_IMAGES] = "Lights";
|
|
833
|
+
ConfigStringIndex22[ConfigStringIndex22["ShadowLights"] = ConfigStringIndex22.Lights + MAX_LIGHTSTYLES] = "ShadowLights";
|
|
834
|
+
ConfigStringIndex22[ConfigStringIndex22["Items"] = ConfigStringIndex22.ShadowLights + MAX_SHADOW_LIGHTS] = "Items";
|
|
835
|
+
ConfigStringIndex22[ConfigStringIndex22["PlayerSkins"] = ConfigStringIndex22.Items + MAX_ITEMS] = "PlayerSkins";
|
|
836
|
+
ConfigStringIndex22[ConfigStringIndex22["General"] = ConfigStringIndex22.PlayerSkins + MAX_CLIENTS] = "General";
|
|
837
|
+
ConfigStringIndex22[ConfigStringIndex22["WheelWeapons"] = ConfigStringIndex22.General + MAX_GENERAL] = "WheelWeapons";
|
|
838
|
+
ConfigStringIndex22[ConfigStringIndex22["WheelAmmo"] = ConfigStringIndex22.WheelWeapons + MAX_WHEEL_ITEMS] = "WheelAmmo";
|
|
839
|
+
ConfigStringIndex22[ConfigStringIndex22["WheelPowerups"] = ConfigStringIndex22.WheelAmmo + MAX_WHEEL_ITEMS] = "WheelPowerups";
|
|
840
|
+
ConfigStringIndex22[ConfigStringIndex22["CdLoopCount"] = ConfigStringIndex22.WheelPowerups + MAX_WHEEL_ITEMS] = "CdLoopCount";
|
|
841
|
+
ConfigStringIndex22[ConfigStringIndex22["GameStyle"] = ConfigStringIndex22.CdLoopCount + 1] = "GameStyle";
|
|
842
|
+
ConfigStringIndex22[ConfigStringIndex22["MaxConfigStrings"] = ConfigStringIndex22.GameStyle + 1] = "MaxConfigStrings";
|
|
843
|
+
return ConfigStringIndex22;
|
|
844
844
|
})(ConfigStringIndex || {});
|
|
845
845
|
var MAX_CONFIGSTRINGS = ConfigStringIndex.MaxConfigStrings;
|
|
846
846
|
var replay_exports = {};
|
|
@@ -5327,6 +5327,9 @@ var EntitySystem = class {
|
|
|
5327
5327
|
soundIndex(sound) {
|
|
5328
5328
|
return this.engine.soundIndex?.(sound) || 0;
|
|
5329
5329
|
}
|
|
5330
|
+
configStringIndex(str) {
|
|
5331
|
+
return this.engine.configStringIndex?.(str) || 0;
|
|
5332
|
+
}
|
|
5330
5333
|
modelIndex(model) {
|
|
5331
5334
|
return this.engine.modelIndex?.(model) || 0;
|
|
5332
5335
|
}
|
|
@@ -5339,8 +5342,8 @@ var EntitySystem = class {
|
|
|
5339
5342
|
unlink(ent) {
|
|
5340
5343
|
this.spatialGrid.remove(ent);
|
|
5341
5344
|
}
|
|
5342
|
-
multicast(origin, type,
|
|
5343
|
-
this.imports.multicast(origin, type,
|
|
5345
|
+
multicast(origin, type, ServerCommand7, ...args) {
|
|
5346
|
+
this.imports.multicast(origin, type, ServerCommand7, ...args);
|
|
5344
5347
|
}
|
|
5345
5348
|
unicast(ent, reliable, event, ...args) {
|
|
5346
5349
|
this.imports.unicast(ent, reliable, event, ...args);
|
|
@@ -6081,6 +6084,19 @@ function createTrap(context, owner, start, dir, speed) {
|
|
|
6081
6084
|
// src/entities/projectiles.ts
|
|
6082
6085
|
var BFG_LASER_RADIUS = 256;
|
|
6083
6086
|
var BFG_LASER_RANGE = 2048;
|
|
6087
|
+
function createProjectile(sys, start, dir, speed, mod, damage, radiusDamage) {
|
|
6088
|
+
const proj = sys.spawn();
|
|
6089
|
+
proj.movetype = 8 /* FlyMissile */;
|
|
6090
|
+
proj.solid = 2 /* BoundingBox */;
|
|
6091
|
+
proj.origin = { ...start };
|
|
6092
|
+
proj.velocity = { x: dir.x * speed, y: dir.y * speed, z: dir.z * speed };
|
|
6093
|
+
proj.mins = { x: -4, y: -4, z: -4 };
|
|
6094
|
+
proj.maxs = { x: 4, y: 4, z: 4 };
|
|
6095
|
+
proj.angles = vectorToAngles(dir);
|
|
6096
|
+
proj.takedamage = false;
|
|
6097
|
+
sys.finalizeSpawn(proj);
|
|
6098
|
+
return proj;
|
|
6099
|
+
}
|
|
6084
6100
|
function createRocket(sys, owner, start, dir, damage, radiusDamage, speed, flashtype = 0) {
|
|
6085
6101
|
const rocket = sys.spawn();
|
|
6086
6102
|
rocket.classname = "rocket";
|
|
@@ -10120,6 +10136,95 @@ function Trap_Think(player, sys) {
|
|
|
10120
10136
|
);
|
|
10121
10137
|
}
|
|
10122
10138
|
|
|
10139
|
+
// src/modes/ctf/grapple.ts
|
|
10140
|
+
var GRAPPLE_SPEED = 1200;
|
|
10141
|
+
var GRAPPLE_PULL_SPEED = 800;
|
|
10142
|
+
var GRAPPLE_DAMAGE = 20;
|
|
10143
|
+
function Grapple_Think(player, sys) {
|
|
10144
|
+
if (player.client?.inventory.currentWeapon !== WeaponId.Grapple) {
|
|
10145
|
+
ResetGrapple(player, sys);
|
|
10146
|
+
}
|
|
10147
|
+
Weapon_Generic(
|
|
10148
|
+
player,
|
|
10149
|
+
0,
|
|
10150
|
+
10,
|
|
10151
|
+
// ready
|
|
10152
|
+
11,
|
|
10153
|
+
20,
|
|
10154
|
+
// fire
|
|
10155
|
+
[],
|
|
10156
|
+
// pause frames
|
|
10157
|
+
[11],
|
|
10158
|
+
// fire frames
|
|
10159
|
+
(ent) => fire_grapple(ent, sys),
|
|
10160
|
+
sys
|
|
10161
|
+
);
|
|
10162
|
+
if (player.client && !(player.client.buttons & 1)) {
|
|
10163
|
+
ResetGrapple(player, sys);
|
|
10164
|
+
}
|
|
10165
|
+
if (player.grapple && player.grapple.grappleState === "attached") {
|
|
10166
|
+
Grapple_Pull(player, player.grapple, sys);
|
|
10167
|
+
}
|
|
10168
|
+
}
|
|
10169
|
+
function fire_grapple(player, sys) {
|
|
10170
|
+
if (player.grapple) return;
|
|
10171
|
+
const angles = player.client.v_angle || player.angles;
|
|
10172
|
+
const vectors = angleVectors(angles);
|
|
10173
|
+
const forward = vectors.forward;
|
|
10174
|
+
const right = vectors.right;
|
|
10175
|
+
const up = vectors.up;
|
|
10176
|
+
const game = sys.game;
|
|
10177
|
+
const start = P_ProjectSource(game, player, { x: 8, y: 8, z: 8 }, forward, right, up);
|
|
10178
|
+
const dir = { ...forward };
|
|
10179
|
+
const grapple = createProjectile(sys, start, dir, GRAPPLE_SPEED, 57 /* GRAPPLE */, 0);
|
|
10180
|
+
grapple.classname = "grapple";
|
|
10181
|
+
grapple.owner = player;
|
|
10182
|
+
grapple.movetype = 8 /* FlyMissile */;
|
|
10183
|
+
grapple.solid = 2 /* BoundingBox */;
|
|
10184
|
+
grapple.mins = { x: -4, y: -4, z: -4 };
|
|
10185
|
+
grapple.maxs = { x: 4, y: 4, z: 4 };
|
|
10186
|
+
grapple.model = "models/weapons/grapple/hook/tris.md2";
|
|
10187
|
+
grapple.grappleState = "fly";
|
|
10188
|
+
grapple.touch = (self, other, plane, surface) => {
|
|
10189
|
+
if (!other) return;
|
|
10190
|
+
Grapple_Touch(self, other, plane, surface, sys);
|
|
10191
|
+
};
|
|
10192
|
+
player.grapple = grapple;
|
|
10193
|
+
sys.sound(player, 0, "weapons/grapple/throw.wav", 1, 1, 0);
|
|
10194
|
+
}
|
|
10195
|
+
function Grapple_Touch(self, other, plane, surface, sys) {
|
|
10196
|
+
if (other === self.owner) return;
|
|
10197
|
+
if (self.grappleState === "attached") return;
|
|
10198
|
+
if (other.takedamage) {
|
|
10199
|
+
T_Damage(other, self, self.owner, self.velocity, self.origin, ZERO_VEC3, GRAPPLE_DAMAGE, 0, 0, 57 /* GRAPPLE */, sys.timeSeconds, sys.multicast.bind(sys));
|
|
10200
|
+
sys.free(self);
|
|
10201
|
+
if (self.owner) self.owner.grapple = void 0;
|
|
10202
|
+
return;
|
|
10203
|
+
}
|
|
10204
|
+
if (other.solid === 3 /* Bsp */ || other.solid === 2 /* BoundingBox */) {
|
|
10205
|
+
self.velocity = { x: 0, y: 0, z: 0 };
|
|
10206
|
+
self.movetype = 0 /* None */;
|
|
10207
|
+
self.grappleState = "attached";
|
|
10208
|
+
sys.sound(self, 0, "weapons/grapple/hit.wav", 1, 1, 0);
|
|
10209
|
+
if (plane) {
|
|
10210
|
+
}
|
|
10211
|
+
}
|
|
10212
|
+
}
|
|
10213
|
+
function Grapple_Pull(player, grapple, sys) {
|
|
10214
|
+
const dir = subtractVec3(grapple.origin, player.origin);
|
|
10215
|
+
const dist = lengthVec3(dir);
|
|
10216
|
+
if (dist < 32) return;
|
|
10217
|
+
const normalizedDir = normalizeVec3(dir);
|
|
10218
|
+
const pull = scaleVec3(normalizedDir, GRAPPLE_PULL_SPEED);
|
|
10219
|
+
player.velocity = pull;
|
|
10220
|
+
}
|
|
10221
|
+
function ResetGrapple(player, sys) {
|
|
10222
|
+
if (player.grapple) {
|
|
10223
|
+
sys.free(player.grapple);
|
|
10224
|
+
player.grapple = void 0;
|
|
10225
|
+
}
|
|
10226
|
+
}
|
|
10227
|
+
|
|
10123
10228
|
// src/inventory/items.ts
|
|
10124
10229
|
var WEAPON_ITEMS = {
|
|
10125
10230
|
"weapon_blaster": {
|
|
@@ -10317,6 +10422,18 @@ var WEAPON_ITEMS = {
|
|
|
10317
10422
|
pickupAmmo: 5,
|
|
10318
10423
|
fireRate: 1,
|
|
10319
10424
|
think: Trap_Think
|
|
10425
|
+
},
|
|
10426
|
+
"weapon_grapple": {
|
|
10427
|
+
type: "weapon",
|
|
10428
|
+
id: "weapon_grapple",
|
|
10429
|
+
name: "Grapple",
|
|
10430
|
+
weaponId: WeaponId.Grapple,
|
|
10431
|
+
ammoType: null,
|
|
10432
|
+
// Grapple uses no ammo in standard Q2 CTF? Or maybe just internal timer.
|
|
10433
|
+
initialAmmo: 0,
|
|
10434
|
+
pickupAmmo: 0,
|
|
10435
|
+
fireRate: 0.5,
|
|
10436
|
+
think: Grapple_Think
|
|
10320
10437
|
}
|
|
10321
10438
|
};
|
|
10322
10439
|
var HEALTH_ITEMS = {
|
|
@@ -10718,6 +10835,34 @@ function setFlagState(flag, newState, context) {
|
|
|
10718
10835
|
flag.flagState = newState;
|
|
10719
10836
|
}
|
|
10720
10837
|
|
|
10838
|
+
// src/modes/ctf/scoreboard.ts
|
|
10839
|
+
var teamScores = {
|
|
10840
|
+
[1 /* RED */]: 0,
|
|
10841
|
+
[2 /* BLUE */]: 0
|
|
10842
|
+
};
|
|
10843
|
+
function addTeamScore(team, points) {
|
|
10844
|
+
if (team === 1 /* RED */ || team === 2 /* BLUE */) {
|
|
10845
|
+
teamScores[team] += points;
|
|
10846
|
+
}
|
|
10847
|
+
}
|
|
10848
|
+
function updateCtfScoreboard(ent, sys) {
|
|
10849
|
+
if (!ent.client || !ent.client.stats) return;
|
|
10850
|
+
const stats = ent.client.stats;
|
|
10851
|
+
stats[PlayerStat.STAT_CTF_TEAM1_PIC] = sys.configStringIndex ? sys.configStringIndex("pics/ctf_r.pcx") : 0;
|
|
10852
|
+
stats[PlayerStat.STAT_CTF_TEAM1_CAPS] = teamScores[1 /* RED */];
|
|
10853
|
+
stats[PlayerStat.STAT_CTF_TEAM2_PIC] = sys.configStringIndex ? sys.configStringIndex("pics/ctf_b.pcx") : 0;
|
|
10854
|
+
stats[PlayerStat.STAT_CTF_TEAM2_CAPS] = teamScores[2 /* BLUE */];
|
|
10855
|
+
const clientTeam = ent.client.ctfTeam;
|
|
10856
|
+
stats[PlayerStat.STAT_CTF_JOINED_TEAM1_PIC] = 0;
|
|
10857
|
+
stats[PlayerStat.STAT_CTF_JOINED_TEAM2_PIC] = 0;
|
|
10858
|
+
if (clientTeam === 1 /* RED */) {
|
|
10859
|
+
stats[PlayerStat.STAT_CTF_JOINED_TEAM1_PIC] = sys.configStringIndex ? sys.configStringIndex("pics/ctf_r.pcx") : 0;
|
|
10860
|
+
} else if (clientTeam === 2 /* BLUE */) {
|
|
10861
|
+
stats[PlayerStat.STAT_CTF_JOINED_TEAM2_PIC] = sys.configStringIndex ? sys.configStringIndex("pics/ctf_b.pcx") : 0;
|
|
10862
|
+
}
|
|
10863
|
+
stats[PlayerStat.STAT_CTF_TEAMINFO] = 1;
|
|
10864
|
+
}
|
|
10865
|
+
|
|
10721
10866
|
// src/modes/ctf/capture.ts
|
|
10722
10867
|
function checkCapture(flag, player, game, context) {
|
|
10723
10868
|
if (!player.client) return false;
|
|
@@ -10738,11 +10883,17 @@ function captureFlag(ownFlag, player, game, context) {
|
|
|
10738
10883
|
if (!player.client) return false;
|
|
10739
10884
|
const playerTeam = player.client.team || "red";
|
|
10740
10885
|
const enemyTeam = playerTeam === "red" ? "blue" : "red";
|
|
10886
|
+
const ctfStats = player.client.ctfStats;
|
|
10887
|
+
if (ctfStats) {
|
|
10888
|
+
ctfStats.captures++;
|
|
10889
|
+
}
|
|
10741
10890
|
if (player.client.score !== void 0) {
|
|
10742
10891
|
player.client.score += 5;
|
|
10743
10892
|
} else {
|
|
10744
10893
|
player.client.score = 5;
|
|
10745
10894
|
}
|
|
10895
|
+
const teamEnum = playerTeam === "red" ? 1 /* RED */ : 2 /* BLUE */;
|
|
10896
|
+
addTeamScore(teamEnum, 1);
|
|
10746
10897
|
game.sound?.(player, 0, "ctf/flagcap.wav", 1, 1, 0);
|
|
10747
10898
|
game.centerprintf?.(player, "You captured the flag!");
|
|
10748
10899
|
const enemyFlagKey = playerTeam === "red" ? "key_blue_flag" /* BlueFlag */ : "key_red_flag" /* RedFlag */;
|
|
@@ -26372,6 +26523,9 @@ function player_think(self, sys) {
|
|
|
26372
26523
|
}
|
|
26373
26524
|
}
|
|
26374
26525
|
P_PlayerThink(self, sys);
|
|
26526
|
+
if (sys.deathmatch && (sys.configStringIndex ? sys.configStringIndex("pics/ctf_r.pcx") > 0 : true)) {
|
|
26527
|
+
updateCtfScoreboard(self, sys);
|
|
26528
|
+
}
|
|
26375
26529
|
self.nextthink = sys.timeSeconds + 0.1;
|
|
26376
26530
|
sys.scheduleThink(self, self.nextthink);
|
|
26377
26531
|
}
|
|
@@ -26439,6 +26593,16 @@ function populatePlayerStats(player, timeSeconds) {
|
|
|
26439
26593
|
const remainingSeconds = Math.ceil((bestTime - nowMs) / 1e3);
|
|
26440
26594
|
statArray[PlayerStat.STAT_TIMER] = remainingSeconds;
|
|
26441
26595
|
}
|
|
26596
|
+
if (player.client.score !== void 0) {
|
|
26597
|
+
statArray[PlayerStat.STAT_FRAGS] = player.client.score;
|
|
26598
|
+
}
|
|
26599
|
+
if (player.client.stats) {
|
|
26600
|
+
for (let i = 0; i < player.client.stats.length; i++) {
|
|
26601
|
+
if (player.client.stats[i] !== 0) {
|
|
26602
|
+
statArray[i] = player.client.stats[i];
|
|
26603
|
+
}
|
|
26604
|
+
}
|
|
26605
|
+
}
|
|
26442
26606
|
return statArray;
|
|
26443
26607
|
}
|
|
26444
26608
|
|