fix: correct badge item detection by checking classname prefix
Badge item_names already start with 'badge_' (e.g. badge_citycpa3),
so checking for badge_<item_name>_icon.png produces a double prefix
(badge_badge_citycpa3_icon.png). Now uses item_name.startsWith('badge_')
instead, which correctly identifies badge items without depending on
icon files existing in the directory.
This commit is contained in:
1 parent
1167a48344
commit
750973de38
3 files changed
+10
-11
No files matched your search
@@ -240,11 +240,9 @@ export async function runCatalogAudit(
|
||||
itemId: item.id,
|
||||
message: `"${item.item_name}" (ID ${item.id}) has no catalog_items entry — not purchasable`,
|
||||
});
|
||||
// Only include items that actually have a .nitro asset — a catalog
|
||||
// entry for a furni without a bundle would be un-placeable in-game.
|
||||
// Badge items use .gif files, not .nitro bundles.
|
||||
if (
|
||||
!iconSet.has(`badge_${item.item_name}_icon.png`) &&
|
||||
!item.item_name.startsWith("badge_") &&
|
||||
nitroSet.has(`${item.item_name}.nitro`)
|
||||
) {
|
||||
missingCatalogEntries.push({
|
||||
@@ -316,7 +314,7 @@ export async function runCatalogAudit(
|
||||
for (let i = 0; i < items.length; i++) {
|
||||
const item = items[i];
|
||||
// Badge items use .gif files, not .nitro bundles.
|
||||
if (iconSet.has(`badge_${item.item_name}_icon.png`)) continue;
|
||||
if (item.item_name.startsWith("badge_")) continue;
|
||||
if (!nitroSet.has(`${item.item_name}.nitro`)) {
|
||||
missingNitroClassnames.push(item.item_name);
|
||||
issues.push({
|
||||
|
||||
@@ -159,13 +159,11 @@ export async function repairMissingIcons(
|
||||
|
||||
const processItem = async (classname: string) => {
|
||||
const fileName = `${classname}_icon.png`;
|
||||
const badgeFileName = `badge_${classname}_icon.png`;
|
||||
|
||||
// Badge items store icons as badge_<code>_icon.png, not <code>_icon.png.
|
||||
const presentDirs = iconDirs.filter(
|
||||
(dir) =>
|
||||
existsSync(path.join(dir, fileName)) ||
|
||||
existsSync(path.join(dir, badgeFileName)),
|
||||
// Badge items store icons as badge_<code>_icon.png (the classname already
|
||||
// includes the `badge_` prefix, so fileName matches correctly).
|
||||
const presentDirs = iconDirs.filter((dir) =>
|
||||
existsSync(path.join(dir, fileName)),
|
||||
);
|
||||
const missingDirs = iconDirs.filter((dir) => !presentDirs.includes(dir));
|
||||
|
||||
@@ -239,7 +237,6 @@ export async function repairMissingIcons(
|
||||
for (const source of sources) {
|
||||
const iconCandidates = [
|
||||
`${classname}_icon.png`,
|
||||
`badge_${classname}_icon.png`,
|
||||
// Variant classnames (e.g. `table_silo_med*10`) often only exist
|
||||
// on sources under their base name (e.g. `table_silo_med_icon.png`)
|
||||
// or with the `*` replaced by `_` (e.g. `table_silo_med_10_icon.png`).
|
||||
|
||||
@@ -154,6 +154,10 @@ export async function repairMissingNitros(
|
||||
onEvent?.({ type: "started", total });
|
||||
|
||||
const processItem = async (classname: string) => {
|
||||
// Badge items use .gif files, not .nitro bundles.
|
||||
if (classname.startsWith("badge_")) {
|
||||
return { status: "skipped" } as const;
|
||||
}
|
||||
const fileName = `${classname}.nitro`;
|
||||
|
||||
const presentDirs = nitroDirs.filter((dir) =>
|
||||
|
||||
Reference in new issue
Block a user