102 lines
2.1 KiB
TypeScript
102 lines
2.1 KiB
TypeScript
import type { CategoryId } from "@/types/gunbuilder";
|
|
|
|
// CategoryId -> partRoles
|
|
export const CATEGORY_TO_PART_ROLES: Record<CategoryId, string[]> = {
|
|
// CORE / EXISTING
|
|
upper: ["upper-receiver"],
|
|
barrel: ["barrel"],
|
|
handguard: ["handguard"],
|
|
chargingHandle: ["charging-handle"],
|
|
buffer: ["buffer-kit"],
|
|
lowerParts: ["lower-parts-kit"],
|
|
sights: ["sight"],
|
|
lower: ["LOWER_RECEIVER_STRIPPED"],
|
|
optic: ["optic"],
|
|
stock: ["stock"],
|
|
|
|
// NEW LOWER PARTS
|
|
trigger: ["trigger", "trigger-kit"],
|
|
grip: ["pistol-grip", "grip"],
|
|
safety: ["safety", "safety-selector"],
|
|
completeLower: ["complete-lower"],
|
|
|
|
// NEW UPPER PARTS
|
|
completeUpper: ["complete-upper"],
|
|
bcg: ["bcg", "bolt-carrier-group"],
|
|
gasBlock: ["gas-block"],
|
|
gasTube: ["gas-tube"],
|
|
muzzleDevice: ["muzzle-device", "compensator", "brake"],
|
|
suppressor: ["suppressor"],
|
|
|
|
// ===== ACCESSORIES =====
|
|
|
|
// Magazines
|
|
magazine: [
|
|
"magazine",
|
|
"mag",
|
|
"magazine-ar15",
|
|
"magazine-308",
|
|
"drum-magazine",
|
|
],
|
|
|
|
// Lights / Lasers
|
|
weaponLight: [
|
|
"weapon-light",
|
|
"light",
|
|
"weapon-light-laser",
|
|
"light-laser-combo",
|
|
"laser",
|
|
],
|
|
|
|
// Foregrips
|
|
foregrip: [
|
|
"vertical-grip",
|
|
"angled-foregrip",
|
|
"foregrip",
|
|
"handstop",
|
|
],
|
|
|
|
// Bipods
|
|
bipod: [
|
|
"bipod",
|
|
],
|
|
|
|
// Slings & mounts
|
|
sling: [
|
|
"sling",
|
|
"sling-mount",
|
|
"sling-swivel",
|
|
"qd-sling-mount",
|
|
],
|
|
|
|
// Rail sections & covers
|
|
railAccessory: [
|
|
"rail-section",
|
|
"picatinny-rail-section",
|
|
"m-lok-rail-section",
|
|
"keymod-rail-section",
|
|
"rail-cover",
|
|
"rail-panel",
|
|
],
|
|
|
|
// Tools & maintenance
|
|
tools: [
|
|
"tool",
|
|
"armorer-tool",
|
|
"armorer-wrench",
|
|
"cleaning-kit",
|
|
"bore-snake",
|
|
"vise-block",
|
|
"torque-wrench",
|
|
],
|
|
};
|
|
|
|
// Invert to get partRole -> CategoryId
|
|
export const PART_ROLE_TO_CATEGORY: Record<string, CategoryId> = Object.entries(
|
|
CATEGORY_TO_PART_ROLES,
|
|
).reduce((acc, [categoryId, roles]) => {
|
|
for (const role of roles) {
|
|
acc[role] = categoryId as CategoryId;
|
|
}
|
|
return acc;
|
|
}, {} as Record<string, CategoryId>); |