mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-11-29 04:44:23 +01:00
optional motion.filepath
This commit is contained in:
3 files changed
+9
-2
No files matched your search
@@ -27,6 +27,7 @@ Pages that are not migrated yet are named `_index.astro` so Astro skips them. Mi
|
|||||||
- Always hoist values that take work to compute (a function call, math, a lookup, like `"A".charCodeAt(0)` or `1 - SCROLL_ZONE`) and don't change between iterations or calls out of loops and repeatedly called functions into a `const` above them. No exceptions. Plain literals (strings, numbers, selectors like `"[data-row]"`) cost nothing and stay inline.
|
- Always hoist values that take work to compute (a function call, math, a lookup, like `"A".charCodeAt(0)` or `1 - SCROLL_ZONE`) and don't change between iterations or calls out of loops and repeatedly called functions into a `const` above them. No exceptions. Plain literals (strings, numbers, selectors like `"[data-row]"`) cost nothing and stay inline.
|
||||||
- A helper function used in only one place gets inlined there. Only extract a function once it has a second caller.
|
- A helper function used in only one place gets inlined there. Only extract a function once it has a second caller.
|
||||||
- Assert data that is known to be present with `!` instead of `?.` or `?? 0`; crashing beats silently showing a plausible wrong value. Keep `?.` only where absence is real logic: `optional` proto fields (check the `.proto`), optional script effect fields, and lookups that can legitimately miss.
|
- Assert data that is known to be present with `!` instead of `?.` or `?? 0`; crashing beats silently showing a plausible wrong value. Keep `?.` only where absence is real logic: `optional` proto fields (check the `.proto`), optional script effect fields, and lookups that can legitimately miss.
|
||||||
|
- An `if` whose body ends up on its own line (including when the formatter wraps the condition) gets curly braces. Only a body on the same line as the `if` stays brace-less.
|
||||||
- Single-line comments use `//`, never `/** */`. Keep `/** */` for multi-line doc comments.
|
- Single-line comments use `//`, never `/** */`. Keep `/** */` for multi-line doc comments.
|
||||||
|
|
||||||
## JSX
|
## JSX
|
||||||
|
|||||||
@@ -273,7 +273,8 @@ export type Component =
|
|||||||
}
|
}
|
||||||
| {
|
| {
|
||||||
"comp.typename": "MotionComponent";
|
"comp.typename": "MotionComponent";
|
||||||
"motion.filepath": string;
|
// absent on some skins (Oth99_Relic_hull_skin) that only carry playback settings
|
||||||
|
"motion.filepath"?: string;
|
||||||
"motion.playbackRate": number;
|
"motion.playbackRate": number;
|
||||||
"simpleMotion.repeatsCount": number;
|
"simpleMotion.repeatsCount": number;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -127,7 +127,12 @@ export async function loadHierarchyMotions(
|
|||||||
|
|
||||||
parseHierarchies(sc2["#hierarchy"], null, (hierarchy, components) => {
|
parseHierarchies(sc2["#hierarchy"], null, (hierarchy, components) => {
|
||||||
for (const component of components) {
|
for (const component of components) {
|
||||||
if (component["comp.typename"] !== "MotionComponent") continue;
|
if (
|
||||||
|
component["comp.typename"] !== "MotionComponent" ||
|
||||||
|
component["motion.filepath"] === undefined
|
||||||
|
) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
loading.push(
|
loading.push(
|
||||||
loadMotion(vfs, path, component).then((motion) => {
|
loadMotion(vfs, path, component).then((motion) => {
|
||||||
|
|||||||
Reference in new issue
Block a user