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
|
@@ -611,36 +611,36 @@ var MAX_ITEMS = 256;
|
|
|
611
611
|
var MAX_GENERAL = MAX_CLIENTS * 2;
|
|
612
612
|
var MAX_SHADOW_LIGHTS = 256;
|
|
613
613
|
var MAX_WHEEL_ITEMS = 32;
|
|
614
|
-
var ConfigStringIndex = ((
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
return
|
|
614
|
+
var ConfigStringIndex = ((ConfigStringIndex22) => {
|
|
615
|
+
ConfigStringIndex22[ConfigStringIndex22["Name"] = 0] = "Name";
|
|
616
|
+
ConfigStringIndex22[ConfigStringIndex22["CdTrack"] = 1] = "CdTrack";
|
|
617
|
+
ConfigStringIndex22[ConfigStringIndex22["Sky"] = 2] = "Sky";
|
|
618
|
+
ConfigStringIndex22[ConfigStringIndex22["SkyAxis"] = 3] = "SkyAxis";
|
|
619
|
+
ConfigStringIndex22[ConfigStringIndex22["SkyRotate"] = 4] = "SkyRotate";
|
|
620
|
+
ConfigStringIndex22[ConfigStringIndex22["StatusBar"] = 5] = "StatusBar";
|
|
621
|
+
ConfigStringIndex22[ConfigStringIndex22["HealthBarName"] = 55] = "HealthBarName";
|
|
622
|
+
ConfigStringIndex22[ConfigStringIndex22["CONFIG_N64_PHYSICS"] = 56] = "CONFIG_N64_PHYSICS";
|
|
623
|
+
ConfigStringIndex22[ConfigStringIndex22["CONFIG_CTF_TEAMS"] = 57] = "CONFIG_CTF_TEAMS";
|
|
624
|
+
ConfigStringIndex22[ConfigStringIndex22["CONFIG_COOP_RESPAWN_STRING"] = 58] = "CONFIG_COOP_RESPAWN_STRING";
|
|
625
|
+
ConfigStringIndex22[ConfigStringIndex22["Story"] = 54] = "Story";
|
|
626
|
+
ConfigStringIndex22[ConfigStringIndex22["AirAccel"] = 59] = "AirAccel";
|
|
627
|
+
ConfigStringIndex22[ConfigStringIndex22["MaxClients"] = 60] = "MaxClients";
|
|
628
|
+
ConfigStringIndex22[ConfigStringIndex22["MapChecksum"] = 61] = "MapChecksum";
|
|
629
|
+
ConfigStringIndex22[ConfigStringIndex22["Models"] = 62] = "Models";
|
|
630
|
+
ConfigStringIndex22[ConfigStringIndex22["Sounds"] = 62 + MAX_MODELS] = "Sounds";
|
|
631
|
+
ConfigStringIndex22[ConfigStringIndex22["Images"] = ConfigStringIndex22.Sounds + MAX_SOUNDS] = "Images";
|
|
632
|
+
ConfigStringIndex22[ConfigStringIndex22["Lights"] = ConfigStringIndex22.Images + MAX_IMAGES] = "Lights";
|
|
633
|
+
ConfigStringIndex22[ConfigStringIndex22["ShadowLights"] = ConfigStringIndex22.Lights + MAX_LIGHTSTYLES] = "ShadowLights";
|
|
634
|
+
ConfigStringIndex22[ConfigStringIndex22["Items"] = ConfigStringIndex22.ShadowLights + MAX_SHADOW_LIGHTS] = "Items";
|
|
635
|
+
ConfigStringIndex22[ConfigStringIndex22["PlayerSkins"] = ConfigStringIndex22.Items + MAX_ITEMS] = "PlayerSkins";
|
|
636
|
+
ConfigStringIndex22[ConfigStringIndex22["General"] = ConfigStringIndex22.PlayerSkins + MAX_CLIENTS] = "General";
|
|
637
|
+
ConfigStringIndex22[ConfigStringIndex22["WheelWeapons"] = ConfigStringIndex22.General + MAX_GENERAL] = "WheelWeapons";
|
|
638
|
+
ConfigStringIndex22[ConfigStringIndex22["WheelAmmo"] = ConfigStringIndex22.WheelWeapons + MAX_WHEEL_ITEMS] = "WheelAmmo";
|
|
639
|
+
ConfigStringIndex22[ConfigStringIndex22["WheelPowerups"] = ConfigStringIndex22.WheelAmmo + MAX_WHEEL_ITEMS] = "WheelPowerups";
|
|
640
|
+
ConfigStringIndex22[ConfigStringIndex22["CdLoopCount"] = ConfigStringIndex22.WheelPowerups + MAX_WHEEL_ITEMS] = "CdLoopCount";
|
|
641
|
+
ConfigStringIndex22[ConfigStringIndex22["GameStyle"] = ConfigStringIndex22.CdLoopCount + 1] = "GameStyle";
|
|
642
|
+
ConfigStringIndex22[ConfigStringIndex22["MaxConfigStrings"] = ConfigStringIndex22.GameStyle + 1] = "MaxConfigStrings";
|
|
643
|
+
return ConfigStringIndex22;
|
|
644
644
|
})(ConfigStringIndex || {});
|
|
645
645
|
var MAX_CONFIGSTRINGS = ConfigStringIndex.MaxConfigStrings;
|
|
646
646
|
var replay_exports = {};
|
|
@@ -5127,6 +5127,9 @@ var EntitySystem = class {
|
|
|
5127
5127
|
soundIndex(sound) {
|
|
5128
5128
|
return this.engine.soundIndex?.(sound) || 0;
|
|
5129
5129
|
}
|
|
5130
|
+
configStringIndex(str) {
|
|
5131
|
+
return this.engine.configStringIndex?.(str) || 0;
|
|
5132
|
+
}
|
|
5130
5133
|
modelIndex(model) {
|
|
5131
5134
|
return this.engine.modelIndex?.(model) || 0;
|
|
5132
5135
|
}
|
|
@@ -5139,8 +5142,8 @@ var EntitySystem = class {
|
|
|
5139
5142
|
unlink(ent) {
|
|
5140
5143
|
this.spatialGrid.remove(ent);
|
|
5141
5144
|
}
|
|
5142
|
-
multicast(origin, type,
|
|
5143
|
-
this.imports.multicast(origin, type,
|
|
5145
|
+
multicast(origin, type, ServerCommand7, ...args) {
|
|
5146
|
+
this.imports.multicast(origin, type, ServerCommand7, ...args);
|
|
5144
5147
|
}
|
|
5145
5148
|
unicast(ent, reliable, event, ...args) {
|
|
5146
5149
|
this.imports.unicast(ent, reliable, event, ...args);
|
|
@@ -5881,6 +5884,19 @@ function createTrap(context, owner, start, dir, speed) {
|
|
|
5881
5884
|
// src/entities/projectiles.ts
|
|
5882
5885
|
var BFG_LASER_RADIUS = 256;
|
|
5883
5886
|
var BFG_LASER_RANGE = 2048;
|
|
5887
|
+
function createProjectile(sys, start, dir, speed, mod, damage, radiusDamage) {
|
|
5888
|
+
const proj = sys.spawn();
|
|
5889
|
+
proj.movetype = 8 /* FlyMissile */;
|
|
5890
|
+
proj.solid = 2 /* BoundingBox */;
|
|
5891
|
+
proj.origin = { ...start };
|
|
5892
|
+
proj.velocity = { x: dir.x * speed, y: dir.y * speed, z: dir.z * speed };
|
|
5893
|
+
proj.mins = { x: -4, y: -4, z: -4 };
|
|
5894
|
+
proj.maxs = { x: 4, y: 4, z: 4 };
|
|
5895
|
+
proj.angles = vectorToAngles(dir);
|
|
5896
|
+
proj.takedamage = false;
|
|
5897
|
+
sys.finalizeSpawn(proj);
|
|
5898
|
+
return proj;
|
|
5899
|
+
}
|
|
5884
5900
|
function createRocket(sys, owner, start, dir, damage, radiusDamage, speed, flashtype = 0) {
|
|
5885
5901
|
const rocket = sys.spawn();
|
|
5886
5902
|
rocket.classname = "rocket";
|
|
@@ -9920,6 +9936,95 @@ function Trap_Think(player, sys) {
|
|
|
9920
9936
|
);
|
|
9921
9937
|
}
|
|
9922
9938
|
|
|
9939
|
+
// src/modes/ctf/grapple.ts
|
|
9940
|
+
var GRAPPLE_SPEED = 1200;
|
|
9941
|
+
var GRAPPLE_PULL_SPEED = 800;
|
|
9942
|
+
var GRAPPLE_DAMAGE = 20;
|
|
9943
|
+
function Grapple_Think(player, sys) {
|
|
9944
|
+
if (player.client?.inventory.currentWeapon !== WeaponId.Grapple) {
|
|
9945
|
+
ResetGrapple(player, sys);
|
|
9946
|
+
}
|
|
9947
|
+
Weapon_Generic(
|
|
9948
|
+
player,
|
|
9949
|
+
0,
|
|
9950
|
+
10,
|
|
9951
|
+
// ready
|
|
9952
|
+
11,
|
|
9953
|
+
20,
|
|
9954
|
+
// fire
|
|
9955
|
+
[],
|
|
9956
|
+
// pause frames
|
|
9957
|
+
[11],
|
|
9958
|
+
// fire frames
|
|
9959
|
+
(ent) => fire_grapple(ent, sys),
|
|
9960
|
+
sys
|
|
9961
|
+
);
|
|
9962
|
+
if (player.client && !(player.client.buttons & 1)) {
|
|
9963
|
+
ResetGrapple(player, sys);
|
|
9964
|
+
}
|
|
9965
|
+
if (player.grapple && player.grapple.grappleState === "attached") {
|
|
9966
|
+
Grapple_Pull(player, player.grapple, sys);
|
|
9967
|
+
}
|
|
9968
|
+
}
|
|
9969
|
+
function fire_grapple(player, sys) {
|
|
9970
|
+
if (player.grapple) return;
|
|
9971
|
+
const angles = player.client.v_angle || player.angles;
|
|
9972
|
+
const vectors = angleVectors(angles);
|
|
9973
|
+
const forward = vectors.forward;
|
|
9974
|
+
const right = vectors.right;
|
|
9975
|
+
const up = vectors.up;
|
|
9976
|
+
const game = sys.game;
|
|
9977
|
+
const start = P_ProjectSource(game, player, { x: 8, y: 8, z: 8 }, forward, right, up);
|
|
9978
|
+
const dir = { ...forward };
|
|
9979
|
+
const grapple = createProjectile(sys, start, dir, GRAPPLE_SPEED, 57 /* GRAPPLE */, 0);
|
|
9980
|
+
grapple.classname = "grapple";
|
|
9981
|
+
grapple.owner = player;
|
|
9982
|
+
grapple.movetype = 8 /* FlyMissile */;
|
|
9983
|
+
grapple.solid = 2 /* BoundingBox */;
|
|
9984
|
+
grapple.mins = { x: -4, y: -4, z: -4 };
|
|
9985
|
+
grapple.maxs = { x: 4, y: 4, z: 4 };
|
|
9986
|
+
grapple.model = "models/weapons/grapple/hook/tris.md2";
|
|
9987
|
+
grapple.grappleState = "fly";
|
|
9988
|
+
grapple.touch = (self, other, plane, surface) => {
|
|
9989
|
+
if (!other) return;
|
|
9990
|
+
Grapple_Touch(self, other, plane, surface, sys);
|
|
9991
|
+
};
|
|
9992
|
+
player.grapple = grapple;
|
|
9993
|
+
sys.sound(player, 0, "weapons/grapple/throw.wav", 1, 1, 0);
|
|
9994
|
+
}
|
|
9995
|
+
function Grapple_Touch(self, other, plane, surface, sys) {
|
|
9996
|
+
if (other === self.owner) return;
|
|
9997
|
+
if (self.grappleState === "attached") return;
|
|
9998
|
+
if (other.takedamage) {
|
|
9999
|
+
T_Damage(other, self, self.owner, self.velocity, self.origin, ZERO_VEC3, GRAPPLE_DAMAGE, 0, 0, 57 /* GRAPPLE */, sys.timeSeconds, sys.multicast.bind(sys));
|
|
10000
|
+
sys.free(self);
|
|
10001
|
+
if (self.owner) self.owner.grapple = void 0;
|
|
10002
|
+
return;
|
|
10003
|
+
}
|
|
10004
|
+
if (other.solid === 3 /* Bsp */ || other.solid === 2 /* BoundingBox */) {
|
|
10005
|
+
self.velocity = { x: 0, y: 0, z: 0 };
|
|
10006
|
+
self.movetype = 0 /* None */;
|
|
10007
|
+
self.grappleState = "attached";
|
|
10008
|
+
sys.sound(self, 0, "weapons/grapple/hit.wav", 1, 1, 0);
|
|
10009
|
+
if (plane) {
|
|
10010
|
+
}
|
|
10011
|
+
}
|
|
10012
|
+
}
|
|
10013
|
+
function Grapple_Pull(player, grapple, sys) {
|
|
10014
|
+
const dir = subtractVec3(grapple.origin, player.origin);
|
|
10015
|
+
const dist = lengthVec3(dir);
|
|
10016
|
+
if (dist < 32) return;
|
|
10017
|
+
const normalizedDir = normalizeVec3(dir);
|
|
10018
|
+
const pull = scaleVec3(normalizedDir, GRAPPLE_PULL_SPEED);
|
|
10019
|
+
player.velocity = pull;
|
|
10020
|
+
}
|
|
10021
|
+
function ResetGrapple(player, sys) {
|
|
10022
|
+
if (player.grapple) {
|
|
10023
|
+
sys.free(player.grapple);
|
|
10024
|
+
player.grapple = void 0;
|
|
10025
|
+
}
|
|
10026
|
+
}
|
|
10027
|
+
|
|
9923
10028
|
// src/inventory/items.ts
|
|
9924
10029
|
var WEAPON_ITEMS = {
|
|
9925
10030
|
"weapon_blaster": {
|
|
@@ -10117,6 +10222,18 @@ var WEAPON_ITEMS = {
|
|
|
10117
10222
|
pickupAmmo: 5,
|
|
10118
10223
|
fireRate: 1,
|
|
10119
10224
|
think: Trap_Think
|
|
10225
|
+
},
|
|
10226
|
+
"weapon_grapple": {
|
|
10227
|
+
type: "weapon",
|
|
10228
|
+
id: "weapon_grapple",
|
|
10229
|
+
name: "Grapple",
|
|
10230
|
+
weaponId: WeaponId.Grapple,
|
|
10231
|
+
ammoType: null,
|
|
10232
|
+
// Grapple uses no ammo in standard Q2 CTF? Or maybe just internal timer.
|
|
10233
|
+
initialAmmo: 0,
|
|
10234
|
+
pickupAmmo: 0,
|
|
10235
|
+
fireRate: 0.5,
|
|
10236
|
+
think: Grapple_Think
|
|
10120
10237
|
}
|
|
10121
10238
|
};
|
|
10122
10239
|
var HEALTH_ITEMS = {
|
|
@@ -10518,6 +10635,34 @@ function setFlagState(flag, newState, context) {
|
|
|
10518
10635
|
flag.flagState = newState;
|
|
10519
10636
|
}
|
|
10520
10637
|
|
|
10638
|
+
// src/modes/ctf/scoreboard.ts
|
|
10639
|
+
var teamScores = {
|
|
10640
|
+
[1 /* RED */]: 0,
|
|
10641
|
+
[2 /* BLUE */]: 0
|
|
10642
|
+
};
|
|
10643
|
+
function addTeamScore(team, points) {
|
|
10644
|
+
if (team === 1 /* RED */ || team === 2 /* BLUE */) {
|
|
10645
|
+
teamScores[team] += points;
|
|
10646
|
+
}
|
|
10647
|
+
}
|
|
10648
|
+
function updateCtfScoreboard(ent, sys) {
|
|
10649
|
+
if (!ent.client || !ent.client.stats) return;
|
|
10650
|
+
const stats = ent.client.stats;
|
|
10651
|
+
stats[PlayerStat.STAT_CTF_TEAM1_PIC] = sys.configStringIndex ? sys.configStringIndex("pics/ctf_r.pcx") : 0;
|
|
10652
|
+
stats[PlayerStat.STAT_CTF_TEAM1_CAPS] = teamScores[1 /* RED */];
|
|
10653
|
+
stats[PlayerStat.STAT_CTF_TEAM2_PIC] = sys.configStringIndex ? sys.configStringIndex("pics/ctf_b.pcx") : 0;
|
|
10654
|
+
stats[PlayerStat.STAT_CTF_TEAM2_CAPS] = teamScores[2 /* BLUE */];
|
|
10655
|
+
const clientTeam = ent.client.ctfTeam;
|
|
10656
|
+
stats[PlayerStat.STAT_CTF_JOINED_TEAM1_PIC] = 0;
|
|
10657
|
+
stats[PlayerStat.STAT_CTF_JOINED_TEAM2_PIC] = 0;
|
|
10658
|
+
if (clientTeam === 1 /* RED */) {
|
|
10659
|
+
stats[PlayerStat.STAT_CTF_JOINED_TEAM1_PIC] = sys.configStringIndex ? sys.configStringIndex("pics/ctf_r.pcx") : 0;
|
|
10660
|
+
} else if (clientTeam === 2 /* BLUE */) {
|
|
10661
|
+
stats[PlayerStat.STAT_CTF_JOINED_TEAM2_PIC] = sys.configStringIndex ? sys.configStringIndex("pics/ctf_b.pcx") : 0;
|
|
10662
|
+
}
|
|
10663
|
+
stats[PlayerStat.STAT_CTF_TEAMINFO] = 1;
|
|
10664
|
+
}
|
|
10665
|
+
|
|
10521
10666
|
// src/modes/ctf/capture.ts
|
|
10522
10667
|
function checkCapture(flag, player, game, context) {
|
|
10523
10668
|
if (!player.client) return false;
|
|
@@ -10538,11 +10683,17 @@ function captureFlag(ownFlag, player, game, context) {
|
|
|
10538
10683
|
if (!player.client) return false;
|
|
10539
10684
|
const playerTeam = player.client.team || "red";
|
|
10540
10685
|
const enemyTeam = playerTeam === "red" ? "blue" : "red";
|
|
10686
|
+
const ctfStats = player.client.ctfStats;
|
|
10687
|
+
if (ctfStats) {
|
|
10688
|
+
ctfStats.captures++;
|
|
10689
|
+
}
|
|
10541
10690
|
if (player.client.score !== void 0) {
|
|
10542
10691
|
player.client.score += 5;
|
|
10543
10692
|
} else {
|
|
10544
10693
|
player.client.score = 5;
|
|
10545
10694
|
}
|
|
10695
|
+
const teamEnum = playerTeam === "red" ? 1 /* RED */ : 2 /* BLUE */;
|
|
10696
|
+
addTeamScore(teamEnum, 1);
|
|
10546
10697
|
game.sound?.(player, 0, "ctf/flagcap.wav", 1, 1, 0);
|
|
10547
10698
|
game.centerprintf?.(player, "You captured the flag!");
|
|
10548
10699
|
const enemyFlagKey = playerTeam === "red" ? "key_blue_flag" /* BlueFlag */ : "key_red_flag" /* RedFlag */;
|
|
@@ -26172,6 +26323,9 @@ function player_think(self, sys) {
|
|
|
26172
26323
|
}
|
|
26173
26324
|
}
|
|
26174
26325
|
P_PlayerThink(self, sys);
|
|
26326
|
+
if (sys.deathmatch && (sys.configStringIndex ? sys.configStringIndex("pics/ctf_r.pcx") > 0 : true)) {
|
|
26327
|
+
updateCtfScoreboard(self, sys);
|
|
26328
|
+
}
|
|
26175
26329
|
self.nextthink = sys.timeSeconds + 0.1;
|
|
26176
26330
|
sys.scheduleThink(self, self.nextthink);
|
|
26177
26331
|
}
|
|
@@ -26239,6 +26393,16 @@ function populatePlayerStats(player, timeSeconds) {
|
|
|
26239
26393
|
const remainingSeconds = Math.ceil((bestTime - nowMs) / 1e3);
|
|
26240
26394
|
statArray[PlayerStat.STAT_TIMER] = remainingSeconds;
|
|
26241
26395
|
}
|
|
26396
|
+
if (player.client.score !== void 0) {
|
|
26397
|
+
statArray[PlayerStat.STAT_FRAGS] = player.client.score;
|
|
26398
|
+
}
|
|
26399
|
+
if (player.client.stats) {
|
|
26400
|
+
for (let i = 0; i < player.client.stats.length; i++) {
|
|
26401
|
+
if (player.client.stats[i] !== 0) {
|
|
26402
|
+
statArray[i] = player.client.stats[i];
|
|
26403
|
+
}
|
|
26404
|
+
}
|
|
26405
|
+
}
|
|
26242
26406
|
return statArray;
|
|
26243
26407
|
}
|
|
26244
26408
|
|