Links between capabilities
Skill ferret-physics-links · download all skills · SKILL.md
When to use#
One capability's output must be another's input (heat to gas, shaft to lamp, short circuit to blast).
The model#
Each capability stays ignorant of the others; a link is a small object that moves a quantity between them and keeps an energy account (EnergyTerm) that must add up. Ready links: gasInPart, vesselInPart, reservoirInPart, slipHeats, plasticHeats, stagnationHeats, reactorHeatsPart, turbineOnReactor, boilerFed, engineOnBoiler, screwOnShaft, coilPulls, armatureOf, mudOver, navFollowsTerrain, wireFire, arcFlash.
Steps#
- Enable
links;addeach link to the capability. - Give each side the interface the link needs (
HeatPartLike,GasLike, ...). - The rule between worlds is your code:
socket.closed = cellar.level > 0.3; the link moves the numbers. - Check
links.energy(the account) andlink.state. - Write your own by implementing
Linkwith itsterms.
Check afterwards#
The energy total does not drift over a long run; each pair is joined once.
What usually goes wrong#
- Total drifts: a link writes without taking from the other side, or a store is missing from
terms. - A link does nothing: not
added, orlinksnot enabled. - Heat appears twice: two links join the same pair.
- A link runs after the capabilities have stepped: what it writes is used next step.
Files#
reference/links.md— Small objects that close loops between capabilities (a fire heats a pot, steam turns a turbine, a generator lights a lamp), with an energy account that must add up.reference/api-physics-links.md— every export of@ferret/physics-linkswith signature and doc commentreference/commands.md— 1 commands of these packages with their argumentsrecipes/tank-fire.md— A fire heats a sealed tank, the gas inside warms and its pressure climbs, the shell gives way and the tank becomes a blast with fragments that push a crate. Heat, links, gas, explosions and bodies in one loop.recipes/flooded-cellar.md— A burst main fills a cellar faster than the sump pump can empty it; the water reaches a socket, the circuit shorts, the breaker trips, the pump stops, and the flood wins.