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X2HQVRBXNIKAC
DHO4JCJIELKX4R42XXAMAHVQTTE6OWULLP2QF4BXO3UWC5UTMSMAC
}, [gameState.playerSave.allocatedPointNodeSet, gameState.playerSave.availableSp]);
}, [gameState.playerSave.allocatedPointNodeSet, gameState.playerSave.availableSp]);
tabViews[2] = useMemo(() => {
return (
<DebugTab
selectedPointNode={gameState.playerUI.selectedPointNode}
allocatedPointNodeSet={gameState.playerSave.allocatedPointNodeSet}
worldGen={gameState.worldGen}
availableSp={gameState.playerSave.availableSp}
/>);
}, [
gameState.playerUI.selectedPointNode,
gameState.playerSave.allocatedPointNodeSet,
gameState.worldGen,
gameState.playerSave.availableSp
]);
import React, { useEffect, useState } from "react";
import { PointNodeRef, ResourceType, WorldGenState } from "../data/GameState";
import { HashSet } from "../lib/util/data_structures/hash";
import { canAllocate } from "../data/lib/Neighbors";
type Props = {
selectedPointNode?: PointNodeRef
allocatedPointNodeSet: HashSet<PointNodeRef>,
worldGen: WorldGenState,
availableSp: number,
}
export function DebugTab({
selectedPointNode,
allocatedPointNodeSet,
worldGen,
availableSp,
}: Props) {
const [history, setHistory] = useState<PointNodeRef[]>([]);
useEffect(() => {
if (!selectedPointNode) return;
setHistory((history) => [...history, selectedPointNode]);
}, [selectedPointNode]);
if (!selectedPointNode) {
return (<> </>)
}
const pointNodeGen = worldGen.zLevels[selectedPointNode.z]!.chunks.get(selectedPointNode.chunkCoord)!.pointNodes.get(selectedPointNode.pointNodeCoord)!
const isAllocated = (allocatedPointNodeSet.contains(selectedPointNode));
const canBeAllocated: string = canAllocate(selectedPointNode, worldGen, allocatedPointNodeSet, availableSp);
let nodeDescription: string = "Nothing (empty node)";
if (pointNodeGen.resourceType !== ResourceType.Nothing) {
nodeDescription = `${pointNodeGen.resourceAmount} ${pointNodeGen.resourceModifier} ${pointNodeGen.resourceType}`
}
return (
<>
<h1>Current</h1>
<div>
Z={selectedPointNode.z}
</div>
<div>
Chunk={selectedPointNode.chunkCoord.x},{selectedPointNode.chunkCoord.y}
</div>
<div>
Node={selectedPointNode.pointNodeCoord.x},{selectedPointNode.pointNodeCoord.y}
</div>
<br></br>
<div>Allocated? {isAllocated ? "yes" : "no"} </div>
<br></br>
<div>Can be allocated? {canBeAllocated} </div>
<br></br>
<div> Stats: </div>
<div> {nodeDescription} </div>
<h3>Previous</h3>
{history
.slice(0, -1)
.map((pointNodeRef: PointNodeRef, i) => {
return (
<div key={i}>
<div>
Z={pointNodeRef.z} { }
Chunk={pointNodeRef.chunkCoord.x},{pointNodeRef.chunkCoord.y} { }
Node={pointNodeRef.pointNodeCoord.x},{pointNodeRef.pointNodeCoord.y}
</div>
</div>
);
})
.reverse()}
</>
);
}
<h1>Current</h1>
<div>
Z: {selectedPointNode.z} . Chunk: {selectedPointNode.chunkCoord.x}, {selectedPointNode.chunkCoord.y} . Node: {selectedPointNode.pointNodeCoord.x}, {selectedPointNode.pointNodeCoord.y} .
</div>
<br></br>
<div>Allocated? {isAllocated ? "yes" : "no"} </div>
<div>Can be allocated? {canBeAllocated} </div>
<br></br>
<div> Stats: </div>
<h1>Stats</h1>
<h2>Previous</h2>
{history
.slice(0, -1)
.map((pointNodeRef: PointNodeRef, i) => {
return (
<div key={i}>
Chunk ({pointNodeRef.chunkCoord.x},{pointNodeRef.chunkCoord.y}) at ({pointNodeRef.pointNodeCoord.x},
{pointNodeRef.pointNodeCoord.y})
</div>
);
})
.reverse()}
<h3>Allocated?</h3>
{isAllocated ? "yes" : "no"}
<h3>Can be allocated?</h3>
{canBeAllocated}
</>)}
<br></br>
<div>(Hint: You won't run out of skill points, but they come in batches - try to use the fewest you can!)</div>
</>)}
<br></br>
<h3> Available SP: </h3>
<div>{remainingPoints}</div>
{(remainingPoints === 0) ? (<div><br></br>(Start a quest first!)</div>) : (<></>) }