mirror of
https://github.com/Shu-Ying/noname-shuying.git
synced 2026-11-24 14:06:29 +08:00
fixed # 新增药水机制
This commit is contained in:
@@ -0,0 +1,17 @@
|
||||
import { existsSync, readFileSync, statSync } from "node:fs";
|
||||
import { join, resolve } from "node:path";
|
||||
import { fileURLToPath } from "node:url";
|
||||
|
||||
const toolsDir = fileURLToPath(new URL(".", import.meta.url));
|
||||
|
||||
export function getSts2Atlas(name) {
|
||||
const config = join(toolsDir, ".sts2-source");
|
||||
const source = process.env.MENGSAN_STS2_SOURCE?.trim()
|
||||
|| (existsSync(config) ? readFileSync(config, "utf8").trim() : "")
|
||||
|| "../assets/sts2";
|
||||
const atlas = resolve(toolsDir, source, "Godot_Atlas_Sprites_v0.111.0", "images", "atlases", name);
|
||||
if (!statSync(atlas, { throwIfNoEntry: false })?.isDirectory()) {
|
||||
throw new Error("找不到 STS2 拆分图集:" + atlas + "。请检查 MENGSAN_STS2_SOURCE 或 tools/.sts2-source。");
|
||||
}
|
||||
return atlas;
|
||||
}
|
||||
Reference in New Issue
Block a user