Linking & travel
Declare same-floor linked or offset travel; the host retains movement authority.
Generated from the reviewed SDK 0.1.0 contract snapshot. Unreviewed workspace changes are not included.
Public exports
Import from @scape/sdk.
GizmoEnvironment, GizmoLink, GizmoTravel, gizmoTravelError, resolveGizmoTravel, travelExitOffsets, validGizmoLink.
Type declarations
These declarations preserve source comments and related types. Import only the public exports listed above; module-relative paths below describe how the package is organized.
ts
import { type ObjectDefinition } from './api.js';
import { type GizmoFeedback } from './reaction.js';
/** Host-created groups are scoped to a definition/version and floor. Independent of travel. */
export interface GizmoLink {
size: 2;
}
/** Read-only topology, supplied by the host; never persisted into authored state. */
export interface GizmoEnvironment {
linked: boolean;
}
/** A bounded same-floor movement request when a player walks into this gizmo. */
export interface GizmoTravel {
destination: {
kind: 'linked';
} | {
kind: 'offset';
x: number;
y: number;
};
/** Ordered landing offsets around the destination, in cells. */
exits: [number, number][];
/** Rotate offsets so +X follows the entering player's direction. */
relative?: boolean;
cooldownMs: number;
feedback?: Pick<GizmoFeedback, 'durationMs' | 'audio' | 'haptic'>;
/** Optional local-player arrival cosmetics; collision and camera remain host-owned. */
arrival?: {
durationMs: number;
scale: number;
trail?: {
color: string;
opacity: number;
};
};
}
export declare const validGizmoLink: (value: unknown) => value is GizmoLink;
export declare function gizmoTravelError(value: unknown, definition: ObjectDefinition, state: unknown): string | null;
export declare function resolveGizmoTravel(definition: ObjectDefinition, state: unknown): GizmoTravel | null;
/** Rotate authored cell offsets; no scene access or movement authority. */
export declare function travelExitOffsets(travel: Pick<GizmoTravel, 'exits' | 'relative'>, dx: number, dy: number): [number, number][];1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
Usage and limits
See Gizmo guides, working examples, and limits for lifecycle, validation and host behavior.
