siege_ballistics
A module script.
Interface
What this asset declares: the schema it conforms to, what it exposes, and the rendered structured payload.
conforms to
zero/source-extract/v2siege_ballistics — the arc, honestly integrated. One place computes how fast a shot leaves the sling and where it lands, and both the live projectile and the HUD's predicted-range readout call it. The prediction is therefore never a separate approximation that can drift from the shot the player actually takes: it is the same integrator run ahead of time. local Bal = require("siege_ballistics") local v = Bal.muzzleSpeed(1500, 90, 45) local shot = Bal.launch({ x = 0, y = 8, z = 92 }, 180, 45, v) local land = Bal.predict(shot, 90, 0.38, wind, 0)
muzzleSpeed(counterweight: number, projectile: number, releaseAngle: number) → number
Speed the sling imparts, from the counterweight's drop at the release point.
| arg | type | description |
|---|---|---|
| counterweight | number | Counterweight mass in kg. |
| projectile | number | Projectile mass in kg. |
| releaseAngle | number | Launch elevation in degrees (30-70). |
examples
require("siege_ballistics").muzzleSpeed(1500, 90, 45)releasePhi(releaseAngle: number) → number
The arm angle, in degrees, at which the sling releases for a given launch elevation.
| arg | type | description |
|---|---|---|
| releaseAngle | number | Launch elevation in degrees. |
examples
require("siege_ballistics").releasePhi(45)launch(origin: Vec3, yawDeg: number, releaseAngle: number, speed: number) → Shot
Build the initial shot state from the sling's position, the frame's yaw and the release angle.
| arg | type | description |
|---|---|---|
| origin | Vec3 | Sling world position when it lets go. |
| yawDeg | number | Frame yaw in degrees; 0 fires straight down -Z at the castle. |
| releaseAngle | number | Launch elevation in degrees. |
| speed | number | Muzzle speed in m/s. |
examples
require("siege_ballistics").launch({x=0,y=8,z=92}, 0, 45, 30)dragTerm(mass: number, radius: number) → number
The drag coefficient term for a projectile: 0.5*rho*Cd*A/m.
| arg | type | description |
|---|---|---|
| mass | number | Projectile mass in kg. |
| radius | number | Projectile radius in metres. |
examples
require("siege_ballistics").dragTerm(90, 0.38)step(shot: Shot, dt: number, k: number, windX: number, windZ: number) → void
Advance a shot by `dt` under gravity, quadratic drag and wind. Mutates the shot.
| arg | type | description |
|---|---|---|
| shot | Shot | The shot state to advance. |
| dt | number | Timestep in seconds. |
| k | number | Drag term from `dragTerm`. |
| windX | number | Wind velocity along X in m/s. |
| windZ | number | Wind velocity along Z in m/s. |
examples
require("siege_ballistics").step(shot, 1/120, k, 3, 0)Vec3 = { x: number, y: number, z: number }Shot = { pos: Vec3, vel: Vec3 }Prediction = {Sub-parts
Everything contained inside this part. Assets are composite children (clickable cards). Files are leaf payloads. Expand any row to view its source.
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.