fixed # 新增药水机制

This commit is contained in:
2026-11-23 23:45:37 +08:00
parent f955716c97
commit 0eeba640ae
45 changed files with 1053 additions and 235 deletions
+17
View File
@@ -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;
}