@team-antioch/sc2-adjutant 0.1.0 → 0.1.1
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/README.md +2 -0
- package/data/blizzard-baseline.json +3061 -0
- package/data/button-hotkeys.json +5722 -0
- package/data/game-assets.json +50909 -0
- package/data/package-entries.json +32361 -2
- package/dist/capture/bank-fixtures.d.ts +13 -0
- package/dist/capture/bank-fixtures.js +35 -0
- package/dist/capture/bank-snapshots.d.ts +95 -0
- package/dist/capture/bank-snapshots.js +302 -0
- package/dist/capture/editor-broker-client.d.ts +27 -4
- package/dist/capture/editor-broker-client.js +3 -3
- package/dist/capture/editor-broker.js +154 -9
- package/dist/capture/effect-tour.d.ts +113 -0
- package/dist/capture/effect-tour.js +283 -0
- package/dist/capture/effect-video.d.ts +74 -0
- package/dist/capture/effect-video.js +173 -0
- package/dist/capture/exemplar-capture.d.ts +4 -0
- package/dist/capture/exemplar-capture.js +4 -1
- package/dist/capture/shots.d.ts +6 -1
- package/dist/capture/shots.js +1 -1
- package/dist/capture/stop-tour.d.ts +3 -1
- package/dist/capture/stop-tour.js +1 -1
- package/dist/capture/style-pack-captures.d.ts +67 -0
- package/dist/capture/style-pack-captures.js +172 -0
- package/dist/catalog/stock-catalog.d.ts +8 -0
- package/dist/catalog/stock-catalog.js +13 -0
- package/dist/cli/capture-exemplars.js +18 -32
- package/dist/cli/effect-tour.d.ts +2 -0
- package/dist/cli/effect-tour.js +378 -0
- package/dist/cli/make-frames.d.ts +1 -0
- package/dist/cli/make-frames.js +21 -0
- package/dist/cli/sound-mix.d.ts +1 -0
- package/dist/cli/sound-mix.js +75 -0
- package/dist/cli/study.js +6 -26
- package/dist/domain/blueprint-trigger.d.ts +355 -3
- package/dist/domain/blueprint-trigger.js +149 -8
- package/dist/domain/library-interface.d.ts +50 -29
- package/dist/domain/library-interface.js +54 -41
- package/dist/domain/mission-blueprint.d.ts +13 -6
- package/dist/domain/mission-blueprint.js +6 -0
- package/dist/domain/mod-blueprint.d.ts +4 -4
- package/dist/host/game-logs.d.ts +63 -0
- package/dist/host/game-logs.js +178 -0
- package/dist/host/game-ownership.d.ts +37 -0
- package/dist/host/game-ownership.js +84 -0
- package/dist/host/game-run-report.d.ts +63 -0
- package/dist/host/game-run-report.js +119 -0
- package/dist/host/known-errors.d.ts +34 -0
- package/dist/host/known-errors.js +73 -0
- package/dist/init/init-workspace.d.ts +3 -1
- package/dist/init/init-workspace.js +10 -1
- package/dist/map/convert-mission-triggers.d.ts +115 -7
- package/dist/map/convert-mission-triggers.js +527 -47
- package/dist/map/editor-changes.d.ts +1 -1
- package/dist/map/editor-form.d.ts +5 -0
- package/dist/map/editor-form.js +72 -0
- package/dist/map/game-packages.d.ts +3 -2
- package/dist/map/game-packages.js +5 -2
- package/dist/map/kept-references.js +47 -1
- package/dist/map/kept-session.js +3 -1
- package/dist/map/outline-diff.d.ts +24 -0
- package/dist/map/outline-diff.js +95 -0
- package/dist/map/outline-trigger.d.ts +7 -0
- package/dist/map/outline-trigger.js +29 -20
- package/dist/map/ownership-plan.d.ts +6 -2
- package/dist/map/ownership-plan.js +1 -1
- package/dist/map/package-output.js +13 -8
- package/dist/map/tune-kept-triggers.d.ts +7 -0
- package/dist/map/tune-kept-triggers.js +33 -6
- package/dist/map/write-blueprint-trigger.d.ts +9 -4
- package/dist/map/write-blueprint-trigger.js +46 -13
- package/dist/map/write-map-package.js +20 -9
- package/dist/mcp/capture-jobs.d.ts +2 -0
- package/dist/mcp/capture-jobs.js +2 -0
- package/dist/mcp/server.d.ts +11 -2
- package/dist/mcp/server.js +17 -4
- package/dist/mcp/tools/bank-report.d.ts +19 -0
- package/dist/mcp/tools/bank-report.js +51 -0
- package/dist/mcp/tools/blueprint.js +18 -14
- package/dist/mcp/tools/capture.d.ts +4 -0
- package/dist/mcp/tools/capture.js +22 -5
- package/dist/mcp/tools/catalog.d.ts +1 -1
- package/dist/mcp/tools/catalog.js +30 -1
- package/dist/mcp/tools/compile.d.ts +1 -1
- package/dist/mcp/tools/compile.js +100 -9
- package/dist/mcp/tools/editor-handoff.d.ts +4 -1
- package/dist/mcp/tools/editor-handoff.js +6 -3
- package/dist/mcp/tools/style-pack.d.ts +11 -0
- package/dist/mcp/tools/style-pack.js +245 -0
- package/dist/mcp/tools/tool-group.d.ts +9 -0
- package/dist/mods/button-hotkeys.d.ts +45 -0
- package/dist/mods/button-hotkeys.js +185 -0
- package/dist/mods/compile-mod.js +19 -5
- package/dist/mods/custom-doodads.d.ts +21 -1
- package/dist/mods/custom-doodads.js +53 -7
- package/dist/mods/data-rules.js +8 -1
- package/dist/mods/effective-entry.d.ts +18 -0
- package/dist/mods/effective-entry.js +52 -0
- package/dist/mods/function-search.js +12 -0
- package/dist/mods/library-xml.d.ts +34 -5
- package/dist/mods/library-xml.js +94 -22
- package/dist/mods/sound-mix.d.ts +92 -0
- package/dist/mods/sound-mix.js +195 -0
- package/dist/plugins/check-workspace.js +22 -3
- package/dist/plugins/plugin-api.d.ts +59 -5
- package/dist/plugins/plugin-api.js +6 -0
- package/dist/plugins/plugin-sdk.d.ts +13 -1
- package/dist/plugins/plugin-sdk.js +16 -1
- package/dist/plugins/plugin-sources.js +1 -0
- package/dist/plugins/registry.d.ts +4 -0
- package/dist/plugins/registry.js +6 -2
- package/dist/plugins/workspace.d.ts +5 -0
- package/dist/plugins/workspace.js +10 -2
- package/dist/study/blizzard-baseline.d.ts +76 -0
- package/dist/study/blizzard-baseline.js +137 -0
- package/dist/study/exemplar-report.d.ts +71 -0
- package/dist/study/exemplar-report.js +163 -0
- package/dist/study/find-places.d.ts +127 -0
- package/dist/study/find-places.js +306 -0
- package/dist/study/load-map-package.d.ts +3 -0
- package/dist/study/load-map-package.js +11 -0
- package/dist/study/map-study.d.ts +1 -0
- package/dist/study/map-study.js +3 -0
- package/dist/study/measure-lighting.d.ts +6 -0
- package/dist/study/measure-lighting.js +1 -1
- package/dist/study/measures.d.ts +225 -0
- package/dist/study/measures.js +366 -0
- package/dist/study/scaffold-style-pack.d.ts +58 -0
- package/dist/study/scaffold-style-pack.js +261 -0
- package/dist/study/study-exemplars.d.ts +67 -0
- package/dist/study/study-exemplars.js +133 -0
- package/dist/triggers/blueprint-triggers.d.ts +71 -11
- package/dist/triggers/blueprint-triggers.js +403 -48
- package/dist/triggers/kept-trigger-galaxy.d.ts +29 -0
- package/dist/triggers/kept-trigger-galaxy.js +103 -7
- package/dist/triggers/splice-map-script.d.ts +2 -0
- package/dist/triggers/splice-map-script.js +309 -8
- package/dist/triggers/write-triggers-xml.js +20 -5
- package/dist/ui/frame-path-check.d.ts +43 -4
- package/dist/ui/frame-path-check.js +121 -13
- package/dist/ui/frame-paths.d.ts +21 -1
- package/dist/ui/frame-paths.js +26 -6
- package/dist/ui/toast.d.ts +4 -5
- package/dist/ui/toast.js +6 -10
- package/examples/example-campaign/README.md +27 -0
- package/examples/example-campaign/missions/ashfall-relay/blueprint.json +11 -1
- package/examples/example-campaign/missions/ashfall-relay/triggers/ash-tremors.json +69 -0
- package/examples/example-campaign/missions/ashfall-relay/triggers/start-ash-tremors.json +31 -0
- package/package.json +3 -3
|
@@ -93,6 +93,13 @@ function variableTypeLines(variable) {
|
|
|
93
93
|
}
|
|
94
94
|
return [`${INDENT}<Type Value="${variable.type}"/>`];
|
|
95
95
|
}
|
|
96
|
+
function claimCall(parents, id, parent) {
|
|
97
|
+
const first = parents.get(id);
|
|
98
|
+
if (first !== undefined) {
|
|
99
|
+
throw new Error(`The call ${id} is referenced from two places, ${first} and ${parent}: the Editor gives a call one parent, and writes an empty argument where two share one`);
|
|
100
|
+
}
|
|
101
|
+
parents.set(id, parent);
|
|
102
|
+
}
|
|
96
103
|
function element(type, id, body) {
|
|
97
104
|
return [
|
|
98
105
|
`${INDENT}<Element Type="${type}" Id="${id}">`,
|
|
@@ -104,13 +111,16 @@ function element(type, id, body) {
|
|
|
104
111
|
* Emits a call followed, depth-first, by its parameters and any nested calls, then the calls in
|
|
105
112
|
* its blocks, each marked with its sub-function (as an Editor-saved map's If Then Else and Pick Each are).
|
|
106
113
|
*/
|
|
107
|
-
function callElements(call, subFunction) {
|
|
114
|
+
function callElements(call, parents, subFunction) {
|
|
108
115
|
const paramNames = Object.keys(call.def.params);
|
|
109
116
|
const missing = paramNames.filter((name) => !call.params[name]);
|
|
110
117
|
if (missing.length > 0) {
|
|
111
118
|
throw new Error(`Call ${call.id} (${call.def.library}/${call.def.id}) is missing params: ${missing.join(", ")}`);
|
|
112
119
|
}
|
|
113
120
|
const blocks = call.blocks ?? [];
|
|
121
|
+
for (const block of blocks)
|
|
122
|
+
for (const child of block.calls)
|
|
123
|
+
claimCall(parents, child.id, `a block of the call ${call.id}`);
|
|
114
124
|
const lines = element("FunctionCall", call.id, [
|
|
115
125
|
`<FunctionDef Type="FunctionDef" Library="${call.def.library}" Id="${call.def.id}"/>`,
|
|
116
126
|
...(subFunction ? [`<SubFunctionType Type="SubFuncType" Library="${subFunction.library}" Id="${subFunction.id}"/>`] : []),
|
|
@@ -122,12 +132,13 @@ function callElements(call, subFunction) {
|
|
|
122
132
|
const paramDef = call.def.params[name];
|
|
123
133
|
lines.push(...element("Param", param.id, paramBody(param, `<ParameterDef Type="ParamDef" Library="${call.def.library}" Id="${paramDef.id}"/>`)));
|
|
124
134
|
if (param.value.kind === "call") {
|
|
125
|
-
|
|
135
|
+
claimCall(parents, param.value.call.id, `the parameter ${param.id} of the call ${call.id}`);
|
|
136
|
+
lines.push(...callElements(param.value.call, parents));
|
|
126
137
|
}
|
|
127
138
|
}
|
|
128
139
|
for (const block of blocks) {
|
|
129
140
|
for (const child of block.calls)
|
|
130
|
-
lines.push(...callElements(child, block.type));
|
|
141
|
+
lines.push(...callElements(child, parents, block.type));
|
|
131
142
|
}
|
|
132
143
|
return lines;
|
|
133
144
|
}
|
|
@@ -141,6 +152,7 @@ function itemLine(item) {
|
|
|
141
152
|
/** Writes a Triggers component the way Editor 5.0.17 does (CRLF, no trailing newline). */
|
|
142
153
|
export function writeTriggersXml(doc) {
|
|
143
154
|
const tree = triggerTree(doc);
|
|
155
|
+
const parents = new Map();
|
|
144
156
|
const lines = ['<?xml version="1.0" encoding="utf-8"?>', "<TriggerData>", `${INDENT}<Root>`];
|
|
145
157
|
for (const item of tree)
|
|
146
158
|
lines.push(`${INDENT}${INDENT}${itemLine(item)}`);
|
|
@@ -162,11 +174,14 @@ export function writeTriggersXml(doc) {
|
|
|
162
174
|
`<Value Type="Param" Id="${variable.initial.id}"/>`,
|
|
163
175
|
]), ...element("Param", variable.initial.id, paramBody(variable.initial, undefined)));
|
|
164
176
|
if (variable.initial.value.kind === "call") {
|
|
165
|
-
|
|
177
|
+
claimCall(parents, variable.initial.value.call.id, `the initial value ${variable.initial.id} of the variable ${variable.id}`);
|
|
178
|
+
lines.push(...callElements(variable.initial.value.call, parents));
|
|
166
179
|
}
|
|
167
180
|
return;
|
|
168
181
|
}
|
|
169
182
|
const { trigger } = item;
|
|
183
|
+
for (const call of triggerCalls(trigger))
|
|
184
|
+
claimCall(parents, call.id, `the trigger ${trigger.id}`);
|
|
170
185
|
lines.push(...element("Trigger", trigger.id, [
|
|
171
186
|
// First, as in thanson01's Editor-saved Triggers.
|
|
172
187
|
...(trigger.initiallyOff ? ["<InitOff/>"] : []),
|
|
@@ -175,7 +190,7 @@ export function writeTriggersXml(doc) {
|
|
|
175
190
|
...trigger.actions.map((call) => `<Action Type="FunctionCall" Id="${call.id}"/>`),
|
|
176
191
|
]));
|
|
177
192
|
for (const call of triggerCalls(trigger)) {
|
|
178
|
-
lines.push(...callElements(call));
|
|
193
|
+
lines.push(...callElements(call, parents));
|
|
179
194
|
}
|
|
180
195
|
};
|
|
181
196
|
tree.forEach(visit);
|
|
@@ -33,7 +33,8 @@ export type GeneratedUi = {
|
|
|
33
33
|
*/
|
|
34
34
|
export declare function componentUi(on: readonly UiComponentOn[], blueprintPath: string, library: string | undefined): GeneratedUi;
|
|
35
35
|
/** A path no layout has: the native it's first passed to, the file and where in it (line 12, ui.bossBar), and in how many places in all. */
|
|
36
|
-
export type
|
|
36
|
+
export type MissingFramePath = {
|
|
37
|
+
readonly kind: "missing";
|
|
37
38
|
readonly native: FramePathNative;
|
|
38
39
|
readonly path: string;
|
|
39
40
|
readonly file: string;
|
|
@@ -41,12 +42,50 @@ export type FramePathWarning = {
|
|
|
41
42
|
readonly places: number;
|
|
42
43
|
readonly message: string;
|
|
43
44
|
};
|
|
45
|
+
/** A hookup whose control type isn't the type of the frame it names, at its first place. */
|
|
46
|
+
export type ControlTypeMismatch = {
|
|
47
|
+
readonly kind: "controlType";
|
|
48
|
+
readonly native: FramePathNative;
|
|
49
|
+
readonly path: string;
|
|
50
|
+
readonly controlType: string;
|
|
51
|
+
readonly file: string;
|
|
52
|
+
readonly where: string;
|
|
53
|
+
readonly places: number;
|
|
54
|
+
readonly message: string;
|
|
55
|
+
};
|
|
56
|
+
/** A frame made from a template that its own layout file declares further down. */
|
|
57
|
+
export type TemplateOutOfOrder = {
|
|
58
|
+
readonly kind: "templateOrder";
|
|
59
|
+
/** The layout file: its path in the package, or the generated layout's. */
|
|
60
|
+
readonly file: string;
|
|
61
|
+
/** The frame, by its path from the file's top. */
|
|
62
|
+
readonly frame: string;
|
|
63
|
+
readonly template: string;
|
|
64
|
+
readonly where: string;
|
|
65
|
+
readonly message: string;
|
|
66
|
+
};
|
|
67
|
+
export type FramePathWarning = MissingFramePath | ControlTypeMismatch | TemplateOutOfOrder;
|
|
68
|
+
/**
|
|
69
|
+
* The layout types of the frames at a path when `controlType` can't be what they are: every frame
|
|
70
|
+
* has a basic type, and none is `controlType`'s. Nothing for a control that isn't a basic one, a
|
|
71
|
+
* frame with no type or one that isn't basic (Frame, or Blizzard's own: Panel hooks them all), or
|
|
72
|
+
* no frames.
|
|
73
|
+
*/
|
|
74
|
+
export declare function mismatchedTypes(controlType: string, frames: readonly {
|
|
75
|
+
readonly types: readonly string[];
|
|
76
|
+
}[]): string[] | undefined;
|
|
77
|
+
/** The frames of `xml`, a layout file's text, made from a template of their own file (`stem`) that the file declares below them. */
|
|
78
|
+
export declare function templatesOutOfOrder(file: string, stem: string, xml: string): TemplateOutOfOrder[];
|
|
44
79
|
/**
|
|
45
|
-
* The
|
|
46
|
-
* and the way it's read, at the first place it's passed.
|
|
80
|
+
* The frame-path check's warnings on the mod at `modPackage`. The literal frame paths it passes
|
|
81
|
+
* that no layout has: one warning per path and the way it's read, at the first place it's passed.
|
|
82
|
+
* A hookup whose control type isn't its frame's: one per path and type. A template its own file
|
|
83
|
+
* declares below a frame that uses it, in the layouts it loads. The layouts are those its DescIndex loads
|
|
47
84
|
* and Blizzard's. A path its Kept triggers pass is counted from the package's Galaxy, which the
|
|
48
85
|
* Editor writes them into, and from its Triggers file only when no Galaxy passes it. `generated`
|
|
49
86
|
* is what its compile adds: a generated layout loads, standing in for the package's file of that
|
|
50
87
|
* path, and a generated function's Galaxy is counted there rather than in the package's copy.
|
|
51
88
|
*/
|
|
52
|
-
export declare function
|
|
89
|
+
export declare function modFrameWarnings(modPackage: string, generated?: GeneratedUi, snapshot?: FrameSnapshotTree): Promise<FramePathWarning[]>;
|
|
90
|
+
/** Just the paths no layout has, of `modFrameWarnings`. */
|
|
91
|
+
export declare function modFramePathWarnings(modPackage: string, generated?: GeneratedUi, snapshot?: FrameSnapshotTree): Promise<MissingFramePath[]>;
|
|
@@ -12,6 +12,18 @@
|
|
|
12
12
|
// DialogControlCreate(InPanel)FromTemplate a template, by its file and path
|
|
13
13
|
// DialogControlHookup a frame relative to a panel the check can't follow,
|
|
14
14
|
// so one some frame's path ends in
|
|
15
|
+
//
|
|
16
|
+
// Two more warnings come from the layouts the mod loads, for pitfalls that otherwise show only in
|
|
17
|
+
// game (docs/reference/editor-and-engine.md, "UI layout pitfalls"):
|
|
18
|
+
//
|
|
19
|
+
// template order a frame made from a template its own file declares further down, which the game
|
|
20
|
+
// fails to find
|
|
21
|
+
// control type a literal hookup whose control-type constant (c_triggerControlTypeImage) is a
|
|
22
|
+
// different basic type from the frame's `type` in the mod's layouts. Only the
|
|
23
|
+
// basic types are compared: Blizzard's own code hooks a Panel to frames of any
|
|
24
|
+
// type and a Button, an Image or a Label to a plain Frame, so those pass. A
|
|
25
|
+
// frame whose layout gave it no type (Blizzard's, from the snapshot, until it
|
|
26
|
+
// records them) isn't compared.
|
|
15
27
|
import { readdir, readFile } from "node:fs/promises";
|
|
16
28
|
import path from "node:path";
|
|
17
29
|
import { fileURLToPath } from "node:url";
|
|
@@ -62,6 +74,66 @@ export function componentUi(on, blueprintPath, library) {
|
|
|
62
74
|
}),
|
|
63
75
|
};
|
|
64
76
|
}
|
|
77
|
+
/** The basic control types, each by its layout type in lower case, as its c_triggerControlType constant names it. */
|
|
78
|
+
const BASIC_CONTROLS = new Map(["Label", "Image", "Button", "CheckBox", "EditBox", "ListBox", "ProgressBar", "Slider", "Pulldown", "Portrait"].map((name) => [name.toLowerCase(), name]));
|
|
79
|
+
/**
|
|
80
|
+
* The layout types of the frames at a path when `controlType` can't be what they are: every frame
|
|
81
|
+
* has a basic type, and none is `controlType`'s. Nothing for a control that isn't a basic one, a
|
|
82
|
+
* frame with no type or one that isn't basic (Frame, or Blizzard's own: Panel hooks them all), or
|
|
83
|
+
* no frames.
|
|
84
|
+
*/
|
|
85
|
+
export function mismatchedTypes(controlType, frames) {
|
|
86
|
+
const control = controlType.replace(/^c_triggerControlType/, "").toLowerCase();
|
|
87
|
+
if (!BASIC_CONTROLS.has(control) || frames.length === 0)
|
|
88
|
+
return undefined;
|
|
89
|
+
if (frames.some((frame) => frame.types.length === 0 || frame.types.some((type) => !BASIC_CONTROLS.has(type)) || frame.types.includes(control)))
|
|
90
|
+
return undefined;
|
|
91
|
+
return [...new Set(frames.flatMap((frame) => frame.types))];
|
|
92
|
+
}
|
|
93
|
+
/** The frames of `xml`, a layout file's text, made from a template of their own file (`stem`) that the file declares below them. */
|
|
94
|
+
export function templatesOutOfOrder(file, stem, xml) {
|
|
95
|
+
const declared = new Map();
|
|
96
|
+
const uses = [];
|
|
97
|
+
let index = 0;
|
|
98
|
+
const visit = (frame, above) => {
|
|
99
|
+
const names = [...above, ...pathSegments(xmlAttribute(frame, "name") ?? "")];
|
|
100
|
+
const at = index++;
|
|
101
|
+
const key = names.join("/").toLowerCase();
|
|
102
|
+
if (!declared.has(key))
|
|
103
|
+
declared.set(key, at);
|
|
104
|
+
const template = xmlAttribute(frame, "template");
|
|
105
|
+
if (template)
|
|
106
|
+
uses.push({ frame: names, template, index: at });
|
|
107
|
+
for (const child of frame.children)
|
|
108
|
+
if (child.name === "Frame" && xmlAttribute(child, "name"))
|
|
109
|
+
visit(child, names);
|
|
110
|
+
};
|
|
111
|
+
const desc = xmlTree(xml).find((node) => node.name === "Desc");
|
|
112
|
+
for (const frame of desc?.children ?? [])
|
|
113
|
+
if (frame.name === "Frame" && xmlAttribute(frame, "name"))
|
|
114
|
+
visit(frame, [xmlAttribute(frame, "file") ?? stem]);
|
|
115
|
+
const out = [];
|
|
116
|
+
for (const use of uses) {
|
|
117
|
+
const names = pathSegments(use.template);
|
|
118
|
+
// Only the file's own templates: another file's load before or after it as the DescIndex orders them.
|
|
119
|
+
if (names[0]?.toLowerCase() !== stem.toLowerCase())
|
|
120
|
+
continue;
|
|
121
|
+
const at = declared.get(names.join("/").toLowerCase());
|
|
122
|
+
if (at === undefined || at <= use.index)
|
|
123
|
+
continue;
|
|
124
|
+
const frame = use.frame.join("/");
|
|
125
|
+
const template = names.join("/");
|
|
126
|
+
out.push({
|
|
127
|
+
kind: "templateOrder",
|
|
128
|
+
file,
|
|
129
|
+
frame,
|
|
130
|
+
template,
|
|
131
|
+
where: `frame "${frame}"`,
|
|
132
|
+
message: `The frame "${frame}" is made from the template "${template}", which ${path.basename(file)} declares further down. A template has to come before the frames that use it in the same file, or the game logs "Failed to locate specified Desc" and builds the frame without it. Move the template above "${frame}"`,
|
|
133
|
+
});
|
|
134
|
+
}
|
|
135
|
+
return out;
|
|
136
|
+
}
|
|
65
137
|
const LAYOUT = /\.sc2layout$/i;
|
|
66
138
|
const GALAXY = /\.galaxy$/i;
|
|
67
139
|
const WHAT = {
|
|
@@ -78,6 +150,15 @@ function known(tree, native, framePath) {
|
|
|
78
150
|
return tree.endsWith(framePath);
|
|
79
151
|
return tree.has(framePath);
|
|
80
152
|
}
|
|
153
|
+
/** The frames `native` names by `framePath`, as `known` reads it, with the types layouts gave them. */
|
|
154
|
+
function framesAt(tree, native, framePath) {
|
|
155
|
+
const reading = FRAME_PATH_NATIVES[native].reading;
|
|
156
|
+
if (reading === "gameUI")
|
|
157
|
+
return tree.find(`GameUI/GameUI/${framePath}`);
|
|
158
|
+
if (reading === "relative")
|
|
159
|
+
return tree.findEndingWith(framePath);
|
|
160
|
+
return tree.find(framePath);
|
|
161
|
+
}
|
|
81
162
|
/** Where each of `text`'s lines starts. */
|
|
82
163
|
function lineStarts(text) {
|
|
83
164
|
const starts = [0];
|
|
@@ -155,14 +236,16 @@ async function loadedLayouts(files) {
|
|
|
155
236
|
return loaded;
|
|
156
237
|
}
|
|
157
238
|
/**
|
|
158
|
-
* The
|
|
159
|
-
* and the way it's read, at the first place it's passed.
|
|
239
|
+
* The frame-path check's warnings on the mod at `modPackage`. The literal frame paths it passes
|
|
240
|
+
* that no layout has: one warning per path and the way it's read, at the first place it's passed.
|
|
241
|
+
* A hookup whose control type isn't its frame's: one per path and type. A template its own file
|
|
242
|
+
* declares below a frame that uses it, in the layouts it loads. The layouts are those its DescIndex loads
|
|
160
243
|
* and Blizzard's. A path its Kept triggers pass is counted from the package's Galaxy, which the
|
|
161
244
|
* Editor writes them into, and from its Triggers file only when no Galaxy passes it. `generated`
|
|
162
245
|
* is what its compile adds: a generated layout loads, standing in for the package's file of that
|
|
163
246
|
* path, and a generated function's Galaxy is counted there rather than in the package's copy.
|
|
164
247
|
*/
|
|
165
|
-
export async function
|
|
248
|
+
export async function modFrameWarnings(modPackage, generated = {}, snapshot) {
|
|
166
249
|
const files = await filesUnder(modPackage);
|
|
167
250
|
const relative = (file) => path.relative(modPackage, file).split(path.sep).join("/").toLowerCase();
|
|
168
251
|
const replaced = new Set((generated.layouts ?? []).map((layout) => layout.file.toLowerCase()));
|
|
@@ -170,14 +253,20 @@ export async function modFramePathWarnings(modPackage, generated = {}, snapshot)
|
|
|
170
253
|
const loaded = await loadedLayouts(new Map(files.map((file) => [relative(file), file])));
|
|
171
254
|
const stem = (file) => path.posix.basename(file.split(path.sep).join("/")).replace(LAYOUT, "");
|
|
172
255
|
const layouts = [];
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
256
|
+
const outOfOrder = [];
|
|
257
|
+
for (const file of files.filter((each) => loaded.has(relative(each)) && !replaced.has(relative(each)))) {
|
|
258
|
+
const xml = await readFile(file, "utf8");
|
|
259
|
+
layouts.push({ name: stem(file), xml });
|
|
260
|
+
outOfOrder.push(...templatesOutOfOrder(file, stem(file), xml));
|
|
261
|
+
}
|
|
262
|
+
for (const layout of generated.layouts ?? []) {
|
|
176
263
|
layouts.push({ name: stem(layout.file), xml: layout.content });
|
|
264
|
+
outOfOrder.push(...templatesOutOfOrder(path.resolve(modPackage, layout.file), stem(layout.file), layout.content));
|
|
265
|
+
}
|
|
177
266
|
const tree = FrameTree.over(snapshot ? FrameTree.fromSnapshot(snapshot) : await bundledFrameTree()).addLayouts(layouts);
|
|
178
267
|
const id = (native, framePath) => `${FRAME_PATH_NATIVES[native].reading}\n${framePath.toLowerCase()}`;
|
|
179
268
|
// Each call once: a generated function's from its source (ui.bossBar), not the package's compiled copy of it.
|
|
180
|
-
const fromGenerated = (generated.galaxy ?? []).flatMap((source) => framePathCalls(source.text).map((call) => ({ native: call.native, path: call.path, file: path.resolve(modPackage, source.file), where: source.where })));
|
|
269
|
+
const fromGenerated = (generated.galaxy ?? []).flatMap((source) => framePathCalls(source.text).map((call) => ({ native: call.native, path: call.path, file: path.resolve(modPackage, source.file), where: source.where, ...(call.controlType ? { controlType: call.controlType } : {}) })));
|
|
181
270
|
const generatedFunctions = new Set((generated.galaxy ?? []).flatMap((source) => framePathCalls(source.text).flatMap((call) => call.function ?? source.function ?? [])));
|
|
182
271
|
const found = [];
|
|
183
272
|
const fromTriggers = [];
|
|
@@ -185,7 +274,7 @@ export async function modFramePathWarnings(modPackage, generated = {}, snapshot)
|
|
|
185
274
|
if (GALAXY.test(file)) {
|
|
186
275
|
for (const call of framePathCalls(await readFile(file, "utf8")))
|
|
187
276
|
if (!call.function || !generatedFunctions.has(call.function))
|
|
188
|
-
found.push({ native: call.native, path: call.path, file, where: `line ${call.line}
|
|
277
|
+
found.push({ native: call.native, path: call.path, file, where: `line ${call.line}`, ...(call.controlType ? { controlType: call.controlType } : {}) });
|
|
189
278
|
}
|
|
190
279
|
else if (relative(file) === "triggers")
|
|
191
280
|
for (const call of triggerCalls(await readFile(file, "utf8")))
|
|
@@ -194,15 +283,34 @@ export async function modFramePathWarnings(modPackage, generated = {}, snapshot)
|
|
|
194
283
|
const inGalaxy = new Set([...found, ...fromGenerated].map((call) => id(call.native, call.path)));
|
|
195
284
|
found.push(...fromTriggers.filter((call) => !inGalaxy.has(id(call.native, call.path))), ...fromGenerated);
|
|
196
285
|
const warnings = new Map();
|
|
286
|
+
const mismatches = new Map();
|
|
197
287
|
for (const call of found) {
|
|
198
|
-
if (known(tree, call.native, call.path))
|
|
288
|
+
if (known(tree, call.native, call.path)) {
|
|
289
|
+
const types = call.controlType ? mismatchedTypes(call.controlType, framesAt(tree, call.native, call.path)) : undefined;
|
|
290
|
+
if (types) {
|
|
291
|
+
const mismatch = `${id(call.native, call.path)}\n${call.controlType}`;
|
|
292
|
+
const first = mismatches.get(mismatch);
|
|
293
|
+
mismatches.set(mismatch, first ? { ...first, places: first.places + 1 } : { ...call, places: 1, types });
|
|
294
|
+
}
|
|
199
295
|
continue;
|
|
296
|
+
}
|
|
200
297
|
const first = warnings.get(id(call.native, call.path));
|
|
201
298
|
warnings.set(id(call.native, call.path), first ? { ...first, places: first.places + 1 } : { ...call, places: 1 });
|
|
202
299
|
}
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
const message = `"${warning.path}", passed to ${warning.native}${elsewhere}, is ${WHAT[FRAME_PATH_NATIVES[warning.native].reading]} that neither the layouts the mod loads nor the game's define, so the call is likely to find nothing. Add the frame to a layout the mod's DescIndex includes, or fix the path; a path that comes from a dependency the check doesn't read is fine`;
|
|
206
|
-
return {
|
|
300
|
+
const elsewhere = (places) => (places > 1 ? ` (and ${places - 1} other place${places > 2 ? "s" : ""})` : "");
|
|
301
|
+
const missing = [...warnings.values()].map((warning) => {
|
|
302
|
+
const message = `"${warning.path}", passed to ${warning.native}${elsewhere(warning.places)}, is ${WHAT[FRAME_PATH_NATIVES[warning.native].reading]} that neither the layouts the mod loads nor the game's define, so the call is likely to find nothing. Add the frame to a layout the mod's DescIndex includes, or fix the path; a path that comes from a dependency the check doesn't read is fine`;
|
|
303
|
+
return { kind: "missing", native: warning.native, path: warning.path, file: warning.file, where: warning.where, places: warning.places, message };
|
|
304
|
+
});
|
|
305
|
+
const controlType = [...mismatches.values()].map((warning) => {
|
|
306
|
+
const types = warning.types.map((type) => BASIC_CONTROLS.get(type));
|
|
307
|
+
const use = types.length === 1 ? ` Pass c_triggerControlType${types[0]} for it, or change the frame's type.` : "";
|
|
308
|
+
const message = `"${warning.path}", passed to ${warning.native}${elsewhere(warning.places)} as ${warning.controlType}, is a frame of type ${types.join(" or ")} in the layouts the mod loads, so the hookup is likely to find nothing or the wrong control.${use}`;
|
|
309
|
+
return { kind: "controlType", native: warning.native, path: warning.path, controlType: warning.controlType, file: warning.file, where: warning.where, places: warning.places, message };
|
|
207
310
|
});
|
|
311
|
+
return [...missing, ...controlType, ...outOfOrder];
|
|
312
|
+
}
|
|
313
|
+
/** Just the paths no layout has, of `modFrameWarnings`. */
|
|
314
|
+
export async function modFramePathWarnings(modPackage, generated = {}, snapshot) {
|
|
315
|
+
return (await modFrameWarnings(modPackage, generated, snapshot)).filter((warning) => warning.kind === "missing");
|
|
208
316
|
}
|
package/dist/ui/frame-paths.d.ts
CHANGED
|
@@ -8,32 +8,41 @@ export type FramePathReading = "relative" | "gameUI" | "template";
|
|
|
8
8
|
export declare const FRAME_PATH_NATIVES: {
|
|
9
9
|
readonly DialogControlHookup: {
|
|
10
10
|
readonly argument: 2;
|
|
11
|
+
readonly typeArgument: 1;
|
|
11
12
|
readonly paramDef: "2147B27F";
|
|
12
13
|
readonly reading: "relative";
|
|
13
14
|
};
|
|
14
15
|
readonly DialogControlHookupStandard: {
|
|
15
16
|
readonly argument: 1;
|
|
17
|
+
readonly typeArgument: 0;
|
|
16
18
|
readonly paramDef: "AEF92396";
|
|
17
19
|
readonly reading: "gameUI";
|
|
18
20
|
};
|
|
19
21
|
readonly DialogControlCreateFromTemplate: {
|
|
20
22
|
readonly argument: 2;
|
|
23
|
+
readonly typeArgument: 1;
|
|
21
24
|
readonly paramDef: "B68F0E3F";
|
|
22
25
|
readonly reading: "template";
|
|
23
26
|
};
|
|
24
27
|
readonly DialogControlCreateInPanelFromTemplate: {
|
|
25
28
|
readonly argument: 2;
|
|
29
|
+
readonly typeArgument: 1;
|
|
26
30
|
readonly paramDef: "3CC77352";
|
|
27
31
|
readonly reading: "template";
|
|
28
32
|
};
|
|
29
33
|
};
|
|
30
34
|
export type FramePathNative = keyof typeof FRAME_PATH_NATIVES;
|
|
31
|
-
/**
|
|
35
|
+
/**
|
|
36
|
+
* A literal frame path passed to one of the natives, the line the call starts on, the function
|
|
37
|
+
* it's in (none at the top level) and the control-type constant it's given, when it's one name
|
|
38
|
+
* (`c_triggerControlTypeImage`) rather than an expression.
|
|
39
|
+
*/
|
|
32
40
|
export type FramePathCall = {
|
|
33
41
|
readonly native: FramePathNative;
|
|
34
42
|
readonly path: string;
|
|
35
43
|
readonly line: number;
|
|
36
44
|
readonly function?: string;
|
|
45
|
+
readonly controlType?: string;
|
|
37
46
|
};
|
|
38
47
|
/** The literal frame path a Galaxy expression is (`"X/Y"`, or one through ConvertStringToUILayoutFrameName), `\` read as `/`. */
|
|
39
48
|
export declare function literalFramePath(expression: string): string | undefined;
|
|
@@ -77,6 +86,17 @@ export declare class FrameTree {
|
|
|
77
86
|
has(path: string): boolean;
|
|
78
87
|
/** Whether some frame's path ends in `path`, as a path relative to a frame not known here must. */
|
|
79
88
|
endsWith(path: string): boolean;
|
|
89
|
+
/**
|
|
90
|
+
* The frames at `path` (its file's name first), each with its `type`s as layouts gave them: a
|
|
91
|
+
* frame none gave a type, a snapshot's among them, has none listed.
|
|
92
|
+
*/
|
|
93
|
+
find(path: string): {
|
|
94
|
+
readonly types: readonly string[];
|
|
95
|
+
}[];
|
|
96
|
+
/** The frames some frame's path ends in `path`, as `endsWith` reads it, with their types as `find` gives them. */
|
|
97
|
+
findEndingWith(path: string): {
|
|
98
|
+
readonly types: readonly string[];
|
|
99
|
+
}[];
|
|
80
100
|
/** The tree's own frames (not its base's) as the snapshot stores them, names and templates in a stable order. */
|
|
81
101
|
toSnapshot(): FrameSnapshotTree;
|
|
82
102
|
}
|
package/dist/ui/frame-paths.js
CHANGED
|
@@ -21,12 +21,14 @@ import { xmlAttribute, xmlTree } from "../util/xml.js";
|
|
|
21
21
|
* under, and how the native reads it.
|
|
22
22
|
*/
|
|
23
23
|
export const FRAME_PATH_NATIVES = {
|
|
24
|
-
DialogControlHookup: { argument: 2, paramDef: "2147B27F", reading: "relative" },
|
|
25
|
-
DialogControlHookupStandard: { argument: 1, paramDef: "AEF92396", reading: "gameUI" },
|
|
26
|
-
DialogControlCreateFromTemplate: { argument: 2, paramDef: "B68F0E3F", reading: "template" },
|
|
27
|
-
DialogControlCreateInPanelFromTemplate: { argument: 2, paramDef: "3CC77352", reading: "template" },
|
|
24
|
+
DialogControlHookup: { argument: 2, typeArgument: 1, paramDef: "2147B27F", reading: "relative" },
|
|
25
|
+
DialogControlHookupStandard: { argument: 1, typeArgument: 0, paramDef: "AEF92396", reading: "gameUI" },
|
|
26
|
+
DialogControlCreateFromTemplate: { argument: 2, typeArgument: 1, paramDef: "B68F0E3F", reading: "template" },
|
|
27
|
+
DialogControlCreateInPanelFromTemplate: { argument: 2, typeArgument: 1, paramDef: "3CC77352", reading: "template" },
|
|
28
28
|
};
|
|
29
29
|
const NAME = /[A-Za-z_]\w*/y;
|
|
30
|
+
/** A control-type constant: c_triggerControlTypeImage. */
|
|
31
|
+
const CONTROL_TYPE = /^c_triggerControlType\w+$/;
|
|
30
32
|
/** `galaxy`'s names, strings (their values) and punctuation, without its comments. */
|
|
31
33
|
function galaxyTokens(galaxy) {
|
|
32
34
|
const tokens = [];
|
|
@@ -136,8 +138,10 @@ export function framePathCalls(galaxy) {
|
|
|
136
138
|
args.at(-1).push(next);
|
|
137
139
|
}
|
|
138
140
|
const path = literalOf(args[FRAME_PATH_NATIVES[native].argument] ?? []);
|
|
141
|
+
const typeArgument = args[FRAME_PATH_NATIVES[native].typeArgument] ?? [];
|
|
142
|
+
const controlType = typeArgument.length === 1 && typeArgument[0].kind === "name" && CONTROL_TYPE.test(typeArgument[0].text) ? typeArgument[0].text : undefined;
|
|
139
143
|
if (path !== undefined)
|
|
140
|
-
calls.push({ native, path: pathSegments(path).join("/"), line: token.line, ...(inFunction ? { function: inFunction } : {}) });
|
|
144
|
+
calls.push({ native, path: pathSegments(path).join("/"), line: token.line, ...(inFunction ? { function: inFunction } : {}), ...(controlType ? { controlType } : {}) });
|
|
141
145
|
});
|
|
142
146
|
return calls;
|
|
143
147
|
}
|
|
@@ -146,7 +150,7 @@ export const TEMPLATE_KEY = "@template";
|
|
|
146
150
|
const key = (name) => name.toLowerCase();
|
|
147
151
|
/** A path's names, `\` read as `/`. */
|
|
148
152
|
export const pathSegments = (path) => path.replace(/\\/g, "/").split("/").filter((segment) => segment !== "");
|
|
149
|
-
const newNode = (name) => ({ name, children: new Map(), templates: [] });
|
|
153
|
+
const newNode = (name) => ({ name, children: new Map(), templates: [], types: [] });
|
|
150
154
|
/**
|
|
151
155
|
* The frames of layout files, looked up by path. A tree made `over` another has that one's frames
|
|
152
156
|
* as well as its own, and adds layouts to its own alone, so one built tree of Blizzard's frames
|
|
@@ -211,6 +215,9 @@ export class FrameTree {
|
|
|
211
215
|
const template = xmlAttribute(frame, "template");
|
|
212
216
|
if (template && !node.templates.includes(template))
|
|
213
217
|
node.templates.push(template);
|
|
218
|
+
const type = xmlAttribute(frame, "type")?.toLowerCase();
|
|
219
|
+
if (type && !node.types.includes(type))
|
|
220
|
+
node.types.push(type);
|
|
214
221
|
for (const child of frame.children) {
|
|
215
222
|
const name = child.name === "Frame" ? xmlAttribute(child, "name") : undefined;
|
|
216
223
|
if (!name)
|
|
@@ -309,6 +316,19 @@ export class FrameTree {
|
|
|
309
316
|
return false;
|
|
310
317
|
return this.#walk(this.#named(key(first)), rest).length > 0;
|
|
311
318
|
}
|
|
319
|
+
/**
|
|
320
|
+
* The frames at `path` (its file's name first), each with its `type`s as layouts gave them: a
|
|
321
|
+
* frame none gave a type, a snapshot's among them, has none listed.
|
|
322
|
+
*/
|
|
323
|
+
find(path) {
|
|
324
|
+
const names = pathSegments(path);
|
|
325
|
+
return names.length >= 2 ? this.#walk(this.#roots, names) : [];
|
|
326
|
+
}
|
|
327
|
+
/** The frames some frame's path ends in `path`, as `endsWith` reads it, with their types as `find` gives them. */
|
|
328
|
+
findEndingWith(path) {
|
|
329
|
+
const [first, ...rest] = pathSegments(path);
|
|
330
|
+
return first === undefined ? [] : this.#walk(this.#named(key(first)), rest);
|
|
331
|
+
}
|
|
312
332
|
/** The tree's own frames (not its base's) as the snapshot stores them, names and templates in a stable order. */
|
|
313
333
|
toSnapshot() {
|
|
314
334
|
const write = (node) => {
|
package/dist/ui/toast.d.ts
CHANGED
|
@@ -2,11 +2,10 @@
|
|
|
2
2
|
export declare function titleWidth(title: string): number;
|
|
3
3
|
/**
|
|
4
4
|
* The longest title and text a Blueprint action takes, seen in game at the default styles in the
|
|
5
|
-
* 302 px labels
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
* m's fitted in three shrunk lines, so it's counted. A GUI call isn't checked.
|
|
5
|
+
* 302 px labels (the findings are in the docs, "What the toast taught"). The title shrinks to fit
|
|
6
|
+
* only so far, so it's measured by its letters' widths, not counted: titleWidth weighs each letter
|
|
7
|
+
* against an ordinary one, a W about 1.8. The text wraps and shrinks, so it's counted. A GUI call
|
|
8
|
+
* isn't checked.
|
|
10
9
|
*/
|
|
11
10
|
export declare const TOAST_TITLE_WIDTH = 26.5;
|
|
12
11
|
export declare const TOAST_TEXT_MAX = 60;
|
package/dist/ui/toast.js
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
// ToastNotificationPanelTemplate): a nine-sliced background and a slide-in animation on the panel's
|
|
8
8
|
// Right anchor. The fades are the script's (DialogControlFadeTransparency), not the layout's: in
|
|
9
9
|
// game (2026-11-10), a Fade animation left paused at its end kept every later toast see-through, so
|
|
10
|
-
// they only flickered. The panel sits in ConsoleUIContainer, as the boss bar does, so it goes with the console in cinematic
|
|
10
|
+
// they only flickered (docs/reference/editor-and-engine.md, "What the toast taught"). The panel sits in ConsoleUIContainer, as the boss bar does, so it goes with the console in cinematic
|
|
11
11
|
// mode.
|
|
12
12
|
//
|
|
13
13
|
// Show Toast joins a queue in the toast's script, which plays one toast at a time. Before each, it
|
|
@@ -37,10 +37,7 @@ const PAD = 10;
|
|
|
37
37
|
/** The labels: the title's top and both labels' right edge sit this much further in than the icon. */
|
|
38
38
|
const LABEL_INSET = 4;
|
|
39
39
|
const TITLE_HEIGHT = 28;
|
|
40
|
-
/**
|
|
41
|
-
* Two full lines of the text's style. In game (2026-11-10), at 44 px the label didn't wrap: it kept
|
|
42
|
-
* to one line and cut it off, most likely because a second line didn't fit its height (unconfirmed).
|
|
43
|
-
*/
|
|
40
|
+
/** Two full lines of the text's style: a shorter label didn't wrap in game ("What the toast taught" in docs/reference/editor-and-engine.md). */
|
|
44
41
|
const TEXT_HEIGHT = 56;
|
|
45
42
|
/**
|
|
46
43
|
* The labels shrink their text rather than cut it off, as the info panel's unit names do
|
|
@@ -74,11 +71,10 @@ const TEXT_OPTIONS = "ScaleToPreventTruncation";
|
|
|
74
71
|
const LINE_GAP = 2;
|
|
75
72
|
/**
|
|
76
73
|
* The longest title and text a Blueprint action takes, seen in game at the default styles in the
|
|
77
|
-
* 302 px labels
|
|
78
|
-
*
|
|
79
|
-
*
|
|
80
|
-
*
|
|
81
|
-
* m's fitted in three shrunk lines, so it's counted. A GUI call isn't checked.
|
|
74
|
+
* 302 px labels (the findings are in the docs, "What the toast taught"). The title shrinks to fit
|
|
75
|
+
* only so far, so it's measured by its letters' widths, not counted: titleWidth weighs each letter
|
|
76
|
+
* against an ordinary one, a W about 1.8. The text wraps and shrinks, so it's counted. A GUI call
|
|
77
|
+
* isn't checked.
|
|
82
78
|
*/
|
|
83
79
|
export const TOAST_TITLE_WIDTH = 26.5;
|
|
84
80
|
export const TOAST_TEXT_MAX = 60;
|
|
@@ -25,6 +25,7 @@ example-campaign/
|
|
|
25
25
|
└── missions/ashfall-relay/
|
|
26
26
|
├── blueprint.json # zones, a Marine, the magma hazard, an objective, scene cues
|
|
27
27
|
├── ashfall-relay.md # the Screenplay, in core's format (docs/screenplay-format.md)
|
|
28
|
+
├── triggers/ # the Mission's own triggers, one file each, written by write_blueprint_trigger
|
|
28
29
|
└── audio/ # one voice file per line, named by its sound id
|
|
29
30
|
```
|
|
30
31
|
|
|
@@ -40,6 +41,32 @@ The Campaign Pack's naming template names the conversation `Ch1_ashfall_relay`,
|
|
|
40
41
|
|
|
41
42
|
The files in `audio/` are silent placeholders, so the Mission compiles anywhere. On a Mac, `npm run tts -- missions/ashfall-relay/blueprint.json` replaces them with spoken placeholder lines in each character's `say` voice. Run it in your own Workspace, not on the example in the sc2-adjutant repo: it overwrites the committed voice files. It also writes `audio/manifest.json`, which the `.gitignore` keeps out of commits.
|
|
42
43
|
|
|
44
|
+
## A trigger of its own
|
|
45
|
+
|
|
46
|
+
No Blueprint concept shakes the camera, and core's trigger catalog has no primitive for it, so the Mission has two triggers of its own (ADR-0026 in sc2-adjutant). From the Crossing Beat on, the ground trembles every 11 seconds. A session wrote them with the MCP tools below, and you can do the same for any of the game's functions.
|
|
47
|
+
|
|
48
|
+
1. **Find the function.** `search_trigger_functions` with `{ "mission": "ashfall-relay", "text": "shake", "kind": "action" }` finds *Shake Camera*, *Shake Camera Using Preset* and *Stop Shaking Camera*, each with its parameters as the Editor shows them. *Shake Camera Using Preset* takes an amplitude and a frequency by preset name.
|
|
49
|
+
2. **Write the periodic trigger.** `write_blueprint_trigger` takes the trigger in the Editor's terms. Functions and parameters go by name, and a parameter you leave out gets the default the Editor gives a new call (here, no blend in or out):
|
|
50
|
+
|
|
51
|
+
```json
|
|
52
|
+
{ "mission": "ashfall-relay", "trigger": {
|
|
53
|
+
"name": "Ash Tremors", "initiallyOff": true,
|
|
54
|
+
"events": [{ "function": "Periodic Event", "params": { "Duration": 11 } }],
|
|
55
|
+
"actions": [{ "function": "Shake Camera Using Preset", "params": { "Player": 1, "Amplitude": "Medium", "Frequency": "Tremor", "Duration": 2 } }] } }
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
A wrong name is refused in the Editor's terms, with what would fit. Given `"Amplitude": "Strong"`, it lists `"Massive", "Heavy", "Medium", "Light"`. The tool writes `triggers/ash-tremors.json`, adds it to the Blueprint's `triggers`, and gives the trigger an element Id (`D4B9718B`).
|
|
59
|
+
3. **Write what turns it on.** A Beat can hold back only a trigger that starts on Map Initialization, and a periodic trigger doesn't. So a second trigger, *Start Ash Tremors*, turns the first one on at Map Initialization: `Turn Trigger On/Off` with `"Trigger": { "trigger": "Ash Tremors" }` and `"State": "On"`.
|
|
60
|
+
4. **Cue it from the Beat.** The Blueprint's `kept` names *Start Ash Tremors* by its element Id and holds it until the Crossing Beat starts:
|
|
61
|
+
|
|
62
|
+
```json
|
|
63
|
+
"kept": [{ "id": "start-ash-tremors", "kind": "trigger", "editorId": "15E66F7A", "name": "Start Ash Tremors",
|
|
64
|
+
"hold": { "until": { "type": "beatStarts", "beatId": "crossing" } } }]
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
The compile switches off its Map Initialization event, and *Beat - Crossing* runs it.
|
|
68
|
+
5. **Read it back and compile.** `outline_trigger` with `{ "mission": "ashfall-relay", "trigger": "Ash Tremors" }` reads the trigger back in the form `write_blueprint_trigger` takes. Edit that and rewrite it to change the trigger. Calls you leave alone keep their Ids. `compile_map` then writes both triggers into the Map Package's `Triggers` and `MapScript.galaxy`, where the Editor shows them in the Trigger module like any other.
|
|
69
|
+
|
|
43
70
|
## Try it
|
|
44
71
|
|
|
45
72
|
In a Workspace made by `init`, open Claude Code in its folder and run `/sc2-adjutant:co-design ashfall-relay`. Or, from the Workspace's folder:
|
|
@@ -114,5 +114,15 @@
|
|
|
114
114
|
{ "scene": 2, "cue": { "type": "anchorEntersZone", "anchorId": "sergeant", "zoneId": "relay" } }
|
|
115
115
|
]
|
|
116
116
|
}
|
|
117
|
-
}
|
|
117
|
+
},
|
|
118
|
+
"triggers": ["triggers/ash-tremors.json", "triggers/start-ash-tremors.json"],
|
|
119
|
+
"kept": [
|
|
120
|
+
{
|
|
121
|
+
"id": "start-ash-tremors",
|
|
122
|
+
"kind": "trigger",
|
|
123
|
+
"editorId": "15E66F7A",
|
|
124
|
+
"name": "Start Ash Tremors",
|
|
125
|
+
"hold": { "until": { "type": "beatStarts", "beatId": "crossing" } }
|
|
126
|
+
}
|
|
127
|
+
]
|
|
118
128
|
}
|