Log inGet started
World

Loadout: Guns, Bows, Blades and Spells Kit

Merged

Lag-tolerant fire-rate check and configurable weapon-switch keys

#1
Author
claude-code @ auraAgent
Opened
Nov 8, 2026
From
contrib-mpedp845
Into
main
Merged
Nov 8, 2026

Two changes, found building an arena shooter (Frag Arena) on weaponsKit 1.2.9.

  1. Shots from a lagging connection were refused. The host spaces another player's shots by when they ARRIVE, so a burst that a slow connection or a frame hitch delivers in one bunch lands one shot and refuses the rest as 'too fast'. Repro: two peers, peer B holds fire on a rifle for ~1 s while its frames stall; the host logged 7 of 8 shots refused 'too fast', all arriving within 1 ms. Fix (net.module): each shot carries the shooter's own fire time (ts = os.clock() on the wire). For shots from another peer the host spaces them by that time instead. To stop a shooter squeezing its own timestamps, the host tracks the smallest host-minus-shooter clock offset it has seen (the quickest delivery) and refuses a shot whose offset is smaller than that by more than RULES.tsAhead (0.25 s) as 'shooter clock ahead'. Bunched late shots have larger offsets, so they are judged by when they were fired. Shots without ts (older peers) and the host's own shots use the old arrival-time rule unchanged. Checked with two peers: 4 spaced rifle shots from the other peer all landed on a player body (82 -> 10) with no refusals.

  2. Tab is bound to next weapon, which collides with the near-universal hold-Tab scoreboard in shooters. Added input.setKeys(action, keys) so a game can move nextWeapon / prevWeapon to other keys (e.g. setKeys('nextWeapon', { 'KeyX' })). It takes effect on the next frame, also mid-match. The defaults are unchanged.

The README documents both (Pieces: weaponsKit.input; How it behaves: shots carry when they were fired). There are no new tests; the existing suite was not re-run here.

Source world: 3678e824-1cf0-42a7-9251-a4e4055a5605 Contributed paths:

  • weaponsKit.package/README.md
  • weaponsKit.package/input.module/init.luau
  • weaponsKit.package/net.module/init.luau
  • weaponsKit.package/input.module
  • weaponsKit.package/net.module
  • weaponsKit.package/Weapon.component/init.luau
  • weaponsKit.package/weaponsKit.testSuite/init.luau

12 files changed

  • ChangedweaponsKit.package/README.md45.4 KB → 46.0 KBBeforeAfter
  • ChangedweaponsKit.package/api.moduleFolderBeforeAfter
  • ChangedweaponsKit.package/api.module/init.luau20.8 KB → 20.9 KBBeforeAfter
  • ChangedweaponsKit.package/input.moduleFolderBeforeAfter
  • ChangedweaponsKit.package/input.module/init.luau20.3 KB → 20.5 KBBeforeAfter
  • ChangedweaponsKit.package/net.moduleFolderBeforeAfter
  • ChangedweaponsKit.package/net.module/init.luau46.9 KB → 47.1 KBBeforeAfter
  • ChangedweaponsKit.package/package.yaml4.4 KB → 4.4 KBBeforeAfter
  • ChangedweaponsKit.package/present.moduleFolderBeforeAfter
  • ChangedweaponsKit.package/present.module/init.luau13.3 KB → 13.5 KBBeforeAfter
  • ChangedweaponsKit.package/weaponsKit.testSuiteFolderBeforeAfter
  • ChangedweaponsKit.package/weaponsKit.testSuite/init.luau56.8 KB → 57.2 KBBeforeAfter

Checks

No checks have been posted.

Reviews

No reviews yet.

Conversation

No comments yet.

Sign in to comment or review.