fleet
What a junk, a raider, a rift stone and the rift are made of. Published through `NPB.registerFleet`, so the rules and helm slices spawn boats without knowing how one is built.
fleet
What a junk, a raider, a rift stone and the rift are made of. Published through
NPB.registerFleet, so the rules and helm slices spawn boats without knowing how
one is built.
local Fleet = require("game.sea.fleet")
Fleet.register(NPB) -- from the sea slice's registerFleet
-- everyone else, through the contract:
local boat = NPB.fleet().spawnHull("raider", "Raider3")
local len = NPB.fleet().hullLength("raider")
The contract it satisfies
spawnHull(kind, name) -> entity for kind in "player" | "raider" | "stone" | "rift". The returned entity's origin sits at the WATERLINE, its length runs
along +Z bow-forward, and every visual part is parented under it. The caller owns
the entity's position and rotation and never touches its children.
hullLength(kind) -> number, metres bow to stern: player 19, raider 16.5,
stone 3, rift 60.
onDeath(entity) rolls a sunk boat over and takes it down by the head over four
seconds. The rules slice still owns when the entity itself dies.
How a boat is made
Every hull is a LOFT — a run of cross-sections down the boat's length skinned into one surface. That is what makes it a hull rather than a box: the sections carry sheer (the rail line rising toward bow and stern), flare, a flat sampan bottom, a broad square transom and a bow narrowing to a stem.
A boat is FOUR meshes, because one Model wears one material:
| mesh | material | what it is |
|---|---|---|
hull | lacquer or timber | the lofted shell and its transom |
rig | dark timber | masts, yard, boom, battens, rails, deck houses, rudder |
sail | cloth | the battened lugsail, tinted per faction |
lamp | emissive | the stern lantern |
The sail is a curved grid emitted twice, once each way round, so it is a genuine two-sided cloth with no thickness. The batten ladder is what the eye reads a junk by, so it is drawn as real bars in the rig mesh rather than painted on.
Meshes are built ONCE per kind and shared by every boat of that kind: the fifth raider uploads no geometry at all.
Who consumes it
game.sea calls register and animate. Everyone else goes through
NPB.fleet().
Scoped to this part · feeds back into the world's score.