Log inGet started
World

Loadout: Guns, Bows, Blades and Spells Kit

README.md

weaponsKit tests

75 tests over the kit. Run them in edit mode with zero tests run weaponsKit (or tools.use("tests", "run", { suite = "weaponsKit" })). They run the same in any world that installs the kit, and the ones that need a player enter play by themselves.

  • Catalogue: every promised weapon exists, at least four weapons in every look family, thrownSpear and its javelin alias, all five attack kinds are covered, styles() tags and filters (and refuses unknown keys), get returns copies, combo and charge data.
  • Defining: define from a base and from a minimal spec, validation errors that name the problem, tweak merging nested tables, remove restoring built-ins, the defined event.
  • Looks: world look over override over the weapon's own, a crosshair for every weapon in every family, every family crosshair is a real markersKit style.
  • Assets: every weapon and projectile model has a fit, every sound is a cue, every mark is a marks kind, every effect is a vfx kind, a model spawns cleanly.
  • Equip and the Weapon component's fields, and health() giving a target the maxHealth it asks for.
  • Hit finding against a scratch wall and dummy at (60, 1.5, 60): hitscan, deterministic pellets, railgun pierce, melee reach, beams, the flamethrower cone, explosion falloff and walls, chain hops, a projectile landing, and targets with no collider hit as capsules.
  • Host checks: a real hit is accepted with host-computed damage; unknown weapon, a shot from far away, firing too fast (an instant burst lands exactly one; evenly fired shots that arrive unevenly all land), past the magazine, through a wall, beyond melee reach, at a target that is not there, and from a body the sender does not own are refused.
  • Two players: every weapon fired by another player hurts a dummy once per shot, a refused projectile deals nothing, a second player's peer applies the host's verdict, and the kit listens on its channels again when the session changes.
  • Each message once: a shot from another player in each weapon family (rifle, crossbow, laser beam, thrown spear, sword, fireball) is received once and lands once when it arrives through every listener the kit ever registered, as the engine delivers it; the same after the kit's code reloads twice and after leaving and re-entering Play twice; and a message that arrives twice, or without an id, is handled once on every channel the kit listens on.
  • Controls: one scheme switch, pointer lock on and off, locking turned off after the engine refuses it on three clicks, and the phone buttons on four screen shapes (none folded away, none overlapping, all right of the stick).
  • Multiplayer fixes: the host's health readings correcting another player's copy of a dummy, burning only on the host's copy, a grenade flying the same path at 30, 60 and 144 frames a second, and a shot that arrives before the weapon switch it follows.
  • Fresh install: every model the kit names, the training dummy included, ships inside the package; explosions, chains, capsule hits and the health readings find every target when SecondWind's own list of them is empty, the kit's code names no aiKit module, the host's stand-in for a target nobody owns lasts one damage call, and a hit the player lands shows exactly one hit marker and one damage number (someone else's hit shows none), starting from a markersKit that nothing has asked to listen yet, as in a brand-new world.
  • The README's first example, run in a new world's scene with no markersKit Feedback entity: the crosshair comes on with the weapon, the rifle's hits on the crate show hit markers and damage numbers, and the rifle and the bow both hurt the crate.
  • Version and README: Weapons.VERSION, package.yaml and the README agree, with one Known limits and one Version history.
  • Kits built on weaponsKit: the sound cues and the fireball model Combo Dojo's comboKit plays are still there.
  • Events: on/off, a failing listener does not stop the others, stats.

Every test removes what it spawned and every weapon it defined, so the suite passes run after run. After each test it also retires the effect pools it built, this kit's and juiceKit's, each draw before its buffers: the test runner frees the GPU buffers a suite made but not the draws over them, so a pool left standing would leave a draw pointing at a freed buffer.