quake2ts 0.0.484 → 0.0.485

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.
@@ -9037,12 +9037,49 @@ function fireHyperBlaster(game, player) {
9037
9037
  }
9038
9038
  function fireBlaster(game, player) {
9039
9039
  if (!player.client) return;
9040
- game.multicast(player.origin, 1 /* Pvs */, ServerCommand.muzzleflash, player.index, MZ_BLASTER);
9041
- applyKick(player, -0.5, 0, 0);
9042
- setPlayerAttackAnim(player);
9043
- const { forward, right, up } = angleVectors(player.angles);
9044
- const source = P_ProjectSource(game, player, { x: 8, y: 8, z: -8 }, forward, right, up);
9045
- createBlasterBolt(game.entities, player, source, forward, 15, 1500, 1 /* BLASTER */);
9040
+ if (player.client.buttons & 32) {
9041
+ game.sound(player, 0, "weapons/swing.wav", 1, ATTN_NORM, 0);
9042
+ applyKick(player, -2, 0, 0);
9043
+ setPlayerAttackAnim(player);
9044
+ const { forward, right, up } = angleVectors(player.angles);
9045
+ const source = P_ProjectSource(game, player, { x: 8, y: 8, z: -8 }, forward, right, up);
9046
+ const range = 64;
9047
+ const damage = 50;
9048
+ const kick = 100;
9049
+ const end = { x: source.x + forward.x * range, y: source.y + forward.y * range, z: source.z + forward.z * range };
9050
+ const trace = game.trace(source, null, null, end, player, MASK_SHOT);
9051
+ if (trace.fraction < 1) {
9052
+ if (trace.ent && trace.ent.takedamage) {
9053
+ T_Damage(
9054
+ trace.ent,
9055
+ player,
9056
+ player,
9057
+ forward,
9058
+ trace.endpos,
9059
+ trace.plane ? trace.plane.normal : ZERO_VEC3,
9060
+ damage,
9061
+ kick,
9062
+ 0,
9063
+ 1 /* BLASTER */,
9064
+ game.time,
9065
+ game.multicast
9066
+ );
9067
+ game.sound(player, 0, "weapons/tink1.wav", 1, ATTN_NORM, 0);
9068
+ } else {
9069
+ game.sound(player, 0, "weapons/hithard.wav", 1, ATTN_NORM, 0);
9070
+ if (trace.plane) {
9071
+ game.multicast(trace.endpos, 1 /* Pvs */, ServerCommand.temp_entity, TempEntity.GUNSHOT, trace.endpos, trace.plane.normal);
9072
+ }
9073
+ }
9074
+ }
9075
+ } else {
9076
+ game.multicast(player.origin, 1 /* Pvs */, ServerCommand.muzzleflash, player.index, MZ_BLASTER);
9077
+ applyKick(player, -0.5, 0, 0);
9078
+ setPlayerAttackAnim(player);
9079
+ const { forward, right, up } = angleVectors(player.angles);
9080
+ const source = P_ProjectSource(game, player, { x: 8, y: 8, z: -8 }, forward, right, up);
9081
+ createBlasterBolt(game.entities, player, source, forward, 15, 1500, 1 /* BLASTER */);
9082
+ }
9046
9083
  }
9047
9084
  function fireRocket(game, player) {
9048
9085
  if (!player.client) return;
@@ -9265,7 +9302,7 @@ function Weapon_Generic(ent, FRAME_ACTIVATE_LAST, FRAME_FIRE_LAST, FRAME_IDLE_LA
9265
9302
  return;
9266
9303
  }
9267
9304
  if (client.weaponstate === 0 /* WEAPON_READY */) {
9268
- if (client.buttons & 1) {
9305
+ if (client.buttons & 1 || client.buttons & 32) {
9269
9306
  client.weaponstate = 3 /* WEAPON_FIRING */;
9270
9307
  client.gun_frame = FRAME_ACTIVATE_LAST + 1;
9271
9308
  return;