-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
50 additions
and
1 deletion.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
export { deepMerge as _deepMerge } from "https://deno.land/[email protected]/collections/deep_merge.ts"; | ||
export * as JSONC from "https://deno.land/[email protected]/encoding/jsonc.ts"; | ||
export { dirname } from "https://deno.land/[email protected]/path/mod.ts"; | ||
export { join } from "https://deno.land/[email protected]/path/posix.ts"; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
import { StringOrRecord } from "../schemas/mod.ts"; | ||
|
||
interface DescriptionLike { | ||
scripts?: { | ||
animate?: StringOrRecord[]; | ||
}; | ||
animations?: Record<string, string>; | ||
} | ||
|
||
/** | ||
* Helper function to add an animation to a description object | ||
* | ||
* @param description A description object that has a scripts and animations property | ||
* @param name Animation name | ||
* @param identifier Animation identifier | ||
* @param condition Molang query. Set to `true` to always run | ||
*/ | ||
export function addAnimation( | ||
description: DescriptionLike, | ||
name: string, | ||
identifier: string, | ||
condition?: string | true, | ||
): void { | ||
description.scripts ??= {}; | ||
description.scripts.animate ??= []; | ||
description.animations ??= {}; | ||
|
||
description.animations[name] = identifier; | ||
|
||
if (!condition) return; | ||
if (typeof condition === "string") { | ||
description.scripts.animate.push({ | ||
[name]: condition, | ||
}); | ||
} else { | ||
description.scripts.animate.push(name); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
import { _deepMerge } from "../../deps.ts"; | ||
|
||
export function deepMerge<T>(source: T, others: T): T { | ||
// @ts-ignore: deepMerge is not generic | ||
return _deepMerge(source, others); | ||
} |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters