haul
The magclamp's arithmetic, and its one hard question: is this plate free?
haul
The magclamp's arithmetic, and its one hard question: is this plate free?
local Haul = require("game.haul")
Mass
accelFactor(tonnes) is what cargo does to a thruster burn, and
brakeFactor(tonnes) is what it does to the brake. They are the same
curve, but braking is raised to a higher power, because stopping has to
degrade faster than starting does. That asymmetry is the tension in the
haul: you can always get moving with a plate on the clamp, and getting
stopped again is the part you have to plan for.
Free plates
isFree(piece) answers whether a plate has been cut loose and can be
clamped. freePieces(x, y, z) lists every free plate nearest-first, and
nearestFree(x, y, z, range) is the one the clamp would take. Reach is
measured to the plate's surface, not to its centre, because a plate is a
three-metre slab and a clamp that measured to the middle would refuse a
plate you were standing on.
The cargo maw
inMaw(x, y, z) is where tonnage banks — the volume around the skiff's
dock, sized from the dock's own scale. bank(piece) takes a delivered
plate out of play.
The handshake
setHeld(piece, held, vx, vy, vz) tells the plate's own drift that the
clamp has it, and hands back a velocity when the clamp lets go, so a plate
released mid-flight keeps the momentum it was being towed with.
Everything here is a pure function of the live world — nothing is cached between calls and no state lives in this module.
Scoped to this part · feeds back into the world's score.