Update Healer Man server
This commit is contained in:
1 parent
6114a2295f
commit
69809f7228
593 files changed
+903643
-40774
No files matched your search
@@ -3,6 +3,11 @@ import { readFile, readdir, stat, writeFile } from "node:fs/promises";
|
||||
import path from "node:path";
|
||||
import { fileURLToPath } from "node:url";
|
||||
import sharp from "sharp";
|
||||
import {
|
||||
alphaMaterialMatches,
|
||||
effectiveAlphaMaterialRole,
|
||||
preparedAlphaTextureFilename,
|
||||
} from "./lib/native-alpha-audit-helpers.mjs";
|
||||
|
||||
const projectRoot = path.resolve(path.dirname(fileURLToPath(import.meta.url)), "../..");
|
||||
const recipeDirectory = path.join(projectRoot, "scripts", "runewaker-pipeline", "recipes");
|
||||
@@ -116,7 +121,7 @@ async function indexResourceTextures() {
|
||||
}
|
||||
|
||||
async function resolveSourceTexture(localDirectory, imageName) {
|
||||
const fileName = `${imageName}.png`;
|
||||
const fileName = preparedAlphaTextureFilename(imageName);
|
||||
const localFile = path.join(localDirectory, fileName);
|
||||
if (await exists(localFile)) return localFile;
|
||||
return (await indexResourceTextures()).get(fileName);
|
||||
@@ -178,13 +183,13 @@ async function auditDungeon(recipe) {
|
||||
|
||||
const sourceFile = await resolveSourceTexture(preparedTextureDirectory, image.name);
|
||||
if (!sourceFile) {
|
||||
missingTextures.push(`${image.name}.png`);
|
||||
missingTextures.push(preparedAlphaTextureFilename(image.name));
|
||||
continue;
|
||||
}
|
||||
const expectedRole = await classifyAlpha(sourceFile);
|
||||
const expectedAlphaMode = expectedRole === "blend" ? "BLEND" : expectedRole === "cutout" ? "MASK" : "OPAQUE";
|
||||
const actualAlphaMode = material.alphaMode ?? "OPAQUE";
|
||||
const actualRole = material.extras?.semanticRole ?? "missing";
|
||||
const actualRole = effectiveAlphaMaterialRole(material.extras?.semanticRole, actualAlphaMode);
|
||||
materialResults.push({
|
||||
materialIndex,
|
||||
material: material.name ?? `material-${materialIndex}`,
|
||||
@@ -193,9 +198,9 @@ async function auditDungeon(recipe) {
|
||||
expectedAlphaMode,
|
||||
actualRole,
|
||||
actualAlphaMode,
|
||||
matches: expectedAlphaMode === actualAlphaMode && expectedRole === actualRole,
|
||||
matches: alphaMaterialMatches(expectedAlphaMode, expectedRole, actualAlphaMode, actualRole),
|
||||
});
|
||||
if (fix && (expectedAlphaMode !== actualAlphaMode || expectedRole !== actualRole)) {
|
||||
if (fix && !alphaMaterialMatches(expectedAlphaMode, expectedRole, actualAlphaMode, actualRole)) {
|
||||
if (expectedAlphaMode === "OPAQUE") delete material.alphaMode;
|
||||
else material.alphaMode = expectedAlphaMode;
|
||||
if (expectedAlphaMode === "MASK") material.alphaCutoff = 0.5;
|
||||
|
||||
Reference in new issue
Block a user