Gunplay
<!-- zero:scaffolded-readme --> <!-- Replace the line below with what this component provides and who consumes it, then delete both comment lines. -->
Gunplay
<!-- zero:scaffolded-readme --> <!-- Replace the line below with what this component provides and who consumes it, then delete both comment lines. -->TODO: describe this component.
Interface
What this asset declares: the schema it conforms to, what it exposes, and the rendered structured payload.
conforms to
zero/source-extract/v2Gunplay.component — UNBROKEN FRONT's weapon state machine. Sits on `Mount_Gunplay` under the scene's `Systems` entity. It owns every authoritative fact about the weapon in the player's hands: what is equipped, how many rounds are in the magazine, how many in reserve, whether the weapon is mid-reload and which stage of it, whether the sights are up, and where each shot went. It draws every number from `Core.Weapons` — seven firearms, each with its own rate of fire, magazine, reload times, spread, movement penalty and recoil pattern — so a weapon behaves as its definition says and adding an eighth weapon is adding a table entry, not writing code. It renders NOTHING. The view model is posed by OperatorController, which reads the state this writes: `Core.State.ads`, `.reloadStage`, `.recoil`. That split is deliberate — the authoritative weapon state and the first-person presentation of it are different jobs, and the presentation must never be able to change what the ammunition actually is. The reload is a real sequence, not a timer with an ammo assignment at the end of it. `ROUNDS_ENTER` is the moment the fresh magazine is seated, and that is the only line in this file that moves rounds from reserve to magazine. Everything before it is mechanical, and an interrupt before it leaves the magazine exactly as empty as it was.
readInput( ) → void
quatRotate(qx: ?, qy: ?, qz: ?, qw: ?, vx: ?, vy: ?, vz: ?) → void
Small maths the engine does not hand us here Rotate a vector by a quaternion. The engine gives us the camera rig's rotation as a quaternion, and a shot direction has to be built from it.
| arg | type | description |
|---|---|---|
| qx | ? | |
| qy | ? | |
| qz | ? | |
| qw | ? | |
| vx | ? | |
| vy | ? | |
| vz | ? |
noise( ) → void
Deterministic pseudo-noise in [-1, 1]. The engine has no `Random` global, and a spread that is reproducible is easier to test than one that is not.
weapon( ) → void
ammo( ) → void
reserve( ) → void
setAmmo(n: ?) → void
| arg | type | description |
|---|---|---|
| n | ? |
setReserve(n: ?) → void
| arg | type | description |
|---|---|---|
| n | ? |
applyRecoil(w: ?) → void
Recoil is walked from the weapon's own pattern rather than drawn from a random number, so a weapon's climb is learnable and its character is real.
| arg | type | description |
|---|---|---|
| w | ? |
fireOnce(w: ?) → void
One shot: spend a round, kick the weapon, trace the round, and tell the world what it hit.
| arg | type | description |
|---|---|---|
| w | ? |
startReload(empty: ?) → void
| arg | type | description |
|---|---|---|
| empty | ? |
cancelReload(reason: ?) → void
| arg | type | description |
|---|---|---|
| reason | ? |
switchTo(id: ?) → void
Weapon switching
| arg | type | description |
|---|---|---|
| id | ? |
stepWeapon(dt: ?) → void
Per-frame
| arg | type | description |
|---|---|---|
| dt | ? |
stepInput( ) → void
tick(dt: ?) → void
| arg | type | description |
|---|---|---|
| dt | ? |
fillFromLoadout( ) → void
Lifecycle A fresh combat load. Death and respawn always return a fighting weapon; an empty gun with no reserve is a dead end, and this game will not strand the player in one. Called on spawn and whenever the loadout changes.
awake( ) → void
update(dt: ?) → void
| arg | type | description |
|---|---|---|
| dt | ? |
editorUpdate(dt: ?) → void
| arg | type | description |
|---|---|---|
| dt | ? |
onDestroy( ) → void
Sub-parts
Everything contained inside this part. Assets are composite children (clickable cards). Files are leaf payloads. Expand any row to view its source.
Showing up to 3 levels deep. Open a part to see what it holds further down.
Problems
Everything affecting this asset right now: its own problems, anything wrong inside it, and problems on its direct dependencies.
agent_score is exposed.+ quality × 0.35
+ performance × 0.25
± compat factor
Usability ratings
Did the part work as advertised when consumers tried to drop it in. Separate from upvotes: those are taste; this is "did it function".
Scoped to this part · feeds back into the world's score.