diff --git a/src/components/BlueOrb/BlueOrb.tsx b/src/components/BlueOrb/BlueOrb.tsx index f9a0963..4716d19 100644 --- a/src/components/BlueOrb/BlueOrb.tsx +++ b/src/components/BlueOrb/BlueOrb.tsx @@ -19,8 +19,8 @@ import level_y_values from "../../resources/level_y_values.json"; type BlueOrbContructorProps = { sprite: string; - position: [number, number, number]; - rotation: [number, number, number, (string | undefined)?]; + position: number[]; + rotation: number[]; active: boolean; level: string; }; @@ -39,12 +39,13 @@ const BlueOrb = memo((props: BlueOrbContructorProps) => { // so we import all of them here and then use this function to // associate a sprite with the path const spriteToPath = (sprite: string) => { - console.log(sprite); - if (sprite.startsWith("S")) { + if (sprite.includes("S")) { return [SSkn, SSKnActive]; - } else if (sprite.startsWith("P") || sprite.startsWith("G")) { - return [MULTI, MULTIActive]; - } else if (sprite.includes("?")) { + } else if ( + sprite.startsWith("P") || + sprite.startsWith("G") || + sprite.includes("?") + ) { return [MULTI, MULTIActive]; } else if (sprite.includes("Dc")) { return [Dc, DcActive]; @@ -117,9 +118,9 @@ const BlueOrb = memo((props: BlueOrbContructorProps) => { return ( diff --git a/src/components/Site.tsx b/src/components/Site.tsx index b4a1ee4..890dafd 100644 --- a/src/components/Site.tsx +++ b/src/components/Site.tsx @@ -7,6 +7,48 @@ import { currentBlueOrbAtom } from "./BlueOrb/CurrentBlueOrbAtom"; import Level from "./Level"; import level_y_values from "../resources/level_y_values.json"; +type ImageTableIndices = { + 1: string; + 2: string; + 3: string; +}; + +type ProtocolLines = { + 1: string; + 2: string; + 3: string; + 4: string; +}; + +type Words = { + 1: string; + 2: string; + 3: string; +}; + +type BlueOrbData = { + "SLPS_016_0x offset": string; + image_table_indices: ImageTableIndices; + is_hidden: string; + media_file: string; + node_name: string; + protocol_lines: ProtocolLines; + site: string; + type: string; + unlocked_by: string; + upgrade_requirement: string; + words: Words; +}; + +type BlueOrbPositionData = { + position: number[]; + rotation: number[]; +}; + +type BlueOrbPositions = { + [orbPos: string]: BlueOrbPositionData; +}; + const Site = memo(() => { const currentBlueOrb = useRecoilValue(currentBlueOrbAtom); @@ -14,29 +56,28 @@ const Site = memo(() => { <> loading...}> {/* distance between LEVELS is 1.5 */} - {Object.values(level_y_values).map((yVal) => { - return ; + return ; })} - {Object.entries(site_a).map((blueOrb) => { - if ((blueOrb as any)[1]["unlocked_by"] === "-1") + {Object.entries(site_a).map((blueOrb: [string, BlueOrbData]) => { + if (blueOrb[1]["unlocked_by"] === "-1") return ( ); })}