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3OR332GBIYYNKMZTW24AC
6OD22ZHHEANTKREVSWHHAWEDVUFWTZHUKJD35ICBPWYERYPABGDQC
N2M7CWXHD722QWM6IIIEOD66YMR3SSZEJZLDCGEIPXRCVNF6YBSQC
3UFL673QX2JG7KHTAM7DFH4BBYVHDNMXBS2RW45G3JBNFZFLSRRQC
}
export type ComputedState = {
playerResourceAmounts?: { [k in ResourceType]: number }
playerResourceNodesAggregated?: HashMap<ResourceTypeAndModifier, number>
}
// export type ResourceTypeAndModifier = [ResourceType.Nothing] | ([ResourceType, ResourceModifier]);
export class ResourceTypeAndModifier {
public type: ResourceNontrivialType;
public modifier: ResourceModifier;
constructor(args: { type: ResourceNontrivialType, modifier: ResourceModifier}) {
this.type = args.type;
this.modifier = args.modifier;
}
public hash(): string {
return this.type.toString() + ',' + this.modifier.toString();
}
import { GameState, ResourceModifier, ResourceType, ResourceTypeAndModifier } from "../data/GameState";
import { HashMap } from "../lib/util/data_structures/hash";
import { enumKeys } from "../lib/util/misc";
export function computePlayerResourceAmounts(gameState: GameState): ({ [k in ResourceType]: number }) {
let amounts: { [k in ResourceType]?: number } = {};
let playerResourceNodesAggregated = new HashMap<ResourceTypeAndModifier, number>();
for (let pointNodeRef of gameState.playerSave.allocatedPointNodeHistory) {
let pointNodeGen = gameState.worldGen.zLevels[pointNodeRef.z]!.chunks.get(pointNodeRef.chunkCoord)!.pointNodes.get(pointNodeRef.pointNodeCoord)!
if (pointNodeGen.resourceType === "Nothing") {
continue;
}
let resourceTypeAndModifier = new ResourceTypeAndModifier({
type: pointNodeGen.resourceType, modifier: pointNodeGen.resourceModifier
});
}
for (let key of enumKeys(ResourceType)) {
if (key === ResourceType.Nothing) {
amounts[key] = 0;
continue;
}
// iterate throu
amounts[key];
}
return amounts as { [k in ResourceType]: number }
}