From 7d53e972622080bfd515a56cdc6e152d80314fed Mon Sep 17 00:00:00 2001 From: Atul Varma Date: Mon, 5 Jul 2021 06:30:05 -0400 Subject: [PATCH] Add a 'wildcard' (neutral) attachment point type. (#200) This adds a new attachment point type called `wildcard` (colored `#000000` in the SVGs) which, as the name suggests, can contain _any_ kind of symbol. Fixes #187. --- lib/colors.ts | 1 + lib/pages/creature-page.tsx | 5 +++++ lib/specs.ts | 2 ++ 3 files changed, 8 insertions(+) diff --git a/lib/colors.ts b/lib/colors.ts index 63d03b0..1a8c2a5 100644 --- a/lib/colors.ts +++ b/lib/colors.ts @@ -13,6 +13,7 @@ export const ATTACHMENT_POINT_COLORS: { arm: "#00ff00", horn: "#00ffff", crown: "#0000ff", + wildcard: "#000000", }; export const NESTING_BOUNDING_BOX_COLOR = "#ff00ff"; diff --git a/lib/pages/creature-page.tsx b/lib/pages/creature-page.tsx index 30f5fb5..983a505 100644 --- a/lib/pages/creature-page.tsx +++ b/lib/pages/creature-page.tsx @@ -64,6 +64,11 @@ const ATTACHMENT_SYMBOLS: AttachmentSymbolMap = (() => { result[type] = SvgVocabulary.items.filter((data) => { const { meta } = data; + if (type === "wildcard") { + // The wildcard attachment point type can have anything! + return true; + } + // If we have no metadata whatsoever, it can attach anywhere. if (!meta) return true; diff --git a/lib/specs.ts b/lib/specs.ts index 4d8e274..f5477f8 100644 --- a/lib/specs.ts +++ b/lib/specs.ts @@ -19,6 +19,7 @@ type AttachmentPointSpecs = { arm: PointWithNormal[]; horn: PointWithNormal[]; crown: PointWithNormal[]; + wildcard: PointWithNormal[]; }; type FullSpecs = AttachmentPointSpecs & { @@ -41,6 +42,7 @@ export const ATTACHMENT_POINT_TYPES: AttachmentPointType[] = [ "arm", "horn", "crown", + "wildcard", ]; const ATTACHMENT_POINT_SET = new Set(ATTACHMENT_POINT_TYPES);