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.
@@ -8838,12 +8838,49 @@ function fireHyperBlaster(game, player) {
8838
8838
  }
8839
8839
  function fireBlaster(game, player) {
8840
8840
  if (!player.client) return;
8841
- game.multicast(player.origin, 1 /* Pvs */, ServerCommand.muzzleflash, player.index, MZ_BLASTER);
8842
- applyKick(player, -0.5, 0, 0);
8843
- setPlayerAttackAnim(player);
8844
- const { forward, right, up } = angleVectors(player.angles);
8845
- const source = P_ProjectSource(game, player, { x: 8, y: 8, z: -8 }, forward, right, up);
8846
- createBlasterBolt(game.entities, player, source, forward, 15, 1500, 1 /* BLASTER */);
8841
+ if (player.client.buttons & 32) {
8842
+ game.sound(player, 0, "weapons/swing.wav", 1, ATTN_NORM, 0);
8843
+ applyKick(player, -2, 0, 0);
8844
+ setPlayerAttackAnim(player);
8845
+ const { forward, right, up } = angleVectors(player.angles);
8846
+ const source = P_ProjectSource(game, player, { x: 8, y: 8, z: -8 }, forward, right, up);
8847
+ const range = 64;
8848
+ const damage = 50;
8849
+ const kick = 100;
8850
+ const end = { x: source.x + forward.x * range, y: source.y + forward.y * range, z: source.z + forward.z * range };
8851
+ const trace = game.trace(source, null, null, end, player, MASK_SHOT);
8852
+ if (trace.fraction < 1) {
8853
+ if (trace.ent && trace.ent.takedamage) {
8854
+ T_Damage(
8855
+ trace.ent,
8856
+ player,
8857
+ player,
8858
+ forward,
8859
+ trace.endpos,
8860
+ trace.plane ? trace.plane.normal : ZERO_VEC3,
8861
+ damage,
8862
+ kick,
8863
+ 0,
8864
+ 1 /* BLASTER */,
8865
+ game.time,
8866
+ game.multicast
8867
+ );
8868
+ game.sound(player, 0, "weapons/tink1.wav", 1, ATTN_NORM, 0);
8869
+ } else {
8870
+ game.sound(player, 0, "weapons/hithard.wav", 1, ATTN_NORM, 0);
8871
+ if (trace.plane) {
8872
+ game.multicast(trace.endpos, 1 /* Pvs */, ServerCommand.temp_entity, TempEntity.GUNSHOT, trace.endpos, trace.plane.normal);
8873
+ }
8874
+ }
8875
+ }
8876
+ } else {
8877
+ game.multicast(player.origin, 1 /* Pvs */, ServerCommand.muzzleflash, player.index, MZ_BLASTER);
8878
+ applyKick(player, -0.5, 0, 0);
8879
+ setPlayerAttackAnim(player);
8880
+ const { forward, right, up } = angleVectors(player.angles);
8881
+ const source = P_ProjectSource(game, player, { x: 8, y: 8, z: -8 }, forward, right, up);
8882
+ createBlasterBolt(game.entities, player, source, forward, 15, 1500, 1 /* BLASTER */);
8883
+ }
8847
8884
  }
8848
8885
  function fireRocket(game, player) {
8849
8886
  if (!player.client) return;
@@ -9066,7 +9103,7 @@ function Weapon_Generic(ent, FRAME_ACTIVATE_LAST, FRAME_FIRE_LAST, FRAME_IDLE_LA
9066
9103
  return;
9067
9104
  }
9068
9105
  if (client.weaponstate === 0 /* WEAPON_READY */) {
9069
- if (client.buttons & 1) {
9106
+ if (client.buttons & 1 || client.buttons & 32) {
9070
9107
  client.weaponstate = 3 /* WEAPON_FIRING */;
9071
9108
  client.gun_frame = FRAME_ACTIVATE_LAST + 1;
9072
9109
  return;