narraleaf-react 0.19.2 → 0.20.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/built-in.d.ts +1 -1
- package/dist/game/nlcore/action/actionTypes.d.ts +13 -0
- package/dist/game/nlcore/action/actions/puppetAction.d.ts +59 -0
- package/dist/game/nlcore/action/logicAction.d.ts +15 -13
- package/dist/game/nlcore/common/elements.d.ts +4 -1
- package/dist/game/nlcore/elements/built-in/DevTools.d.ts +53 -0
- package/dist/game/nlcore/elements/built-in/screenEffects.d.ts +2 -2
- package/dist/game/nlcore/elements/camera.d.ts +3 -0
- package/dist/game/nlcore/elements/character/pause.d.ts +1 -1
- package/dist/game/nlcore/elements/character.d.ts +3 -0
- package/dist/game/nlcore/elements/condition.d.ts +13 -0
- package/dist/game/nlcore/elements/control.d.ts +29 -24
- package/dist/game/nlcore/elements/displayable/image.d.ts +4 -0
- package/dist/game/nlcore/elements/displayable/puppet.d.ts +230 -0
- package/dist/game/nlcore/elements/displayable/text.d.ts +4 -0
- package/dist/game/nlcore/elements/layer.d.ts +4 -0
- package/dist/game/nlcore/elements/persistent/serialize.d.ts +1 -0
- package/dist/game/nlcore/elements/persistent/storable.d.ts +11 -0
- package/dist/game/nlcore/elements/persistent/type.d.ts +51 -2
- package/dist/game/nlcore/elements/persistent.d.ts +12 -3
- package/dist/game/nlcore/elements/scene.d.ts +3 -0
- package/dist/game/nlcore/elements/script.d.ts +1 -0
- package/dist/game/nlcore/elements/sound.d.ts +3 -0
- package/dist/game/nlcore/elements/story.d.ts +1 -0
- package/dist/game/nlcore/elements/transform/position.d.ts +46 -0
- package/dist/game/nlcore/elements/vfx.d.ts +14 -5
- package/dist/game/nlcore/elements/video.d.ts +15 -7
- package/dist/game/nlcore/game/liveGame.d.ts +47 -0
- package/dist/game/nlcore/game/puppet/puppetBackend.d.ts +247 -0
- package/dist/game/nlcore/game.d.ts +43 -0
- package/dist/game/player/elements/displayable/Puppet.d.ts +1 -0
- package/dist/game/player/elements/displayable/type.d.ts +2 -1
- package/dist/game/player/elements/image/AspectScaleImage.d.ts +8 -0
- package/dist/game/player/elements/image/Image.d.ts +6 -0
- package/dist/game/player/gameState.d.ts +5 -0
- package/dist/game/player/gameState.type.d.ts +21 -1
- package/dist/game/player/type.d.ts +11 -1
- package/dist/main.js +52 -43
- package/package.json +3 -2
package/dist/built-in.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export { Gallery, DevTools, } from "
|
|
1
|
+
export { Gallery, DevTools, } from "./game/nlcore/common/core";
|
|
2
2
|
export { blink, effectLayer, vignette, } from "./game/nlcore/elements/built-in/screenEffects";
|
|
3
3
|
export type { BlinkOptions, EffectLayerOptions, ScreenEffectColor, VignetteOptions, } from "./game/nlcore/elements/built-in/screenEffects";
|
|
@@ -16,6 +16,7 @@ import type { Transition } from "../elements/transition/transition";
|
|
|
16
16
|
import type { ImageTransition } from "../elements/transition/transitions/image/imageTransition";
|
|
17
17
|
import type { Layer } from "../elements/layer";
|
|
18
18
|
import type { VfxFadeOptions } from "../elements/vfx";
|
|
19
|
+
import type { PuppetCommandOptions } from "../elements/displayable/puppet";
|
|
19
20
|
export declare const DisplayableActionTypes: {
|
|
20
21
|
readonly action: "displayable:action";
|
|
21
22
|
readonly applyTransform: "displayable:applyTransform";
|
|
@@ -166,3 +167,15 @@ export declare const VfxActionTypes: {
|
|
|
166
167
|
export type VfxActionContentType = {
|
|
167
168
|
[K in typeof VfxActionTypes[keyof typeof VfxActionTypes]]: K extends "vfx:action" ? any : K extends "vfx:show" | "vfx:hide" ? [VfxFadeOptions?] : K extends "vfx:pause" | "vfx:resume" ? [] : K extends "vfx:setRate" ? [number] : any;
|
|
168
169
|
};
|
|
170
|
+
export declare const PuppetActionTypes: {
|
|
171
|
+
readonly action: "puppet:action";
|
|
172
|
+
readonly setMotion: "puppet:setMotion";
|
|
173
|
+
readonly setExpression: "puppet:setExpression";
|
|
174
|
+
readonly setSkin: "puppet:setSkin";
|
|
175
|
+
readonly setParam: "puppet:setParam";
|
|
176
|
+
readonly setSlot: "puppet:setSlot";
|
|
177
|
+
readonly command: "puppet:command";
|
|
178
|
+
};
|
|
179
|
+
export type PuppetActionContentType = {
|
|
180
|
+
[K in typeof PuppetActionTypes[keyof typeof PuppetActionTypes]]: K extends "puppet:action" ? any : K extends "puppet:setMotion" ? [motion: string | null] : K extends "puppet:setExpression" ? [expression: string | null] : K extends "puppet:setSkin" ? [skin: string | null] : K extends "puppet:setParam" ? [id: string, value: number] : K extends "puppet:setSlot" ? [id: string, value: string | null] : K extends "puppet:command" ? [name: string, payload: unknown, options: PuppetCommandOptions | undefined] : any;
|
|
181
|
+
};
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { PuppetActionContentType, PuppetActionTypes } from "../../action/actionTypes";
|
|
2
|
+
import { TypedAction } from "../../action/actions";
|
|
3
|
+
import type { Puppet } from "../../elements/displayable/puppet";
|
|
4
|
+
import { GameState } from "../../../player/gameState";
|
|
5
|
+
import { Values } from "../../../../util/data";
|
|
6
|
+
import { ActionExecutionInjection, ExecutedActionResult } from "../../action/action";
|
|
7
|
+
import { LogicAction } from "../../action/logicAction";
|
|
8
|
+
import { Story } from "../../elements/story";
|
|
9
|
+
/**
|
|
10
|
+
* The story's half of the puppet seam.
|
|
11
|
+
*
|
|
12
|
+
* Two kinds of thing happen here, and the line between them is the same one
|
|
13
|
+
* {@link import("../../game/puppet/puppetBackend").PuppetState} draws:
|
|
14
|
+
*
|
|
15
|
+
* - The five `set*` types edit the persistent state and then push **the whole of it** to the
|
|
16
|
+
* backend. They never send a delta, because a delta is exactly what a saved game cannot replay —
|
|
17
|
+
* restoring is one `apply` of a complete state, so an undo has to be one too.
|
|
18
|
+
* - `command` sends a one-shot the engine does not model and does not interpret. It leaves no state
|
|
19
|
+
* behind, which is why it is the only one that can take `{await: true}` and the only one an undo
|
|
20
|
+
* cannot take back.
|
|
21
|
+
*/
|
|
22
|
+
export declare class PuppetAction<T extends Values<typeof PuppetActionTypes> = Values<typeof PuppetActionTypes>> extends TypedAction<PuppetActionContentType, T, Puppet> {
|
|
23
|
+
static ActionTypes: {
|
|
24
|
+
readonly action: "puppet:action";
|
|
25
|
+
readonly setMotion: "puppet:setMotion";
|
|
26
|
+
readonly setExpression: "puppet:setExpression";
|
|
27
|
+
readonly setSkin: "puppet:setSkin";
|
|
28
|
+
readonly setParam: "puppet:setParam";
|
|
29
|
+
readonly setSlot: "puppet:setSlot";
|
|
30
|
+
readonly command: "puppet:command";
|
|
31
|
+
};
|
|
32
|
+
executeAction(state: GameState, injection: ActionExecutionInjection): ExecutedActionResult;
|
|
33
|
+
/**
|
|
34
|
+
* Write a patch over the puppet's state, then hand the backend the complete result.
|
|
35
|
+
*
|
|
36
|
+
* `params` and `slots` merge key by key, so setting one parameter does not silently clear the
|
|
37
|
+
* rest. Undo restores the state as it stood and applies that — one call, no replay, which is the
|
|
38
|
+
* same path a saved game takes.
|
|
39
|
+
*/
|
|
40
|
+
private patchState;
|
|
41
|
+
/**
|
|
42
|
+
* Push the current state to the backend without making the story wait for it.
|
|
43
|
+
*
|
|
44
|
+
* A pose change is not a beat: an author writing `setExpression("smile")` before a line expects
|
|
45
|
+
* the line, not a pause of whatever length the renderer decides. A backend that throws or
|
|
46
|
+
* rejects is logged and the stage stays alive — it is a renderer this library has never seen,
|
|
47
|
+
* and it does not get to take the game down.
|
|
48
|
+
*/
|
|
49
|
+
private pushState;
|
|
50
|
+
/**
|
|
51
|
+
* Forward a one-shot command, optionally waiting for it.
|
|
52
|
+
*
|
|
53
|
+
* Waiting is opt-in ({@link import("../../elements/displayable/puppet").PuppetCommandOptions}):
|
|
54
|
+
* the engine cannot know whether a command is a motion worth a beat or a parameter nudge, and
|
|
55
|
+
* defaulting to waiting would make every backend that forgets to resolve into a hung story.
|
|
56
|
+
*/
|
|
57
|
+
private runCommand;
|
|
58
|
+
stringify(_story: Story, _seen: Set<LogicAction.Actions>, _strict: boolean): string;
|
|
59
|
+
}
|
|
@@ -9,7 +9,7 @@ import type { StringKeyOf, Values } from "../../../util/data";
|
|
|
9
9
|
import type { TypedAction } from "../action/actions";
|
|
10
10
|
import type { Sound } from "../elements/sound";
|
|
11
11
|
import type { Control } from "../elements/control";
|
|
12
|
-
import { CharacterActionContentType, CharacterActionTypes, ConditionActionContentType, ConditionActionTypes, ControlActionContentType, ControlActionTypes, DisplayableActionContentType, DisplayableActionTypes, ImageActionContentType, ImageActionTypes, LayerActionContentType, LayerActionTypes, MenuActionContentType, MenuActionTypes, PersistentActionContentType, PersistentActionTypes, SceneActionContentType, SceneActionTypes, ScriptActionContentType, ScriptActionTypes, SoundActionContentType, SoundActionTypes, StoryActionContentType, StoryActionTypes, TextActionContentType, TextActionTypes, VfxActionContentType, VfxActionTypes, VideoActionContentType, VideoActionTypes } from "../action/actionTypes";
|
|
12
|
+
import { CharacterActionContentType, CharacterActionTypes, ConditionActionContentType, ConditionActionTypes, ControlActionContentType, ControlActionTypes, DisplayableActionContentType, DisplayableActionTypes, ImageActionContentType, ImageActionTypes, LayerActionContentType, LayerActionTypes, MenuActionContentType, MenuActionTypes, PersistentActionContentType, PersistentActionTypes, PuppetActionContentType, PuppetActionTypes, SceneActionContentType, SceneActionTypes, ScriptActionContentType, ScriptActionTypes, SoundActionContentType, SoundActionTypes, StoryActionContentType, StoryActionTypes, TextActionContentType, TextActionTypes, VfxActionContentType, VfxActionTypes, VideoActionContentType, VideoActionTypes } from "../action/actionTypes";
|
|
13
13
|
import type { CharacterAction } from "../action/actions/characterAction";
|
|
14
14
|
import type { SceneAction } from "../action/actions/sceneAction";
|
|
15
15
|
import type { StoryAction } from "../action/actions/storyAction";
|
|
@@ -35,21 +35,23 @@ import type { Video } from "../elements/video";
|
|
|
35
35
|
import type { VideoAction } from "../action/actions/videoAction";
|
|
36
36
|
import type { Vfx } from "../elements/vfx";
|
|
37
37
|
import type { VfxAction } from "../action/actions/vfxAction";
|
|
38
|
+
import type { Puppet } from "../elements/displayable/puppet";
|
|
39
|
+
import type { PuppetAction } from "../action/actions/puppetAction";
|
|
38
40
|
export interface LogicActionInterface {
|
|
39
|
-
DisplayableElements: Text | Image | Layer | Camera | AbstractDisplayable<any, any>;
|
|
40
|
-
DisplayableExposed: ExposedStateType.image | ExposedStateType.layer | ExposedStateType.text | ExposedStateType.camera;
|
|
41
|
-
GameElement: Character | Scene | Story | Image | Condition | Script | Menu | Sound | Control | Text | Layer | Camera | AbstractDisplayable<any, any> | Persistent<any> | ServiceSkeleton | Video | Vfx;
|
|
42
|
-
Actions: TypedAction | CharacterAction | ConditionAction | ImageAction | SceneAction | ScriptAction | StoryAction | MenuAction | SoundAction | ControlAction | TextAction | DisplayableAction | PersistentAction | ServiceAction | LayerAction | VideoAction | VfxAction;
|
|
43
|
-
ActionTypes: Values<typeof CharacterActionTypes> | Values<typeof ConditionActionTypes> | Values<typeof ImageActionTypes> | Values<typeof SceneActionTypes> | Values<typeof ScriptActionTypes> | Values<typeof StoryActionTypes> | Values<typeof MenuActionTypes> | Values<typeof SoundActionTypes> | Values<typeof ControlActionTypes> | Values<typeof TextActionTypes> | Values<typeof DisplayableActionTypes> | Values<typeof PersistentActionTypes> | StringKeyOf<ServiceActionContentType> | Values<typeof LayerActionTypes> | Values<typeof VideoActionTypes> | Values<typeof VfxActionTypes>;
|
|
44
|
-
ActionContents: CharacterActionContentType & ConditionActionContentType & ImageActionContentType & SceneActionContentType & ScriptActionContentType & StoryActionContentType & MenuActionContentType & SoundActionContentType & ControlActionContentType & TextActionContentType & DisplayableActionContentType & PersistentActionContentType & ServiceActionContentType & LayerActionContentType & VideoActionContentType & VfxActionContentType;
|
|
41
|
+
DisplayableElements: Text | Image | Layer | Camera | Puppet | AbstractDisplayable<any, any>;
|
|
42
|
+
DisplayableExposed: ExposedStateType.image | ExposedStateType.layer | ExposedStateType.text | ExposedStateType.camera | ExposedStateType.puppet;
|
|
43
|
+
GameElement: Character | Scene | Story | Image | Condition | Script | Menu | Sound | Control | Text | Layer | Camera | Puppet | AbstractDisplayable<any, any> | Persistent<any> | ServiceSkeleton | Video | Vfx;
|
|
44
|
+
Actions: TypedAction | CharacterAction | ConditionAction | ImageAction | SceneAction | ScriptAction | StoryAction | MenuAction | SoundAction | ControlAction | TextAction | DisplayableAction | PersistentAction | ServiceAction | LayerAction | VideoAction | VfxAction | PuppetAction;
|
|
45
|
+
ActionTypes: Values<typeof CharacterActionTypes> | Values<typeof ConditionActionTypes> | Values<typeof ImageActionTypes> | Values<typeof SceneActionTypes> | Values<typeof ScriptActionTypes> | Values<typeof StoryActionTypes> | Values<typeof MenuActionTypes> | Values<typeof SoundActionTypes> | Values<typeof ControlActionTypes> | Values<typeof TextActionTypes> | Values<typeof DisplayableActionTypes> | Values<typeof PersistentActionTypes> | StringKeyOf<ServiceActionContentType> | Values<typeof LayerActionTypes> | Values<typeof VideoActionTypes> | Values<typeof VfxActionTypes> | Values<typeof PuppetActionTypes>;
|
|
46
|
+
ActionContents: CharacterActionContentType & ConditionActionContentType & ImageActionContentType & SceneActionContentType & ScriptActionContentType & StoryActionContentType & MenuActionContentType & SoundActionContentType & ControlActionContentType & TextActionContentType & DisplayableActionContentType & PersistentActionContentType & ServiceActionContentType & LayerActionContentType & VideoActionContentType & VfxActionContentType & PuppetActionContentType;
|
|
45
47
|
}
|
|
46
48
|
export declare const LogicAction: {};
|
|
47
49
|
export declare namespace LogicAction {
|
|
48
|
-
type DisplayableElements = Text | Image | Layer | Camera | AbstractDisplayable<any, any>;
|
|
49
|
-
type DisplayableExposed = ExposedStateType.image | ExposedStateType.layer | ExposedStateType.text | ExposedStateType.camera;
|
|
50
|
-
type GameElement = Character | Scene | Story | Image | Condition | Script | Menu | Sound | Control | Text | Layer | Camera | AbstractDisplayable<any, any> | Persistent<any> | ServiceSkeleton | Video | Vfx;
|
|
51
|
-
type Actions = TypedAction | CharacterAction | ConditionAction | ImageAction | SceneAction | ScriptAction | StoryAction | MenuAction | SoundAction | ControlAction | TextAction | DisplayableAction | PersistentAction | ServiceAction | LayerAction | VideoAction | VfxAction;
|
|
52
|
-
type ActionTypes = Values<typeof CharacterActionTypes> | Values<typeof ConditionActionTypes> | Values<typeof ImageActionTypes> | Values<typeof SceneActionTypes> | Values<typeof ScriptActionTypes> | Values<typeof StoryActionTypes> | Values<typeof MenuActionTypes> | Values<typeof SoundActionTypes> | Values<typeof ControlActionTypes> | Values<typeof TextActionTypes> | Values<typeof DisplayableActionTypes> | Values<typeof PersistentActionTypes> | StringKeyOf<ServiceActionContentType> | Values<typeof LayerActionTypes> | Values<typeof VideoActionTypes> | Values<typeof VfxActionTypes>;
|
|
53
|
-
type ActionContents = CharacterActionContentType & ConditionActionContentType & ImageActionContentType & SceneActionContentType & ScriptActionContentType & StoryActionContentType & MenuActionContentType & SoundActionContentType & ControlActionContentType & TextActionContentType & DisplayableActionContentType & PersistentActionContentType & ServiceActionContentType & LayerActionContentType & VideoActionContentType & VfxActionContentType;
|
|
50
|
+
type DisplayableElements = Text | Image | Layer | Camera | Puppet | AbstractDisplayable<any, any>;
|
|
51
|
+
type DisplayableExposed = ExposedStateType.image | ExposedStateType.layer | ExposedStateType.text | ExposedStateType.camera | ExposedStateType.puppet;
|
|
52
|
+
type GameElement = Character | Scene | Story | Image | Condition | Script | Menu | Sound | Control | Text | Layer | Camera | Puppet | AbstractDisplayable<any, any> | Persistent<any> | ServiceSkeleton | Video | Vfx;
|
|
53
|
+
type Actions = TypedAction | CharacterAction | ConditionAction | ImageAction | SceneAction | ScriptAction | StoryAction | MenuAction | SoundAction | ControlAction | TextAction | DisplayableAction | PersistentAction | ServiceAction | LayerAction | VideoAction | VfxAction | PuppetAction;
|
|
54
|
+
type ActionTypes = Values<typeof CharacterActionTypes> | Values<typeof ConditionActionTypes> | Values<typeof ImageActionTypes> | Values<typeof SceneActionTypes> | Values<typeof ScriptActionTypes> | Values<typeof StoryActionTypes> | Values<typeof MenuActionTypes> | Values<typeof SoundActionTypes> | Values<typeof ControlActionTypes> | Values<typeof TextActionTypes> | Values<typeof DisplayableActionTypes> | Values<typeof PersistentActionTypes> | StringKeyOf<ServiceActionContentType> | Values<typeof LayerActionTypes> | Values<typeof VideoActionTypes> | Values<typeof VfxActionTypes> | Values<typeof PuppetActionTypes>;
|
|
55
|
+
type ActionContents = CharacterActionContentType & ConditionActionContentType & ImageActionContentType & SceneActionContentType & ScriptActionContentType & StoryActionContentType & MenuActionContentType & SoundActionContentType & ControlActionContentType & TextActionContentType & DisplayableActionContentType & PersistentActionContentType & ServiceActionContentType & LayerActionContentType & VideoActionContentType & VfxActionContentType & PuppetActionContentType;
|
|
54
56
|
}
|
|
55
57
|
export type LogicAction = typeof LogicAction;
|
|
@@ -19,9 +19,12 @@ import { Layer } from "../elements/layer";
|
|
|
19
19
|
import { Camera } from "../elements/camera";
|
|
20
20
|
import { Video } from "../elements/video";
|
|
21
21
|
import { Vfx } from "../elements/vfx";
|
|
22
|
+
import { Puppet } from "../elements/displayable/puppet";
|
|
22
23
|
import { NVLToken } from "../elements/nvl";
|
|
23
|
-
export { Character, Narrator, Condition, Control, Image, Lambda, Menu, NVLToken, Scene, Script, Sentence, Sound, Story, Transform, Word, Text, Pause, TextEvent, Persistent, Service, Layer, Camera, Video, Vfx, };
|
|
24
|
+
export { Character, Narrator, Condition, Control, Image, Lambda, Menu, NVLToken, Scene, Script, Sentence, Sound, Story, Transform, Word, Text, Pause, TextEvent, Persistent, Service, Layer, Camera, Video, Vfx, Puppet, };
|
|
24
25
|
export type { VfxConfig, VfxBlendMode, VfxFadeOptions } from "../elements/vfx";
|
|
26
|
+
export type { IPuppetUserConfig, PuppetConfig, PuppetCommandOptions, } from "../elements/displayable/puppet";
|
|
27
|
+
export type { PuppetBackend, PuppetDescription, PuppetInstance, PuppetMountContext, PuppetSize, PuppetState, PuppetStatus, } from "../game/puppet/puppetBackend";
|
|
25
28
|
export type { LayeredDefinition, LayerGroupDefinition, LayerResolver, LayerSlot, LayerTagsOf, LayerVariants, } from "../elements/displayable/image";
|
|
26
29
|
export type { SentenceMetadata } from "../elements/character/sentence";
|
|
27
30
|
export type { TextEventAppearance, TextEventConfig, TextEventExpression, } from "../elements/character/textEvent";
|
|
@@ -4,9 +4,12 @@ import { GameState } from "../../common/game";
|
|
|
4
4
|
import { LogicAction } from "../../game";
|
|
5
5
|
import type { LiveGameEventToken } from "../../types";
|
|
6
6
|
import { Image } from "../displayable/image";
|
|
7
|
+
import { Puppet } from "../displayable/puppet";
|
|
7
8
|
import { Layer } from "../layer";
|
|
8
9
|
import { DynamicPersistent, Persistent } from "../persistent";
|
|
9
10
|
import { Scene } from "../scene";
|
|
11
|
+
import type { Game } from "../../game";
|
|
12
|
+
import type { PuppetDescription, PuppetState, PuppetStatus } from "../../game/puppet/puppetBackend";
|
|
10
13
|
/** Snapshot of the dialog line currently presented to the player (ADV or NVL). */
|
|
11
14
|
export type DevToolsCurrentDialog = {
|
|
12
15
|
/** Id of the say action that produced the line (static id when assigned). */
|
|
@@ -68,6 +71,56 @@ export declare class DevTools {
|
|
|
68
71
|
static setDisplayableTransformProps(gameState: GameState, displayable: LogicAction.DisplayableElements, props: Record<string, unknown>, options?: {
|
|
69
72
|
merge?: boolean;
|
|
70
73
|
}): void;
|
|
74
|
+
/**
|
|
75
|
+
* The current state of a puppet's backend instance.
|
|
76
|
+
*
|
|
77
|
+
* `"missing-backend"` is the one an editor host should surface loudly: the element is on stage
|
|
78
|
+
* and behaving in every other respect, but nothing is drawing it, because the renderer the
|
|
79
|
+
* project depends on was never registered.
|
|
80
|
+
*/
|
|
81
|
+
static getPuppetStatus(puppet: Puppet): PuppetStatus;
|
|
82
|
+
/**
|
|
83
|
+
* Subscribe to a puppet's status changes. The listener receives the new status.
|
|
84
|
+
*/
|
|
85
|
+
static onPuppetStatusChange(puppet: Puppet, listener: (status: PuppetStatus) => void): LiveGameEventToken;
|
|
86
|
+
/**
|
|
87
|
+
* Ask a puppet's backend to describe its model — the motions, expressions, skins and parameters
|
|
88
|
+
* it can be driven with.
|
|
89
|
+
*
|
|
90
|
+
* This is what keeps model-format parsers out of an editor host: the inspector fills its
|
|
91
|
+
* dropdowns from the live instance. Returns null when the puppet is not mounted or its backend
|
|
92
|
+
* does not implement `describe`, in which case a host should fall back to free text.
|
|
93
|
+
*/
|
|
94
|
+
static describePuppet(gameState: GameState, puppet: Puppet): Promise<PuppetDescription | null>;
|
|
95
|
+
/**
|
|
96
|
+
* Read a puppet's persistent state. Returns a copy, `params` and `slots` included, so a host can
|
|
97
|
+
* hold on to it without aliasing the element.
|
|
98
|
+
*/
|
|
99
|
+
static getPuppetState(puppet: Puppet): PuppetState;
|
|
100
|
+
/**
|
|
101
|
+
* Overwrite a puppet's state and push it to the backend at once, without going through an
|
|
102
|
+
* action (so nothing lands in the story's history).
|
|
103
|
+
*
|
|
104
|
+
* By default the patch is merged over the current state, with `params` and `slots` merged key by
|
|
105
|
+
* key; with `merge: false` the state is replaced outright. Applying to an unmounted puppet is
|
|
106
|
+
* valid and does not warn — the state is complete by construction, so it is applied in full the
|
|
107
|
+
* next time the element mounts.
|
|
108
|
+
*/
|
|
109
|
+
static setPuppetState(gameState: GameState, puppet: Puppet, patch: Partial<PuppetState>, options?: {
|
|
110
|
+
merge?: boolean;
|
|
111
|
+
}): void;
|
|
112
|
+
/**
|
|
113
|
+
* Run a named command on a puppet's backend and wait for it.
|
|
114
|
+
*
|
|
115
|
+
* The engine never interprets the command; it is the escape hatch for everything the persistent
|
|
116
|
+
* state deliberately does not model (one-shot motions, hit tests, lip sync). Resolves without
|
|
117
|
+
* doing anything when the puppet is not mounted.
|
|
118
|
+
*/
|
|
119
|
+
static runPuppetCommand(gameState: GameState, puppet: Puppet, name: string, payload: unknown): Promise<void>;
|
|
120
|
+
/**
|
|
121
|
+
* The names of every puppet backend registered on this game.
|
|
122
|
+
*/
|
|
123
|
+
static listPuppetBackends(game: Game): string[];
|
|
71
124
|
/**
|
|
72
125
|
* Read the dialog line currently presented to the player, or null when no
|
|
73
126
|
* dialog is on screen. Covers both ADV (tracked via GameState.beginAdvDialog)
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Control, Layer } from "
|
|
2
|
-
import type { Scene, TransformDefinitions } from "
|
|
1
|
+
import { Control, Layer } from "../../common/core";
|
|
2
|
+
import type { Scene, TransformDefinitions } from "../../common/core";
|
|
3
3
|
export type ScreenEffectColor = string | {
|
|
4
4
|
r: number;
|
|
5
5
|
g: number;
|
|
@@ -11,6 +11,9 @@ import { Chained, Proxied } from "../action/chain";
|
|
|
11
11
|
* rotation, opacity, filter, ...).
|
|
12
12
|
*/
|
|
13
13
|
export type ICameraUserConfig = TransformDefinitions.ImageTransformProps;
|
|
14
|
+
export type CameraDataRaw = {
|
|
15
|
+
transformState: Record<string, any>;
|
|
16
|
+
};
|
|
14
17
|
/**
|
|
15
18
|
* A stage-wide camera.
|
|
16
19
|
*
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export type PauseConfig = {
|
|
2
2
|
duration?: number;
|
|
3
3
|
};
|
|
4
|
-
export type Pausing = Pause |
|
|
4
|
+
export type Pausing = Pause | typeof Pause;
|
|
5
5
|
export declare class Pause {
|
|
6
6
|
/**
|
|
7
7
|
* Create a pause with specific duration (milliseconds) that blocks until it passes.
|
|
@@ -11,6 +11,9 @@ export type CharacterConfig = {
|
|
|
11
11
|
avatar?: DialogAvatar | false;
|
|
12
12
|
portraits: (Image | CharacterPortraitConfig)[];
|
|
13
13
|
};
|
|
14
|
+
export type CharacterStateData = {
|
|
15
|
+
name: string;
|
|
16
|
+
};
|
|
14
17
|
export interface Character {
|
|
15
18
|
(content: string, config?: SentenceUserConfig): Proxied<Character, Chained<LogicAction.Actions>>;
|
|
16
19
|
(content: Sentence): Proxied<Character, Chained<LogicAction.Actions>>;
|
|
@@ -4,6 +4,19 @@ import { Chained, Proxied } from "../action/chain";
|
|
|
4
4
|
import { LambdaHandler, ActionStatements } from "../elements/type";
|
|
5
5
|
export declare class Lambda<T = any> {
|
|
6
6
|
}
|
|
7
|
+
export type ConditionData = {
|
|
8
|
+
If: {
|
|
9
|
+
condition: Lambda | null;
|
|
10
|
+
action: LogicAction.Actions[] | null;
|
|
11
|
+
};
|
|
12
|
+
ElseIf: {
|
|
13
|
+
condition: Lambda | null;
|
|
14
|
+
action: (LogicAction.Actions[]) | null;
|
|
15
|
+
}[];
|
|
16
|
+
Else: {
|
|
17
|
+
action: (LogicAction.Actions[]) | null;
|
|
18
|
+
};
|
|
19
|
+
};
|
|
7
20
|
export declare class Condition<Closed extends true | false = false> extends Actionable<null, Condition<true | false>> {
|
|
8
21
|
/**
|
|
9
22
|
* Create a new conditional branch that only runs when the condition is true.
|
|
@@ -1,7 +1,12 @@
|
|
|
1
1
|
import { Actionable } from "../action/actionable";
|
|
2
|
+
import { LogicAction } from "../action/logicAction";
|
|
2
3
|
import { Awaitable } from "../../../util/data";
|
|
4
|
+
import { Chained, Proxied } from "../action/chain";
|
|
3
5
|
import { ActionStatements, LambdaHandler } from "./type";
|
|
4
6
|
import { Lambda } from "./condition";
|
|
7
|
+
export type ControlConfig = {
|
|
8
|
+
allowFutureScene: boolean;
|
|
9
|
+
};
|
|
5
10
|
export declare class Control extends Actionable {
|
|
6
11
|
/**
|
|
7
12
|
* Execute actions in order, waiting for each action to complete.
|
|
@@ -12,7 +17,7 @@ export declare class Control extends Actionable {
|
|
|
12
17
|
* Control.do([character.say("hello"), image.char("path.png")]);
|
|
13
18
|
* ```
|
|
14
19
|
*/
|
|
15
|
-
static do(actions: ActionStatements):
|
|
20
|
+
static do(actions: ActionStatements): Proxied<Control, Chained<LogicAction.Actions>>;
|
|
16
21
|
/**
|
|
17
22
|
* Execute actions in order without waiting for completion.
|
|
18
23
|
* @param actions - Actions to run sequentially.
|
|
@@ -22,7 +27,7 @@ export declare class Control extends Actionable {
|
|
|
22
27
|
* Control.doAsync([sound.play(), image.char("path.png")]);
|
|
23
28
|
* ```
|
|
24
29
|
*/
|
|
25
|
-
static doAsync(actions: ActionStatements):
|
|
30
|
+
static doAsync(actions: ActionStatements): Proxied<Control, Chained<LogicAction.Actions>>;
|
|
26
31
|
/**
|
|
27
32
|
* Execute actions concurrently, resolving once any finishes.
|
|
28
33
|
*
|
|
@@ -37,7 +42,7 @@ export declare class Control extends Actionable {
|
|
|
37
42
|
* Control.any([sound.play(), image.char("happy.png")]);
|
|
38
43
|
* ```
|
|
39
44
|
*/
|
|
40
|
-
static any(actions: ActionStatements):
|
|
45
|
+
static any(actions: ActionStatements): Proxied<Control, Chained<LogicAction.Actions>>;
|
|
41
46
|
/**
|
|
42
47
|
* Execute actions concurrently and wait until all finish.
|
|
43
48
|
*
|
|
@@ -52,7 +57,7 @@ export declare class Control extends Actionable {
|
|
|
52
57
|
* Control.all([sound.play(), dialog.show()]);
|
|
53
58
|
* ```
|
|
54
59
|
*/
|
|
55
|
-
static all(actions: ActionStatements):
|
|
60
|
+
static all(actions: ActionStatements): Proxied<Control, Chained<LogicAction.Actions>>;
|
|
56
61
|
/**
|
|
57
62
|
* Execute actions concurrently and continue without waiting.
|
|
58
63
|
*
|
|
@@ -63,7 +68,7 @@ export declare class Control extends Actionable {
|
|
|
63
68
|
* @param actions - Actions to fire simultaneously.
|
|
64
69
|
* @chainable
|
|
65
70
|
*/
|
|
66
|
-
static allAsync(actions: ActionStatements):
|
|
71
|
+
static allAsync(actions: ActionStatements): Proxied<Control, Chained<LogicAction.Actions>>;
|
|
67
72
|
/**
|
|
68
73
|
* Execute actions multiple times.
|
|
69
74
|
* @param times - How many times to repeat.
|
|
@@ -74,26 +79,26 @@ export declare class Control extends Actionable {
|
|
|
74
79
|
* Control.repeat(3, [character.say("Again!")]);
|
|
75
80
|
* ```
|
|
76
81
|
*/
|
|
77
|
-
static repeat(times: number, actions: ActionStatements):
|
|
82
|
+
static repeat(times: number, actions: ActionStatements): Proxied<Control, Chained<LogicAction.Actions>>;
|
|
78
83
|
/**
|
|
79
84
|
* Repeat actions while a condition stays true.
|
|
80
85
|
* @param condition - Lambda to guard the loop.
|
|
81
86
|
* @param actions - Body actions to run each iteration.
|
|
82
87
|
* @chainable
|
|
83
88
|
*/
|
|
84
|
-
static whileLoop(condition: Lambda<boolean> | LambdaHandler<boolean>, actions: ActionStatements):
|
|
89
|
+
static whileLoop(condition: Lambda<boolean> | LambdaHandler<boolean>, actions: ActionStatements): Proxied<Control, Chained<LogicAction.Actions>>;
|
|
85
90
|
/**
|
|
86
91
|
* Break out of the nearest repeating loop (repeat or while).
|
|
87
92
|
* Can only be used inside a loop body.
|
|
88
93
|
* @chainable
|
|
89
94
|
*/
|
|
90
|
-
static breakLoop():
|
|
95
|
+
static breakLoop(): Proxied<Control, Chained<LogicAction.Actions>>;
|
|
91
96
|
/**
|
|
92
97
|
* Pause execution for a duration or until an `Awaitable` resolves.
|
|
93
98
|
* @param duration - Milliseconds or awaitable controlling the pause length.
|
|
94
99
|
* @chainable
|
|
95
100
|
*/
|
|
96
|
-
static sleep(duration: number | Awaitable<any> | Promise<any>):
|
|
101
|
+
static sleep(duration: number | Awaitable<any> | Promise<any>): Proxied<Control, Chained<LogicAction.Actions>>;
|
|
97
102
|
/**
|
|
98
103
|
* Pause execution until the user clicks anywhere on the stage (excluding GUI/Page elements).
|
|
99
104
|
* Similar to inserting a pause with no duration in a Sentence.
|
|
@@ -103,7 +108,7 @@ export declare class Control extends Actionable {
|
|
|
103
108
|
* Control.waitForClick();
|
|
104
109
|
* ```
|
|
105
110
|
*/
|
|
106
|
-
static waitForClick():
|
|
111
|
+
static waitForClick(): Proxied<Control, Chained<LogicAction.Actions>>;
|
|
107
112
|
/**
|
|
108
113
|
* Mark a named point inside the current scene that {@link Control.jump} can jump to.
|
|
109
114
|
* A label is invisible at runtime — it simply passes through to the next action.
|
|
@@ -120,7 +125,7 @@ export declare class Control extends Actionable {
|
|
|
120
125
|
* ]);
|
|
121
126
|
* ```
|
|
122
127
|
*/
|
|
123
|
-
static label(name: string):
|
|
128
|
+
static label(name: string): Proxied<Control, Chained<LogicAction.Actions>>;
|
|
124
129
|
/**
|
|
125
130
|
* Jump to a {@link Control.label} elsewhere in the same scene and resume playing from there.
|
|
126
131
|
*
|
|
@@ -140,67 +145,67 @@ export declare class Control extends Actionable {
|
|
|
140
145
|
* ]);
|
|
141
146
|
* ```
|
|
142
147
|
*/
|
|
143
|
-
static jump(name: string):
|
|
148
|
+
static jump(name: string): Proxied<Control, Chained<LogicAction.Actions>>;
|
|
144
149
|
constructor(/**@internal */ config?: Partial<ControlConfig>);
|
|
145
150
|
/**
|
|
146
151
|
* Execute actions in order, waiting for each action to complete
|
|
147
152
|
* @chainable
|
|
148
153
|
*/
|
|
149
|
-
do(actions: ActionStatements):
|
|
154
|
+
do(actions: ActionStatements): Proxied<Control, Chained<LogicAction.Actions>>;
|
|
150
155
|
/**
|
|
151
156
|
* Execute actions in order, do not wait for this action to complete
|
|
152
157
|
* @chainable
|
|
153
158
|
*/
|
|
154
|
-
doAsync(actions: ActionStatements):
|
|
159
|
+
doAsync(actions: ActionStatements): Proxied<Control, Chained<LogicAction.Actions>>;
|
|
155
160
|
/**
|
|
156
161
|
* Execute all actions at the same time, waiting for any one action to complete
|
|
157
162
|
* @chainable
|
|
158
163
|
*/
|
|
159
|
-
any(actions: ActionStatements):
|
|
164
|
+
any(actions: ActionStatements): Proxied<Control, Chained<LogicAction.Actions>>;
|
|
160
165
|
/**
|
|
161
166
|
* Execute all actions at the same time, waiting for all actions to complete
|
|
162
167
|
* @chainable
|
|
163
168
|
*/
|
|
164
|
-
all(actions: ActionStatements):
|
|
169
|
+
all(actions: ActionStatements): Proxied<Control, Chained<LogicAction.Actions>>;
|
|
165
170
|
/**
|
|
166
171
|
* Execute all actions at the same time, do not wait for all actions to complete
|
|
167
172
|
* @chainable
|
|
168
173
|
*/
|
|
169
|
-
allAsync(actions: ActionStatements):
|
|
174
|
+
allAsync(actions: ActionStatements): Proxied<Control, Chained<LogicAction.Actions>>;
|
|
170
175
|
/**
|
|
171
176
|
* Execute actions multiple times
|
|
172
177
|
* @chainable
|
|
173
178
|
*/
|
|
174
|
-
repeat(times: number, actions: ActionStatements):
|
|
179
|
+
repeat(times: number, actions: ActionStatements): Proxied<Control, Chained<LogicAction.Actions>>;
|
|
175
180
|
/**
|
|
176
181
|
* Execute actions while condition is true
|
|
177
182
|
* @chainable
|
|
178
183
|
*/
|
|
179
|
-
whileLoop(condition: Lambda<boolean> | LambdaHandler<boolean>, actions: ActionStatements):
|
|
184
|
+
whileLoop(condition: Lambda<boolean> | LambdaHandler<boolean>, actions: ActionStatements): Proxied<Control, Chained<LogicAction.Actions>>;
|
|
180
185
|
/**
|
|
181
186
|
* Break the current loop (repeat/while)
|
|
182
187
|
* Can only be used inside a loop body
|
|
183
188
|
* @chainable
|
|
184
189
|
*/
|
|
185
|
-
breakLoop():
|
|
190
|
+
breakLoop(): Proxied<Control, Chained<LogicAction.Actions>>;
|
|
186
191
|
/**
|
|
187
192
|
* Sleep for a duration
|
|
188
193
|
* @chainable
|
|
189
194
|
*/
|
|
190
|
-
sleep(duration: number | Awaitable<any> | Promise<any>):
|
|
195
|
+
sleep(duration: number | Awaitable<any> | Promise<any>): Proxied<Control, Chained<LogicAction.Actions>>;
|
|
191
196
|
/**
|
|
192
197
|
* Wait for user to click the stage (excluding GUI elements)
|
|
193
198
|
* @chainable
|
|
194
199
|
*/
|
|
195
|
-
waitForClick():
|
|
200
|
+
waitForClick(): Proxied<Control, Chained<LogicAction.Actions>>;
|
|
196
201
|
/**
|
|
197
202
|
* Mark a named point inside the current scene that {@link Control.jump} can jump to.
|
|
198
203
|
* @chainable
|
|
199
204
|
*/
|
|
200
|
-
label(name: string):
|
|
205
|
+
label(name: string): Proxied<Control, Chained<LogicAction.Actions>>;
|
|
201
206
|
/**
|
|
202
207
|
* Jump to a {@link Control.label} in the same scene and resume playing from there.
|
|
203
208
|
* @chainable
|
|
204
209
|
*/
|
|
205
|
-
jump(name: string):
|
|
210
|
+
jump(name: string): Proxied<Control, Chained<LogicAction.Actions>>;
|
|
206
211
|
}
|
|
@@ -43,6 +43,10 @@ export interface IImageUserConfig<Tag extends TagGroupDefinition | null = TagGro
|
|
|
43
43
|
*/
|
|
44
44
|
darkness?: number;
|
|
45
45
|
}
|
|
46
|
+
export type ImageDataRaw = {
|
|
47
|
+
state: Record<string, any>;
|
|
48
|
+
transformState: Record<string, any>;
|
|
49
|
+
};
|
|
46
50
|
export type TagGroupDefinition = string[][];
|
|
47
51
|
export type TagSrcResolver<T extends TagGroupDefinition> = (...tags: SelectElementFromEach<T>) => string;
|
|
48
52
|
/**
|