Accepted-action reactions
Declare shared feedback and permission-checked removal requests.
Generated from the reviewed SDK 0.1.0 contract snapshot. Unreviewed workspace changes are not included.
Public exports
Import from @scape/sdk.
GizmoFeedback, GizmoInteraction, GizmoReaction, GizmoReactionContext, gizmoFeedbackError, resolveGizmoReaction, validGizmoInteraction.
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 ObjectAction, type ObjectDefinition } from './api.js';
import { type GizmoAudioCommand, type GizmoSounds } from './audio.js';
import { type GizmoLightingState } from './lighting.js';
/** Bounded, short-lived cosmetics anchored by the host to an accepted action. */
export interface GizmoFeedback {
durationMs: number;
audio?: GizmoAudioCommand[];
lighting?: GizmoLightingState;
/** Only the initiating player receives this optional device feedback. */
haptic?: 'light' | 'heavy';
cameraShake?: {
strength: number;
durationMs: number;
};
burst?: {
color: string;
radiusCells: number;
particles: number;
flash?: string;
particleEmojis?: string[];
};
impulse?: {
scale: number;
rotation: number;
durationMs?: number;
};
}
/** Requests are evaluated atomically by the host, which retains removal authority. */
export interface GizmoReaction {
feedback?: GizmoFeedback;
removeArea?: {
radiusCells: number;
};
}
export interface GizmoReactionContext {
now: number;
}
export interface GizmoInteraction {
tap?: ObjectAction;
bump?: ObjectAction;
}
export declare function validGizmoInteraction(value: unknown, definition: ObjectDefinition): boolean;
export declare function gizmoFeedbackError(value: unknown, sounds: GizmoSounds): string | null;
export declare function resolveGizmoReaction(definition: ObjectDefinition, state: unknown, previous: unknown, action: ObjectAction, now: number): GizmoReaction | null;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
41
42
43
44
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
41
42
43
44
Usage and limits
See Gizmo guides, working examples, and limits for lifecycle, validation and host behavior.
