fix: improve SCUM map playback filters

This commit is contained in:
npc0-hue
2026-09-20 10:45:32 +08:00
parent 60d479db71
commit 312804c55e
32 changed files with 770 additions and 293 deletions
@@ -5155,8 +5155,10 @@ export function vehicleAliasKeys(code: string): string[] {
}
const vehicleIconAliases: Record<string, string> = {};
const vehicleEntriesByIcon = new Map<string, ScumCatalogEntry>();
for (const entry of scumCatalogEntries) {
if (entry.kind !== "vehicle" || !entry.icon) continue;
if (!vehicleEntriesByIcon.has(entry.icon)) vehicleEntriesByIcon.set(entry.icon, entry);
for (const key of vehicleAliasKeys(entry.code)) vehicleIconAliases[key] = entry.icon;
}
@@ -5239,7 +5241,7 @@ export function scumVehicleEntry(vehicleCode: string): ScumCatalogEntry | undefi
for (const key of vehicleAliasKeys(vehicleCode)) {
const icon = vehicleIconAliases[key];
if (!icon) continue;
const entry = scumCatalogEntries.find((value) => value.kind === "vehicle" && value.icon === icon);
const entry = vehicleEntriesByIcon.get(icon);
if (entry) return entry;
}
return scumCatalogEntryFor(vehicleCode);