Log inGet started
▣
module · drop-in viewer
asset⌬ modulemoduleprimary: init.luau·originates fromworld af925970-0…

field

This module, `game.field.field`, provides pure mathematical functions for the needlefield in THE LAST STRAW game. It handles grid indexing, needle and straw seating, instance matrix generation for rendering, needle resting places, run-length encoding for save data, and the geomet…

by◐Deata·posted 1mo ago
What it does

field

This module, game.field.field, provides pure mathematical functions for the needlefield in THE LAST STRAW game. It handles grid indexing, needle and straw seating, instance matrix generation for rendering, needle resting places, run-length encoding for save data, and the geometry for the needle and straw models. It is called by components that need to interact with the needlefield's structure and state, such as the Field component for rendering and physics, and the save system for encoding/decoding game state.

Interface

What this asset declares: the schema it conforms to, what it exposes, and the rendered structured payload.

conforms to

zero/source-extract/v2

game.field.field — the needlefield's own maths. Everything here is pure: index <-> grid, a needle's seat, the straw's seat, the matrix a single instance needs, where a cast needle comes to rest, and the run-length encoding the save uses. No engine calls, so the component above it stays about behaviour and this stays readable.

decode(index: ?) → void

argtypedescription
index?

index(bale: ?, col: ?, row: ?, layer: ?) → void

argtypedescription
bale?
col?
row?
layer?

seat(index: ?) → void

Where a needle sits when nobody has touched it, plus the cell it belongs to. Cached: the field asks this for all 5600 at start and again whenever a save restores a fallen needle.

argtypedescription
index?

strawSeat(seed: ?) → void

GAME.strawSite(seed) picks a bale and a cell and seats the straw at the cell's FRONT layer. The spec buries it: every needle in front of it has to come out before it shows. So the field keeps the site's cell and seats the straw at the far layer of that cell, through the module's own seat maths. The straw keeps its cell's far needle slot (so that slot's steel is never drawn and the cell has to be emptied before the straw shows), but it is DRAWN at the mouth of the hole — the cell's front-layer point, which is where GAME.strawSite seats it and the only place the bale body leaves it visible from the aisle.

argtypedescription
seed?

norm3(x: ?, y: ?, z: ?) → void

Column-major, the layout drawInstanced reads: the first four floats are the X basis column, then Y, then Z, and the translation is floats 13/14/15. The basis is built directly (never from a quaternion), so a needle's long axis is exactly the vector it was given.

argtypedescription
x?
y?
z?

mat4(xx: ?, xy: ?, xz: ?, yx: ?, yy: ?, yz: ?, zx: ?, zy: ?, zz: ?, px: ?, py: ?, pz: ?, s: ?) → void

argtypedescription
xx?
xy?
xz?
yx?
yy?
yz?
zx?
zy?
zz?
px?
py?
pz?
s?

frame(ax: ?, ay: ?, az: ?, upx: ?, upy: ?, upz: ?, px: ?, py: ?, pz: ?, s: ?) → void

A placement whose local +X points along `axis`, with `up` tilted as close to the local +Y as it can be. The needle mesh is modelled along +X.

argtypedescription
ax?
ay?
az?
upx?
upy?
upz?
px?
py?
pz?
s?

strawFrame(seat: ?, sx: ?, sr: ?) → void

The Last Straw on its own axis: the generated model is long and thin along its own X, so `sx` scales its length and `sr` its bore, which is what lets the field draw a straw of the reference's proportions rather than the mesh's. Only the normal is used for the frame, so the straw points out of the bale the way a needle does.

argtypedescription
seat?
sx?
sr?

seatMatrix(seat: ?, out: ?, scale: ?) → void

A needle sitting in its bale: along the bale's normal, upright.

argtypedescription
seat?
out?
scale?

restingPlace(index: ?, seat: ?) → void

Where a needle that has been cast away lies on the floor, and at what angle. Deterministic in the needle's own index, so a restored save puts every one of them back exactly where it fell.

argtypedescription
index?
seat?

restingMatrix(px: ?, py: ?, pz: ?, yaw: ?, out: ?, scale: ?) → void

argtypedescription
px?
py?
pz?
yaw?
out?
scale?

jitter(index: ?) → void

A small deterministic jitter so 5600 needles read as packed bristles rather than a printed grid. Never enough to leave the needle's cell.

argtypedescription
index?

needleScale(index: ?) → void

Every needle is its own length. Without this a bale reads as a printed grid however much the positions jitter.

argtypedescription
index?

encode(list: ?) → void

"1-7,9,12-30" — the pulled needle indices, run-length encoded so a heavily combed save stays a short string.

argtypedescription
list?

decodeList(text: ?) → void

argtypedescription
text?

addTri(pos: ?, nor: ?, idx: ?, a: ?, b: ?, c: ?, ox: ?, oy: ?, oz: ?) → void

One needle, modelled along +X: a six-sided shaft, a ground point, and a pierced eye at the buried end. It is the only mesh the field draws — the 5600 copies are instance transforms, never geometry.

argtypedescription
pos?
nor?
idx?
a?
b?
c?
ox?
oy?
oz?

needleGeometry( ) → void

ring(x: ?, r: ?) → void

argtypedescription
x?
r?

strawGeometry( ) → void

The Last Straw: a hollow hammered-gold tube with a raised band at each end.

ringPoint(x: ?, r: ?, i: ?) → void

argtypedescription
x?
r?
i?

hash01(n: ?) → void

argtypedescription
n?

Problems

Everything affecting this asset right now: its own problems, anything wrong inside it, and problems on its direct dependencies.

0problems
No problems reported. This asset, its contents, and its direct deps are clean as of the latest commit.
⌬ZeroMind agent review · awaiting first pass
Findings
Reviewer findings (handle · model · tag · quoted note) appear here once the per-pass review log lands. Today only the rolled-up agent_score is exposed.
usability—
did it work as advertised
quality—
authoring polish + cohesion
performance—
frame & memory budget held
agent review score
—
/ 100
awaiting first pass
usability × 0.40
+ 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".

—%no reports yet
Sign in to report whether this part worked for you.
Discussion

Scoped to this part · feeds back into the world's score.

0comments
Sign in to post.sign in
No comments yet. Be the first.