diff --git a/src/tools/import/importArmaLibrary.ts b/src/tools/import/importArmaLibrary.ts index 448eea3..ca9dc16 100644 --- a/src/tools/import/importArmaLibrary.ts +++ b/src/tools/import/importArmaLibrary.ts @@ -59,10 +59,12 @@ function resolveHemtt(explicit?: string): string { throw new Error("hemtt not found; pass --hemtt "); } +// Mirrors the Assets collection's assetType enum (see payload-types.ts). +// The in-game export (ptf_export addon) emits exactly these values. const KNOWN_ASSET_TYPES = new Set([ - "weapon", "magazine", "ammo", "backpack", "vest", "helmet", "uniform", - "item", "attachment", "optics", "muzzle", "grip", "rail", "explosive", - "grenade", "medical", "tool", + "weapon", "magazine", "optic", "muzzle", "bipod", "uniform", "vest", + "backpack", "helmet", "facewear", "nvg", "radio", "medical", "tool", + "explosive", "skin", "miscellaneous", ]); function classifyAssetType(clazz: string, type: string): string { const t = (type || "").toLowerCase(); @@ -116,6 +118,7 @@ interface ImportPlan { displayName: string; description: string; assetType: string; + mod: string; pictureRef: string; paaPath: string; pngPath: string; @@ -134,6 +137,7 @@ function planImport( const displayName = String(rec.displayName ?? rec.name ?? clazz).trim() || clazz; const description = String(rec.description ?? "").trim(); const pictureRef = String(rec.picture ?? "").trim(); + const mod = String(rec.mod ?? "").trim() || "Arma 3"; const iconRef = lookups.icons ? lookupIcon(lookups.icons, clazz) : ""; const ref = iconRef || pictureRef; const paaPath = ref ? resolvePaaPath(ref, lookups.paaRoot) : ""; @@ -143,7 +147,7 @@ function planImport( const screenshotPath = lookups.screenshots ? (["png", "webp", "jpg"].map((e) => join(lookups.screenshots, clazz + "." + e)).find(existsSync) ?? "") : ""; - return { kind: vehicle ? "vehicle" : "asset", clazz, displayName, description, assetType, pictureRef: ref, paaPath, pngPath, screenshotPath }; + return { kind: vehicle ? "vehicle" : "asset", clazz, displayName, description, assetType, mod, pictureRef: ref, paaPath, pngPath, screenshotPath }; } async function resolveFuelConfig(payload: { find: (args: any) => Promise<{ docs: any[] }> }): Promise<{ id: number }> { @@ -182,7 +186,7 @@ async function writeEntry( data: { ...common, assetType: plan.assetType, - ...(plan.pngPath ? { "Asset Metadata": { mod: "Arma 3", thumbnail: mediaId, gameDescription: plan.description || null } } : {}), + ...(plan.pngPath ? { "Asset Metadata": { mod: plan.mod, thumbnail: mediaId, gameDescription: plan.description || null } } : {}), }, }).then((d: any) => `asset:${d.id}`); }