Skip to content

core/layout/layout.ts ​

Generated from the exports of core/layout/layout.ts · npm run docs:gen

Places the neutral entities in a 2D world, deterministically: the same state always gives the same places, so switching universes keeps every element where it was. Units are world pixels, origin at the centre.

Standards that cite this file: No standard page cites this file yet.

Exports ​

Placed interface ​

ts
interface Placed {
  e: Entity;
  x: number;
  y: number;
  /** Radius within which the player can interact with it. */
  r: number;
  /** For automations: the entity they circle around, and their angle and distance. */
  around?: { x: number; y: number; angle: number; dist: number };
}
ts
interface Link {
  from: string;
  to: string;
  kind: "flow" | "cycle" | "control";
}

Layout interface ​

ts
interface Layout {
  placed: Placed[];
  links: Link[];
  bounds: { minX: number; minY: number; maxX: number; maxY: number };
  /** Where the player starts. */
  spawn: { x: number; y: number };
  /** The edge band where devices, accounts and interfaces sit (the outside world). */
  edgeY: number;
}

RING const ​

Radius of the ring of the four core agents around the centre.

ts
const RING = 400

layout function ​

ts
function layout(world: WorldState): Layout

The standard, the SDK and the CLI are Apache-2.0; Alta System OS and Alta World are FSL-1.1-ALv2.