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
+11
View File
@@ -4,6 +4,7 @@ import { dirname, join, resolve } from "node:path";
import { fileURLToPath } from "node:url";
import { scumCatalogEntries, scumCatalogIconUrl, scumVehicleEntry, scumVehicleFallbackIconUrl, scumVehicleIconUrl } from "../examples/scum-server-plugin/features/scum-catalog.js";
import { scumMapVehicleIconUrl } from "../examples/scum-server-plugin/features/map-vehicle-icons.js";
const pluginRoot = resolve(dirname(fileURLToPath(import.meta.url)), "../examples/scum-server-plugin");
const catalogSource = readFileSync(join(pluginRoot, "features/scum-catalog.ts"), "utf8");
@@ -35,4 +36,14 @@ describe("scum catalog icons", () => {
expect(scumVehicleFallbackIconUrl("Quad_01_D_ES")).toContain("data:image/svg+xml");
expect(decodeURIComponent(scumVehicleFallbackIconUrl("Dinghy_ES"))).toContain("<svg");
});
it("uses the small map asset for known classes while keeping catalog originals separate", () => {
for (const code of ["Rager_ES", "Laika_ES", "BPC_Laika_C", "Dinghy_ES", "Tractor_ES"]) {
const icon = scumMapVehicleIconUrl(code);
expect(icon).toContain("/map/vehicles/");
expect(existsSync(fileURLToPath(icon))).toBe(true);
expect(readFileSync(fileURLToPath(icon)).length).toBeLessThan(4000);
}
expect(scumVehicleIconUrl("Laika_ES")).toContain("scum-catalog");
});
});