@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
|
@@ -15,7 +15,7 @@ export declare const BlueprintTriggerSchema: z.ZodObject<{
|
|
|
15
15
|
identifier: z.ZodOptional<z.ZodString>;
|
|
16
16
|
type: z.ZodObject<{
|
|
17
17
|
type: z.ZodString;
|
|
18
|
-
element: z.ZodOptional<z.
|
|
18
|
+
element: z.ZodOptional<z.ZodType<string, unknown, z.core.$ZodTypeInternals<string, unknown>>>;
|
|
19
19
|
gameType: z.ZodOptional<z.ZodString>;
|
|
20
20
|
assetType: z.ZodOptional<z.ZodString>;
|
|
21
21
|
userType: z.ZodOptional<z.ZodString>;
|
|
@@ -23,7 +23,7 @@ export declare const BlueprintTriggerSchema: z.ZodObject<{
|
|
|
23
23
|
array: z.ZodOptional<z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
|
|
24
24
|
size: z.ZodNumber;
|
|
25
25
|
}, z.core.$strict>, z.ZodObject<{
|
|
26
|
-
variable: z.
|
|
26
|
+
variable: z.ZodType<string, unknown, z.core.$ZodTypeInternals<string, unknown>>;
|
|
27
27
|
}, z.core.$strict>]>>>;
|
|
28
28
|
}, z.core.$strict>;
|
|
29
29
|
value: z.ZodOptional<z.ZodType<{
|
|
@@ -38,7 +38,359 @@ export declare const BlueprintTriggerSchema: z.ZodObject<{
|
|
|
38
38
|
strings: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodRecord<z.ZodString, z.ZodString>>>;
|
|
39
39
|
}, z.core.$strict>;
|
|
40
40
|
export type BlueprintTrigger = z.infer<typeof BlueprintTriggerSchema>;
|
|
41
|
-
/**
|
|
41
|
+
/**
|
|
42
|
+
* A map function (`<Element Type="FunctionDef">`), as the Editor saves it: its interface as a
|
|
43
|
+
* library function's (LibraryFunctionSchema: its kind, flags, return type, parameters and block
|
|
44
|
+
* slots), its own variables and actions, and its text values' words. Its Galaxy is gf_ and its
|
|
45
|
+
* identifier, else its name's.
|
|
46
|
+
*/
|
|
47
|
+
export declare const BlueprintFunctionSchema: z.ZodObject<{
|
|
48
|
+
kind: z.ZodLiteral<"function">;
|
|
49
|
+
id: z.ZodString;
|
|
50
|
+
name: z.ZodString;
|
|
51
|
+
identifier: z.ZodOptional<z.ZodString>;
|
|
52
|
+
functionKind: z.ZodEnum<{
|
|
53
|
+
function: "function";
|
|
54
|
+
action: "action";
|
|
55
|
+
condition: "condition";
|
|
56
|
+
event: "event";
|
|
57
|
+
}>;
|
|
58
|
+
flags: z.ZodDefault<z.ZodArray<z.ZodEnum<{
|
|
59
|
+
inline: "inline";
|
|
60
|
+
native: "native";
|
|
61
|
+
createThread: "createThread";
|
|
62
|
+
hidden: "hidden";
|
|
63
|
+
noScriptPrefix: "noScriptPrefix";
|
|
64
|
+
subFunctions: "subFunctions";
|
|
65
|
+
allowBreak: "allowBreak";
|
|
66
|
+
operator: "operator";
|
|
67
|
+
restricted: "restricted";
|
|
68
|
+
}>>>;
|
|
69
|
+
grammar: z.ZodOptional<z.ZodString>;
|
|
70
|
+
hint: z.ZodOptional<z.ZodString>;
|
|
71
|
+
label: z.ZodOptional<z.ZodString>;
|
|
72
|
+
section: z.ZodOptional<z.ZodString>;
|
|
73
|
+
disabled: z.ZodOptional<z.ZodBoolean>;
|
|
74
|
+
deprecated: z.ZodOptional<z.ZodBoolean>;
|
|
75
|
+
internal: z.ZodOptional<z.ZodBoolean>;
|
|
76
|
+
returns: z.ZodOptional<z.ZodObject<{
|
|
77
|
+
type: z.ZodString;
|
|
78
|
+
element: z.ZodOptional<z.ZodType<string, unknown, z.core.$ZodTypeInternals<string, unknown>>>;
|
|
79
|
+
gameType: z.ZodOptional<z.ZodString>;
|
|
80
|
+
assetType: z.ZodOptional<z.ZodString>;
|
|
81
|
+
userType: z.ZodOptional<z.ZodString>;
|
|
82
|
+
}, z.core.$strict>>;
|
|
83
|
+
parameters: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
84
|
+
id: z.ZodString;
|
|
85
|
+
name: z.ZodString;
|
|
86
|
+
identifier: z.ZodOptional<z.ZodString>;
|
|
87
|
+
type: z.ZodObject<{
|
|
88
|
+
type: z.ZodString;
|
|
89
|
+
element: z.ZodOptional<z.ZodType<string, unknown, z.core.$ZodTypeInternals<string, unknown>>>;
|
|
90
|
+
gameType: z.ZodOptional<z.ZodString>;
|
|
91
|
+
assetType: z.ZodOptional<z.ZodString>;
|
|
92
|
+
userType: z.ZodOptional<z.ZodString>;
|
|
93
|
+
}, z.core.$strict>;
|
|
94
|
+
default: z.ZodOptional<z.ZodType<{
|
|
95
|
+
readonly id: string;
|
|
96
|
+
} & import("./library-interface.js").GuiValue, unknown, z.core.$ZodTypeInternals<{
|
|
97
|
+
readonly id: string;
|
|
98
|
+
} & import("./library-interface.js").GuiValue, unknown>>>;
|
|
99
|
+
preset: z.ZodOptional<z.ZodUnion<readonly [z.ZodUnion<readonly [z.ZodString, z.ZodString]>, z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodString]>>]>>;
|
|
100
|
+
preload: z.ZodOptional<z.ZodBoolean>;
|
|
101
|
+
limits: z.ZodOptional<z.ZodString>;
|
|
102
|
+
}, z.core.$strict>>>;
|
|
103
|
+
subFunctions: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
104
|
+
id: z.ZodString;
|
|
105
|
+
name: z.ZodString;
|
|
106
|
+
identifier: z.ZodOptional<z.ZodString>;
|
|
107
|
+
holds: z.ZodOptional<z.ZodEnum<{
|
|
108
|
+
action: "action";
|
|
109
|
+
condition: "condition";
|
|
110
|
+
}>>;
|
|
111
|
+
}, z.core.$strict>>>;
|
|
112
|
+
variables: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
113
|
+
id: z.ZodString;
|
|
114
|
+
name: z.ZodString;
|
|
115
|
+
identifier: z.ZodOptional<z.ZodString>;
|
|
116
|
+
type: z.ZodObject<{
|
|
117
|
+
type: z.ZodString;
|
|
118
|
+
element: z.ZodOptional<z.ZodType<string, unknown, z.core.$ZodTypeInternals<string, unknown>>>;
|
|
119
|
+
gameType: z.ZodOptional<z.ZodString>;
|
|
120
|
+
assetType: z.ZodOptional<z.ZodString>;
|
|
121
|
+
userType: z.ZodOptional<z.ZodString>;
|
|
122
|
+
constant: z.ZodOptional<z.ZodBoolean>;
|
|
123
|
+
array: z.ZodOptional<z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
|
|
124
|
+
size: z.ZodNumber;
|
|
125
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
126
|
+
variable: z.ZodType<string, unknown, z.core.$ZodTypeInternals<string, unknown>>;
|
|
127
|
+
}, z.core.$strict>]>>>;
|
|
128
|
+
}, z.core.$strict>;
|
|
129
|
+
value: z.ZodOptional<z.ZodType<{
|
|
130
|
+
readonly id: string;
|
|
131
|
+
} & import("./library-interface.js").GuiValue, unknown, z.core.$ZodTypeInternals<{
|
|
132
|
+
readonly id: string;
|
|
133
|
+
} & import("./library-interface.js").GuiValue, unknown>>>;
|
|
134
|
+
}, z.core.$strict>>>;
|
|
135
|
+
actions: z.ZodDefault<z.ZodArray<z.ZodType<import("./library-interface.js").GuiStatement, unknown, z.core.$ZodTypeInternals<import("./library-interface.js").GuiStatement, unknown>>>>;
|
|
136
|
+
strings: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodRecord<z.ZodString, z.ZodString>>>;
|
|
137
|
+
}, z.core.$strict>;
|
|
138
|
+
export type BlueprintFunction = z.infer<typeof BlueprintFunctionSchema>;
|
|
139
|
+
/** A comment filed among the map's items, in Root or a folder (`<Element Type="Comment">`): its text, empty for a blank one. It has no Galaxy. */
|
|
140
|
+
export declare const BlueprintCommentSchema: z.ZodObject<{
|
|
141
|
+
kind: z.ZodLiteral<"comment">;
|
|
142
|
+
id: z.ZodString;
|
|
143
|
+
comment: z.ZodString;
|
|
144
|
+
}, z.core.$strict>;
|
|
145
|
+
export type BlueprintComment = z.infer<typeof BlueprintCommentSchema>;
|
|
146
|
+
/**
|
|
147
|
+
* A preset type of the map's own (`<Element Type="Preset">`), as a library's is (LibraryPresetSchema):
|
|
148
|
+
* its name, base type and values, in order, a comment the Editor files among them in its place. Its
|
|
149
|
+
* Galaxy is a constant for each value (ge_<preset>_<value>) in Global Preset Declarations, numbered
|
|
150
|
+
* from 0 in order: the form every Editor save of a map's preset type has (`<PresetInteger/>`, an int
|
|
151
|
+
* base type, values with no value of their own). Any other form isn't written yet.
|
|
152
|
+
*/
|
|
153
|
+
export declare const BlueprintPresetSchema: z.ZodObject<{
|
|
154
|
+
kind: z.ZodLiteral<"preset">;
|
|
155
|
+
id: z.ZodString;
|
|
156
|
+
name: z.ZodString;
|
|
157
|
+
baseType: z.ZodString;
|
|
158
|
+
integer: z.ZodOptional<z.ZodBoolean>;
|
|
159
|
+
constants: z.ZodOptional<z.ZodBoolean>;
|
|
160
|
+
values: z.ZodDefault<z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
|
|
161
|
+
id: z.ZodString;
|
|
162
|
+
name: z.ZodString;
|
|
163
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
164
|
+
id: z.ZodString;
|
|
165
|
+
comment: z.ZodString;
|
|
166
|
+
}, z.core.$strict>]>>>;
|
|
167
|
+
}, z.core.$strict>;
|
|
168
|
+
export type BlueprintPreset = z.infer<typeof BlueprintPresetSchema>;
|
|
169
|
+
/** A record of the map's own (an Editor Structure, `<Element Type="Structure">`), as a library's structure is (LibraryStructureSchema): its members, each a variable with its type and initial value. Its Galaxy is a struct (gs_<identifier>) in Global Structures. */
|
|
170
|
+
export declare const BlueprintRecordSchema: z.ZodObject<{
|
|
171
|
+
id: z.ZodString;
|
|
172
|
+
kind: z.ZodLiteral<"record">;
|
|
173
|
+
name: z.ZodString;
|
|
174
|
+
members: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
175
|
+
id: z.ZodString;
|
|
176
|
+
name: z.ZodString;
|
|
177
|
+
identifier: z.ZodOptional<z.ZodString>;
|
|
178
|
+
type: z.ZodObject<{
|
|
179
|
+
type: z.ZodString;
|
|
180
|
+
element: z.ZodOptional<z.ZodType<string, unknown, z.core.$ZodTypeInternals<string, unknown>>>;
|
|
181
|
+
gameType: z.ZodOptional<z.ZodString>;
|
|
182
|
+
assetType: z.ZodOptional<z.ZodString>;
|
|
183
|
+
userType: z.ZodOptional<z.ZodString>;
|
|
184
|
+
constant: z.ZodOptional<z.ZodBoolean>;
|
|
185
|
+
array: z.ZodOptional<z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
|
|
186
|
+
size: z.ZodNumber;
|
|
187
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
188
|
+
variable: z.ZodType<string, unknown, z.core.$ZodTypeInternals<string, unknown>>;
|
|
189
|
+
}, z.core.$strict>]>>>;
|
|
190
|
+
}, z.core.$strict>;
|
|
191
|
+
value: z.ZodOptional<z.ZodType<{
|
|
192
|
+
readonly id: string;
|
|
193
|
+
} & import("./library-interface.js").GuiValue, unknown, z.core.$ZodTypeInternals<{
|
|
194
|
+
readonly id: string;
|
|
195
|
+
} & import("./library-interface.js").GuiValue, unknown>>>;
|
|
196
|
+
}, z.core.$strict>>>;
|
|
197
|
+
}, z.core.$strict>;
|
|
198
|
+
export type BlueprintRecord = z.infer<typeof BlueprintRecordSchema>;
|
|
199
|
+
/**
|
|
200
|
+
* Custom script filed among the map's items (`<Element Type="CustomScript">`), as a library's is
|
|
201
|
+
* (LibraryCustomScriptSchema): Galaxy the Editor writes into MapScript.galaxy's Custom Script section
|
|
202
|
+
* as it stands, under its name, and the function InitCustomScript calls at map initialization. A
|
|
203
|
+
* converted one keeps its script as data (ADR-0026).
|
|
204
|
+
*/
|
|
205
|
+
export declare const BlueprintCustomScriptSchema: z.ZodObject<{
|
|
206
|
+
script: z.ZodString;
|
|
207
|
+
id: z.ZodString;
|
|
208
|
+
kind: z.ZodLiteral<"custom-script">;
|
|
209
|
+
name: z.ZodString;
|
|
210
|
+
initFunction: z.ZodOptional<z.ZodString>;
|
|
211
|
+
}, z.core.$strict>;
|
|
212
|
+
export type BlueprintCustomScript = z.infer<typeof BlueprintCustomScriptSchema>;
|
|
213
|
+
/** Any element a Mission Blueprint's trigger element file holds, by its kind. */
|
|
214
|
+
export declare const BlueprintElementSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
215
|
+
kind: z.ZodLiteral<"trigger">;
|
|
216
|
+
id: z.ZodString;
|
|
217
|
+
name: z.ZodString;
|
|
218
|
+
identifier: z.ZodOptional<z.ZodString>;
|
|
219
|
+
label: z.ZodOptional<z.ZodString>;
|
|
220
|
+
section: z.ZodOptional<z.ZodString>;
|
|
221
|
+
disabled: z.ZodOptional<z.ZodBoolean>;
|
|
222
|
+
initiallyOff: z.ZodOptional<z.ZodBoolean>;
|
|
223
|
+
variables: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
224
|
+
id: z.ZodString;
|
|
225
|
+
name: z.ZodString;
|
|
226
|
+
identifier: z.ZodOptional<z.ZodString>;
|
|
227
|
+
type: z.ZodObject<{
|
|
228
|
+
type: z.ZodString;
|
|
229
|
+
element: z.ZodOptional<z.ZodType<string, unknown, z.core.$ZodTypeInternals<string, unknown>>>;
|
|
230
|
+
gameType: z.ZodOptional<z.ZodString>;
|
|
231
|
+
assetType: z.ZodOptional<z.ZodString>;
|
|
232
|
+
userType: z.ZodOptional<z.ZodString>;
|
|
233
|
+
constant: z.ZodOptional<z.ZodBoolean>;
|
|
234
|
+
array: z.ZodOptional<z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
|
|
235
|
+
size: z.ZodNumber;
|
|
236
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
237
|
+
variable: z.ZodType<string, unknown, z.core.$ZodTypeInternals<string, unknown>>;
|
|
238
|
+
}, z.core.$strict>]>>>;
|
|
239
|
+
}, z.core.$strict>;
|
|
240
|
+
value: z.ZodOptional<z.ZodType<{
|
|
241
|
+
readonly id: string;
|
|
242
|
+
} & import("./library-interface.js").GuiValue, unknown, z.core.$ZodTypeInternals<{
|
|
243
|
+
readonly id: string;
|
|
244
|
+
} & import("./library-interface.js").GuiValue, unknown>>>;
|
|
245
|
+
}, z.core.$strict>>>;
|
|
246
|
+
events: z.ZodDefault<z.ZodArray<z.ZodType<import("./library-interface.js").GuiStatement, unknown, z.core.$ZodTypeInternals<import("./library-interface.js").GuiStatement, unknown>>>>;
|
|
247
|
+
conditions: z.ZodDefault<z.ZodArray<z.ZodType<import("./library-interface.js").GuiStatement, unknown, z.core.$ZodTypeInternals<import("./library-interface.js").GuiStatement, unknown>>>>;
|
|
248
|
+
actions: z.ZodDefault<z.ZodArray<z.ZodType<import("./library-interface.js").GuiStatement, unknown, z.core.$ZodTypeInternals<import("./library-interface.js").GuiStatement, unknown>>>>;
|
|
249
|
+
strings: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodRecord<z.ZodString, z.ZodString>>>;
|
|
250
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
251
|
+
kind: z.ZodLiteral<"function">;
|
|
252
|
+
id: z.ZodString;
|
|
253
|
+
name: z.ZodString;
|
|
254
|
+
identifier: z.ZodOptional<z.ZodString>;
|
|
255
|
+
functionKind: z.ZodEnum<{
|
|
256
|
+
function: "function";
|
|
257
|
+
action: "action";
|
|
258
|
+
condition: "condition";
|
|
259
|
+
event: "event";
|
|
260
|
+
}>;
|
|
261
|
+
flags: z.ZodDefault<z.ZodArray<z.ZodEnum<{
|
|
262
|
+
inline: "inline";
|
|
263
|
+
native: "native";
|
|
264
|
+
createThread: "createThread";
|
|
265
|
+
hidden: "hidden";
|
|
266
|
+
noScriptPrefix: "noScriptPrefix";
|
|
267
|
+
subFunctions: "subFunctions";
|
|
268
|
+
allowBreak: "allowBreak";
|
|
269
|
+
operator: "operator";
|
|
270
|
+
restricted: "restricted";
|
|
271
|
+
}>>>;
|
|
272
|
+
grammar: z.ZodOptional<z.ZodString>;
|
|
273
|
+
hint: z.ZodOptional<z.ZodString>;
|
|
274
|
+
label: z.ZodOptional<z.ZodString>;
|
|
275
|
+
section: z.ZodOptional<z.ZodString>;
|
|
276
|
+
disabled: z.ZodOptional<z.ZodBoolean>;
|
|
277
|
+
deprecated: z.ZodOptional<z.ZodBoolean>;
|
|
278
|
+
internal: z.ZodOptional<z.ZodBoolean>;
|
|
279
|
+
returns: z.ZodOptional<z.ZodObject<{
|
|
280
|
+
type: z.ZodString;
|
|
281
|
+
element: z.ZodOptional<z.ZodType<string, unknown, z.core.$ZodTypeInternals<string, unknown>>>;
|
|
282
|
+
gameType: z.ZodOptional<z.ZodString>;
|
|
283
|
+
assetType: z.ZodOptional<z.ZodString>;
|
|
284
|
+
userType: z.ZodOptional<z.ZodString>;
|
|
285
|
+
}, z.core.$strict>>;
|
|
286
|
+
parameters: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
287
|
+
id: z.ZodString;
|
|
288
|
+
name: z.ZodString;
|
|
289
|
+
identifier: z.ZodOptional<z.ZodString>;
|
|
290
|
+
type: z.ZodObject<{
|
|
291
|
+
type: z.ZodString;
|
|
292
|
+
element: z.ZodOptional<z.ZodType<string, unknown, z.core.$ZodTypeInternals<string, unknown>>>;
|
|
293
|
+
gameType: z.ZodOptional<z.ZodString>;
|
|
294
|
+
assetType: z.ZodOptional<z.ZodString>;
|
|
295
|
+
userType: z.ZodOptional<z.ZodString>;
|
|
296
|
+
}, z.core.$strict>;
|
|
297
|
+
default: z.ZodOptional<z.ZodType<{
|
|
298
|
+
readonly id: string;
|
|
299
|
+
} & import("./library-interface.js").GuiValue, unknown, z.core.$ZodTypeInternals<{
|
|
300
|
+
readonly id: string;
|
|
301
|
+
} & import("./library-interface.js").GuiValue, unknown>>>;
|
|
302
|
+
preset: z.ZodOptional<z.ZodUnion<readonly [z.ZodUnion<readonly [z.ZodString, z.ZodString]>, z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodString]>>]>>;
|
|
303
|
+
preload: z.ZodOptional<z.ZodBoolean>;
|
|
304
|
+
limits: z.ZodOptional<z.ZodString>;
|
|
305
|
+
}, z.core.$strict>>>;
|
|
306
|
+
subFunctions: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
307
|
+
id: z.ZodString;
|
|
308
|
+
name: z.ZodString;
|
|
309
|
+
identifier: z.ZodOptional<z.ZodString>;
|
|
310
|
+
holds: z.ZodOptional<z.ZodEnum<{
|
|
311
|
+
action: "action";
|
|
312
|
+
condition: "condition";
|
|
313
|
+
}>>;
|
|
314
|
+
}, z.core.$strict>>>;
|
|
315
|
+
variables: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
316
|
+
id: z.ZodString;
|
|
317
|
+
name: z.ZodString;
|
|
318
|
+
identifier: z.ZodOptional<z.ZodString>;
|
|
319
|
+
type: z.ZodObject<{
|
|
320
|
+
type: z.ZodString;
|
|
321
|
+
element: z.ZodOptional<z.ZodType<string, unknown, z.core.$ZodTypeInternals<string, unknown>>>;
|
|
322
|
+
gameType: z.ZodOptional<z.ZodString>;
|
|
323
|
+
assetType: z.ZodOptional<z.ZodString>;
|
|
324
|
+
userType: z.ZodOptional<z.ZodString>;
|
|
325
|
+
constant: z.ZodOptional<z.ZodBoolean>;
|
|
326
|
+
array: z.ZodOptional<z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
|
|
327
|
+
size: z.ZodNumber;
|
|
328
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
329
|
+
variable: z.ZodType<string, unknown, z.core.$ZodTypeInternals<string, unknown>>;
|
|
330
|
+
}, z.core.$strict>]>>>;
|
|
331
|
+
}, z.core.$strict>;
|
|
332
|
+
value: z.ZodOptional<z.ZodType<{
|
|
333
|
+
readonly id: string;
|
|
334
|
+
} & import("./library-interface.js").GuiValue, unknown, z.core.$ZodTypeInternals<{
|
|
335
|
+
readonly id: string;
|
|
336
|
+
} & import("./library-interface.js").GuiValue, unknown>>>;
|
|
337
|
+
}, z.core.$strict>>>;
|
|
338
|
+
actions: z.ZodDefault<z.ZodArray<z.ZodType<import("./library-interface.js").GuiStatement, unknown, z.core.$ZodTypeInternals<import("./library-interface.js").GuiStatement, unknown>>>>;
|
|
339
|
+
strings: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodRecord<z.ZodString, z.ZodString>>>;
|
|
340
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
341
|
+
kind: z.ZodLiteral<"comment">;
|
|
342
|
+
id: z.ZodString;
|
|
343
|
+
comment: z.ZodString;
|
|
344
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
345
|
+
kind: z.ZodLiteral<"preset">;
|
|
346
|
+
id: z.ZodString;
|
|
347
|
+
name: z.ZodString;
|
|
348
|
+
baseType: z.ZodString;
|
|
349
|
+
integer: z.ZodOptional<z.ZodBoolean>;
|
|
350
|
+
constants: z.ZodOptional<z.ZodBoolean>;
|
|
351
|
+
values: z.ZodDefault<z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
|
|
352
|
+
id: z.ZodString;
|
|
353
|
+
name: z.ZodString;
|
|
354
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
355
|
+
id: z.ZodString;
|
|
356
|
+
comment: z.ZodString;
|
|
357
|
+
}, z.core.$strict>]>>>;
|
|
358
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
359
|
+
id: z.ZodString;
|
|
360
|
+
kind: z.ZodLiteral<"record">;
|
|
361
|
+
name: z.ZodString;
|
|
362
|
+
members: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
363
|
+
id: z.ZodString;
|
|
364
|
+
name: z.ZodString;
|
|
365
|
+
identifier: z.ZodOptional<z.ZodString>;
|
|
366
|
+
type: z.ZodObject<{
|
|
367
|
+
type: z.ZodString;
|
|
368
|
+
element: z.ZodOptional<z.ZodType<string, unknown, z.core.$ZodTypeInternals<string, unknown>>>;
|
|
369
|
+
gameType: z.ZodOptional<z.ZodString>;
|
|
370
|
+
assetType: z.ZodOptional<z.ZodString>;
|
|
371
|
+
userType: z.ZodOptional<z.ZodString>;
|
|
372
|
+
constant: z.ZodOptional<z.ZodBoolean>;
|
|
373
|
+
array: z.ZodOptional<z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
|
|
374
|
+
size: z.ZodNumber;
|
|
375
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
376
|
+
variable: z.ZodType<string, unknown, z.core.$ZodTypeInternals<string, unknown>>;
|
|
377
|
+
}, z.core.$strict>]>>>;
|
|
378
|
+
}, z.core.$strict>;
|
|
379
|
+
value: z.ZodOptional<z.ZodType<{
|
|
380
|
+
readonly id: string;
|
|
381
|
+
} & import("./library-interface.js").GuiValue, unknown, z.core.$ZodTypeInternals<{
|
|
382
|
+
readonly id: string;
|
|
383
|
+
} & import("./library-interface.js").GuiValue, unknown>>>;
|
|
384
|
+
}, z.core.$strict>>>;
|
|
385
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
386
|
+
script: z.ZodString;
|
|
387
|
+
id: z.ZodString;
|
|
388
|
+
kind: z.ZodLiteral<"custom-script">;
|
|
389
|
+
name: z.ZodString;
|
|
390
|
+
initFunction: z.ZodOptional<z.ZodString>;
|
|
391
|
+
}, z.core.$strict>], "kind">;
|
|
392
|
+
export type BlueprintElement = z.infer<typeof BlueprintElementSchema>;
|
|
393
|
+
/** An item a Blueprint Trigger Folder files: one of the Blueprint's elements, globals or other folders, or a Kept item, as `<kind>:<id>` (a record is `structure:`, the Editor's Structure). */
|
|
42
394
|
export declare const BlueprintFolderItem: z.ZodString;
|
|
43
395
|
/** A Trigger Folder (an Editor Category) of the Blueprint's own triggers: its name, its icon and what it files, in order. */
|
|
44
396
|
export declare const BlueprintTriggerFolderSchema: z.ZodObject<{
|
|
@@ -7,11 +7,22 @@
|
|
|
7
7
|
// variable, or another Blueprint element) is its Id alone, as the Editor writes it. Names sit
|
|
8
8
|
// beside the bodies, and a text value's words in `strings`, keyed by its Param
|
|
9
9
|
// (`Param/Value/<id>`), as a Mod Blueprint's do. Folders are the Blueprint's `triggerFolders`.
|
|
10
|
+
//
|
|
11
|
+
// A file holds one element, by its `kind`: a trigger, a comment, or a function, whose interface is a library
|
|
12
|
+
// function's (library-interface.ts) and whose body is its own variables and actions; or a preset
|
|
13
|
+
// type, a record or custom script, each as a library's is.
|
|
10
14
|
import { z } from "zod";
|
|
11
15
|
import { StringsSchema } from "./entry-strings.js";
|
|
12
|
-
import { ElementId, ElementRef, MAP_GUI } from "./library-interface.js";
|
|
16
|
+
import { ElementId, ElementRef, FUNCTION_FLAGS, FUNCTION_KINDS, LibraryCustomScriptSchema, LibraryPresetSchema, LibraryStructureSchema, MAP_GUI, MAP_TYPES, MapElementRef, SubFunctionSlotSchema } from "./library-interface.js";
|
|
13
17
|
/** A GameStrings file a Blueprint trigger's text values are in: `<locale>.SC2Data/LocalizedData/GameStrings.txt`. */
|
|
14
18
|
const GAME_STRINGS = /^[a-zA-Z]{4}\.SC2Data\/LocalizedData\/GameStrings\.txt$/;
|
|
19
|
+
/** Each file of an element's strings checked as a GameStrings file. */
|
|
20
|
+
function gameStringsFiles(strings, context) {
|
|
21
|
+
for (const file of Object.keys(strings ?? {})) {
|
|
22
|
+
if (!GAME_STRINGS.test(file))
|
|
23
|
+
context.addIssue({ code: "custom", path: ["strings", file], message: "An element's strings are its text values' words, in a GameStrings file (enUS.SC2Data/LocalizedData/GameStrings.txt)" });
|
|
24
|
+
}
|
|
25
|
+
}
|
|
15
26
|
/** A trigger element (`<Element Type="Trigger">`), as the Editor saves it. */
|
|
16
27
|
export const BlueprintTriggerSchema = z
|
|
17
28
|
.object({
|
|
@@ -36,14 +47,144 @@ export const BlueprintTriggerSchema = z
|
|
|
36
47
|
strings: StringsSchema.optional(),
|
|
37
48
|
})
|
|
38
49
|
.strict()
|
|
39
|
-
.superRefine((trigger, context) =>
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
50
|
+
.superRefine((trigger, context) => gameStringsFiles(trigger.strings, context));
|
|
51
|
+
/** A map function's parameter (`<Element Type="ParamDef">`), as a library function's is (LibraryParameterSchema), the map's own preset types by Id. */
|
|
52
|
+
const BlueprintParameterSchema = z
|
|
53
|
+
.object({
|
|
54
|
+
id: ElementId,
|
|
55
|
+
/** Its name, as the Editor shows it (ParamDef/Name/<id>). */
|
|
56
|
+
name: z.string(),
|
|
57
|
+
identifier: z.string().min(1).optional(),
|
|
58
|
+
type: MAP_TYPES.TypeSpecSchema,
|
|
59
|
+
default: MAP_GUI.HeldValueSchema.optional(),
|
|
60
|
+
/** The preset its values are limited to (`<Preset Type="Preset">`), or the presets, where there are several. */
|
|
61
|
+
preset: z.union([MapElementRef, z.array(MapElementRef).min(2)]).optional(),
|
|
62
|
+
/** ParamFlagPreload: what it names is preloaded. */
|
|
63
|
+
preload: z.boolean().optional(),
|
|
64
|
+
limits: z.string().optional(),
|
|
65
|
+
})
|
|
66
|
+
.strict();
|
|
67
|
+
/**
|
|
68
|
+
* A map function (`<Element Type="FunctionDef">`), as the Editor saves it: its interface as a
|
|
69
|
+
* library function's (LibraryFunctionSchema: its kind, flags, return type, parameters and block
|
|
70
|
+
* slots), its own variables and actions, and its text values' words. Its Galaxy is gf_ and its
|
|
71
|
+
* identifier, else its name's.
|
|
72
|
+
*/
|
|
73
|
+
export const BlueprintFunctionSchema = z
|
|
74
|
+
.object({
|
|
75
|
+
kind: z.literal("function"),
|
|
76
|
+
id: ElementId,
|
|
77
|
+
/** Its name, as the Editor's function list shows it (FunctionDef/Name/<id>). */
|
|
78
|
+
name: z.string().min(1),
|
|
79
|
+
identifier: z.string().regex(/^[A-Za-z_][A-Za-z0-9_]*$/, "An identifier is a Galaxy name: letters, digits and _").optional(),
|
|
80
|
+
/** What it is in the Editor (FlagAction, FlagCall, FlagCondition, FlagEvent): an action, a value (function), a condition or an event. */
|
|
81
|
+
functionKind: z.enum(FUNCTION_KINDS),
|
|
82
|
+
/** Its other flags (FlagCreateThread is createThread). */
|
|
83
|
+
flags: z.array(z.enum(FUNCTION_FLAGS)).default([]),
|
|
84
|
+
/** Its grammar and hint, as the Editor's function list shows them (FunctionDef/Grammar/<id>, FunctionDef/Hint/<id>). */
|
|
85
|
+
grammar: z.string().optional(),
|
|
86
|
+
hint: z.string().optional(),
|
|
87
|
+
/** Its icon in the function list, a Label as `<library>/<id>`: it changes no Galaxy. */
|
|
88
|
+
label: ElementRef.optional(),
|
|
89
|
+
/** The part of a campaign it is filed under (`<Section>`): it changes no Galaxy. */
|
|
90
|
+
section: z.string().min(1).optional(),
|
|
91
|
+
disabled: z.boolean().optional(),
|
|
92
|
+
deprecated: z.boolean().optional(),
|
|
93
|
+
internal: z.boolean().optional(),
|
|
94
|
+
returns: MAP_TYPES.TypeSpecSchema.optional(),
|
|
95
|
+
parameters: z.array(BlueprintParameterSchema).default([]),
|
|
96
|
+
/** Its own block slots, for a block function such as an If Then. */
|
|
97
|
+
subFunctions: z.array(SubFunctionSlotSchema).default([]),
|
|
98
|
+
variables: z.array(MAP_GUI.GuiVariableSchema).default([]),
|
|
99
|
+
actions: z.array(MAP_GUI.GuiStatementSchema).default([]),
|
|
100
|
+
/** Its text values' words, by GameStrings file, each keyed by the Param holding it (`Param/Value/<id>`). */
|
|
101
|
+
strings: StringsSchema.optional(),
|
|
102
|
+
})
|
|
103
|
+
.strict()
|
|
104
|
+
.superRefine((fn, context) => {
|
|
105
|
+
gameStringsFiles(fn.strings, context);
|
|
106
|
+
if (fn.flags.includes("native"))
|
|
107
|
+
context.addIssue({ code: "custom", path: ["flags"], message: "A Mission's function is GUI: a native one's body is Galaxy, which a Mission Blueprint doesn't hold" });
|
|
108
|
+
// What the map script's writer (the Kept renderer's renderFunction) doesn't write yet, so no compile could.
|
|
109
|
+
for (const flag of fn.flags.filter((each) => each !== "createThread" && each !== "native"))
|
|
110
|
+
context.addIssue({ code: "custom", path: ["flags"], message: `A Mission's function with the flag ${flag} isn't written yet: no compile writes its Galaxy` });
|
|
111
|
+
for (const key of ["disabled", "deprecated", "internal"])
|
|
112
|
+
if (fn[key])
|
|
113
|
+
context.addIssue({ code: "custom", path: [key], message: `A ${key} Mission function isn't written yet: no compile writes its Galaxy` });
|
|
114
|
+
if (fn.functionKind === "event")
|
|
115
|
+
context.addIssue({ code: "custom", path: ["functionKind"], message: "A Mission's event function isn't written yet: no compile writes its Galaxy" });
|
|
116
|
+
if (fn.subFunctions.length > 0)
|
|
117
|
+
context.addIssue({ code: "custom", path: ["subFunctions"], message: "A Mission's block function (one with block slots) isn't written yet: no compile writes its Galaxy" });
|
|
118
|
+
});
|
|
119
|
+
/** A comment filed among the map's items, in Root or a folder (`<Element Type="Comment">`): its text, empty for a blank one. It has no Galaxy. */
|
|
120
|
+
export const BlueprintCommentSchema = z.object({ kind: z.literal("comment"), id: ElementId, comment: z.string() }).strict();
|
|
121
|
+
/** A Galaxy name: letters, digits and _, as an identifier is. */
|
|
122
|
+
const GalaxyName = z.string().regex(/^[A-Za-z_][A-Za-z0-9_]*$/, "An identifier is a Galaxy name: letters, digits and _");
|
|
123
|
+
/**
|
|
124
|
+
* A preset type of the map's own (`<Element Type="Preset">`), as a library's is (LibraryPresetSchema):
|
|
125
|
+
* its name, base type and values, in order, a comment the Editor files among them in its place. Its
|
|
126
|
+
* Galaxy is a constant for each value (ge_<preset>_<value>) in Global Preset Declarations, numbered
|
|
127
|
+
* from 0 in order: the form every Editor save of a map's preset type has (`<PresetInteger/>`, an int
|
|
128
|
+
* base type, values with no value of their own). Any other form isn't written yet.
|
|
129
|
+
*/
|
|
130
|
+
export const BlueprintPresetSchema = z
|
|
131
|
+
.object({
|
|
132
|
+
kind: z.literal("preset"),
|
|
133
|
+
id: ElementId,
|
|
134
|
+
/** Its name, as the Editor shows it (Preset/Name/<id>): its constants are ge_, its name's identifier, _ and each value's name's. */
|
|
135
|
+
name: z.string().min(1),
|
|
136
|
+
/** Its base type (BaseType). */
|
|
137
|
+
baseType: LibraryPresetSchema.shape.baseType,
|
|
138
|
+
/** PresetInteger: its values are numbered, from 0. */
|
|
139
|
+
integer: z.boolean().optional(),
|
|
140
|
+
/**
|
|
141
|
+
* PresetGenConstVar, as the Editor saved it: it changes no Galaxy in a map, where an integer
|
|
142
|
+
* preset type gets a constant for each value either way (thanson01's and pulnar02's have none,
|
|
143
|
+
* the Missions' have it).
|
|
144
|
+
*/
|
|
145
|
+
constants: LibraryPresetSchema.shape.constants,
|
|
146
|
+
values: z
|
|
147
|
+
.array(z.union([
|
|
148
|
+
/** One of its values (PresetValue), by its name (PresetValue/Name/<id>). */
|
|
149
|
+
z.object({ id: ElementId, name: z.string().min(1) }).strict(),
|
|
150
|
+
/** A comment filed among its values. */
|
|
151
|
+
z.object({ id: ElementId, comment: z.string() }).strict(),
|
|
152
|
+
]))
|
|
153
|
+
.default([]),
|
|
154
|
+
})
|
|
155
|
+
.strict()
|
|
156
|
+
.superRefine((preset, context) => {
|
|
157
|
+
// What the map script's writer (the Kept renderer's renderPreset) doesn't write yet, so no compile could.
|
|
158
|
+
if (!preset.integer || preset.baseType !== "int")
|
|
159
|
+
context.addIssue({ code: "custom", path: ["integer"], message: "A Mission's preset type other than an integer one (integer, of base type int) isn't written yet: no compile writes its Galaxy" });
|
|
44
160
|
});
|
|
45
|
-
/**
|
|
46
|
-
export const
|
|
161
|
+
/** A record of the map's own (an Editor Structure, `<Element Type="Structure">`), as a library's structure is (LibraryStructureSchema): its members, each a variable with its type and initial value. Its Galaxy is a struct (gs_<identifier>) in Global Structures. */
|
|
162
|
+
export const BlueprintRecordSchema = LibraryStructureSchema.extend({
|
|
163
|
+
kind: z.literal("record"),
|
|
164
|
+
/** Its name, as the Editor shows it (Structure/Name/<id>): its Galaxy name is gs_ and its name's identifier. */
|
|
165
|
+
name: z.string().min(1),
|
|
166
|
+
/** Its members, the map's own preset types and records named by Id. */
|
|
167
|
+
members: z.array(MAP_GUI.GuiVariableSchema).default([]),
|
|
168
|
+
}).strict();
|
|
169
|
+
/**
|
|
170
|
+
* Custom script filed among the map's items (`<Element Type="CustomScript">`), as a library's is
|
|
171
|
+
* (LibraryCustomScriptSchema): Galaxy the Editor writes into MapScript.galaxy's Custom Script section
|
|
172
|
+
* as it stands, under its name, and the function InitCustomScript calls at map initialization. A
|
|
173
|
+
* converted one keeps its script as data (ADR-0026).
|
|
174
|
+
*/
|
|
175
|
+
export const BlueprintCustomScriptSchema = LibraryCustomScriptSchema.omit({ identifier: true, label: true })
|
|
176
|
+
.extend({
|
|
177
|
+
kind: z.literal("custom-script"),
|
|
178
|
+
/** Its name, as the Editor shows it (CustomScript/Name/<id>): its section's heading. */
|
|
179
|
+
name: z.string().min(1),
|
|
180
|
+
/** The Galaxy function InitCustomScript calls (InitFunc). */
|
|
181
|
+
initFunction: GalaxyName.optional(),
|
|
182
|
+
})
|
|
183
|
+
.strict();
|
|
184
|
+
/** Any element a Mission Blueprint's trigger element file holds, by its kind. */
|
|
185
|
+
export const BlueprintElementSchema = z.discriminatedUnion("kind", [BlueprintTriggerSchema, BlueprintFunctionSchema, BlueprintCommentSchema, BlueprintPresetSchema, BlueprintRecordSchema, BlueprintCustomScriptSchema]);
|
|
186
|
+
/** An item a Blueprint Trigger Folder files: one of the Blueprint's elements, globals or other folders, or a Kept item, as `<kind>:<id>` (a record is `structure:`, the Editor's Structure). */
|
|
187
|
+
export const BlueprintFolderItem = z.string().regex(/^(trigger|function|comment|variable|category|preset|structure|custom-script):[0-9A-F]{8}$/, "An item is trigger:<id>, function:<id>, comment:<id>, variable:<id>, category:<id>, preset:<id>, structure:<id> (a record) or custom-script:<id>, a Blueprint or Kept element by its element Id");
|
|
47
188
|
/** A Trigger Folder (an Editor Category) of the Blueprint's own triggers: its name, its icon and what it files, in order. */
|
|
48
189
|
export const BlueprintTriggerFolderSchema = z
|
|
49
190
|
.object({
|