Log inGet started
World

Hullbreaker

Branchmain
Branchesmain
Commitcdbe4bf730

README.md

SalvagePiece

A plate of the Kestrel Wake that can be cut off and hauled. On every entity the scene tags salvage.

It counts the welds holding the plate on, and when the last one goes it takes the plate off the wreck: unparents it from Salvage, marks it free, gives it a slow break-away drift into the shaft, and emits severed(pieceId, tonnes) exactly once.

The free marker

A plate is haulable exactly when this component says so:

local sp = entity(pieceId).component.get("SalvagePiece")
if sp and sp:isFree() then  -- clampable

free is a Sync field, so every peer agrees. A plate still bolted on answers false, and nothing else about it changes — there is no second flag anywhere.

Methods

sp:isFree()
sp:tonnage()          the manifest mass, the only source of it
sp:weldsRemaining()
sp:setHeld(true)      the magclamp has it — this component stops moving it
sp:setHeld(false)     released; it drifts again from wherever it is
sp:refit()            bolt it back on where the manifest puts it