Skip to content

Commit

Permalink
🪨🥿 ↝ [SP-37]: Adding anomaly browsing to map amalgamation + mission s…
Browse files Browse the repository at this point in the history
…cope planning
  • Loading branch information
Gizmotronn committed Dec 3, 2024
1 parent 150037b commit 9300aac
Show file tree
Hide file tree
Showing 7 changed files with 304 additions and 97 deletions.
4 changes: 3 additions & 1 deletion app/tests/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,15 @@ import React from "react";
import StarnetLayout from "@/components/Layout/Starnet";
import { MiningComponentComponent } from "@/components/(scenes)/mining/mining-component";
import Greenhouse from "@/page.test";
import BigMap from "@/components/(scenes)/planetScene/bigMap";
// import { TopographicMap } from "@/components/topographic-map";

export default function TestPage() {
return (
// <StarnetLayout>
<>
<Greenhouse />
{/* <Greenhouse /> */}
<BigMap />
{/* <MiningComponent /> */}
</>
// {/* </StarnetLayout> */}
Expand Down
2 changes: 1 addition & 1 deletion components/(scenes)/mining/mining-component.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,7 @@ export function MiningComponentComponent() {

const toggleMap = () => {
setActiveLandmark(null);
setLandmarks((prev) => [...prev]); // Trigger re-render for landmarks
setLandmarks((prev) => [...prev]);
setActiveMap((prev) => (prev === "2D" ? "3D" : "2D"));
};

Expand Down
33 changes: 18 additions & 15 deletions components/(scenes)/mining/topographic-map.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ type Landmark = {
};

type TopographicMapProps = {
deposits: MineralDeposit[];
deposits: MineralDeposit[];
roverPosition: { x: number; y: number } | null;
selectedDeposit: MineralDeposit | null;
landmarks: Landmark[];
Expand Down Expand Up @@ -123,7 +123,6 @@ export function TopographicMap({
const newSeed = Math.random().toString(); // Generate a new random seed
setTerrainSeed(newSeed);

// Move landmarks to random positions
setDynamicLandmarks(
dynamicLandmarks.map((landmark) => ({
...landmark,
Expand All @@ -139,19 +138,23 @@ export function TopographicMap({
<div className="relative w-full h-full">
<BackgroundMap deposits={deposits} seed={terrainSeed} />
{deposits.map((deposit) => (
<div
key={deposit.id}
className="absolute"
style={{
left: `${deposit.position.x}%`,
top: `${deposit.position.y}%`,
transform: "translate(-50%, -50%)",
}}
onClick={() => onDepositSelect(deposit)}
>
{getMineralIcon(deposit.mineral)}
</div>
))}
<div
key={deposit.id}
className="absolute"
style={{
left: `${deposit.position.x}%`,
top: `${deposit.position.y}%`,
transform: "translate(-50%, -50%)",
}}
onClick={() => onDepositSelect(deposit)}
>
{deposit.icon_url ? (
<img src={deposit.icon_url} alt={deposit.mineral} />
) : (
getMineralIcon(deposit.mineral)
)}
</div>
))}
{dynamicLandmarks.map((landmark) => (
<div
key={landmark.id}
Expand Down
Loading

0 comments on commit 9300aac

Please sign in to comment.