GZRMSSTEWT3T2JERC7WCVT727X237UA6MXWVT6OSV5D5BRD4UOGQC
SJGRJWVRMIYRCSQUR4LMS2APZNSJ64JAW7647NYTB52REONXVD2QC
IYRYOO3B2EFA2O3JJKOQLEQ6WWDCCGEH3LSFCZJUMBXTVYFZS44QC
EMED7UWAGESRTWJJWVXRL27O4XMBGZDDAU4LNVF3MQAYKFKRDNXQC
HUH4SI4HXIP72KQSJP2I4ELHX5KUQZM7FFGKZZGJ33DF7E3JHMYQC
Z3E7XJOW6NSBDYRDKSGTOAEJSPATAUX4JUFCL4DIL3372GL4K52QC
N2M7CWXHD722QWM6IIIEOD66YMR3SSZEJZLDCGEIPXRCVNF6YBSQC
WPC667PRTGRE7BNP6E7ZCQIKXYMIHJT3LUTTQT7VX2HQVRBXNIKAC
ZGS4FTTFBXTF2SHYTPAJJBWEUVWVYXPSJVEFI5NYJWTW273B4NHAC
TQ57VE45BHV7MOZ6GKTYZEAMAOTXLPQ3ROCWJ2FUCITQWOYVMUIAC
3UFL673QX2JG7KHTAM7DFH4BBYVHDNMXBS2RW45G3JBNFZFLSRRQC
Y7TNTUXM44MRLGA6FEG7J6BR77I7N3AIPZYVPXULOQZQ6PNOWJ7QC
3J7QNHQ4F2VBYCK6SWKPO3AW3YYAJZNWOW6XNSURSRDZOE2ZIGQAC
4UKXFJRZYO5WEPH5PKMYDZCWVWSEAXFSPL35G5NFIUBCMH3BCXEQC
<h3>
Chunk: {selectedPointNode.chunkCoord.x},{selectedPointNode.chunkCoord.y}
</h3>
<h3>X: {selectedPointNode.pointNodeCoord.x}</h3>
<h3>Y: {selectedPointNode.pointNodeCoord.y}</h3>
<div>
Z: {selectedPointNode.z} . Chunk: {selectedPointNode.chunkCoord.x}, {selectedPointNode.chunkCoord.y} . Node: {selectedPointNode.pointNodeCoord.x}, {selectedPointNode.pointNodeCoord.y} .
</div>
<br></br>
resourceType: ResourceType | null;
resourceModifier: ResourceModifier;
resourceAmount: number;
}
export enum ResourceType {
Mana0 = "Mana0",
Mana1 = "Mana1",
Mana2 = "Mana2",
Nothing = "Nothing"
}
export enum ResourceModifier {
Flat = "Flat",
Increased0 = "% increased",
AfterIncreased0 = "added after % increased",
Increased1 = "% increased multiplier",
AfterIncreased1 = "added after % increased multiplier"
import { WorldGenState, ChunkGen, PointNodeGen, ChunkGenConstants, ZLevelGen } from "../data/GameState";
import { rm } from "fs";
import { WorldGenState, ChunkGen, PointNodeGen, ChunkGenConstants, ZLevelGen, ResourceType, ResourceModifier } from "../data/GameState";
}
}
type PointNodeGenConfig = {};
export class PointNodeGenFactory {
public config: PointNodeGenConfig;
constructor(config: PointNodeGenConfig) {
this.config = config;
}
public create(args: { seed: number, location: Vector2 }): PointNodeGen {
const id = squirrel3(args.seed + squirrel3(args.seed + args.location.x) + args.location.y);
let randomFloat = squirrel3(id + 1) / INTMAX32;
let resourceType: ResourceType;
if (randomFloat < 0.0) {
resourceType = ResourceType.Nothing;
} else if (randomFloat < 0.20) {
resourceType = ResourceType.Mana0;
} else if (randomFloat < 0.35) {
resourceType = ResourceType.Mana1;
} else if (randomFloat < 0.60) {
resourceType = ResourceType.Mana2;
} else {
resourceType = ResourceType.Nothing;
}
randomFloat = squirrel3(id + 2) / INTMAX32;
let resourceModifier: ResourceModifier;
if (randomFloat < 0.70) {
resourceModifier = ResourceModifier.Flat;
} else if (randomFloat < 0.73) {
resourceModifier = ResourceModifier.AfterIncreased0;
} else if (randomFloat < 0.75) {
resourceModifier = ResourceModifier.AfterIncreased1;
} else if (randomFloat < 0.95) {
resourceModifier = ResourceModifier.Increased0;
} else {
resourceModifier = ResourceModifier.Increased1;
}
let resourceAmount = 0;
if (resourceModifier === ResourceModifier.Flat ||
resourceModifier === ResourceModifier.AfterIncreased0 ||
resourceModifier === ResourceModifier.AfterIncreased1) {
randomFloat = Math.floor(squirrel3(id + 3) / INTMAX32 * 4); // base is 20 ish?
randomFloat += Math.floor(squirrel3(id + 4) / INTMAX32 * 4); // base is 20 ish?
randomFloat += Math.floor(squirrel3(id + 5) / INTMAX32 * 4); // base is 20 ish?
resourceAmount = randomFloat * 20 + 60;
} else {
randomFloat = Math.floor(squirrel3(id + 3) / INTMAX32 * 2); // base is 20 ish?
randomFloat += Math.floor(squirrel3(id + 4) / INTMAX32 * 2); // base is 20 ish?
randomFloat += Math.floor(squirrel3(id + 5) / INTMAX32 * 2); // base is 20 ish?
randomFloat += Math.floor(squirrel3(id + 6) / INTMAX32 * 3); // base is 20 ish?
resourceAmount = randomFloat + 3;
}
return {
id,
resourceAmount,
resourceModifier,
resourceType
};
}
export function multiplyColor(color1: number, color2: number): number {
let reds = [color1 & 0xFF0000, color2 & 0xFF0000];
let blues = [color1 & 0x0000FF, color2 & 0x0000FF];
let greens = [color1 & 0x00FF00, color2 & 0x00FF00];
let out = Math.round(reds[0] / (0x010000) * reds[1] / (0xFFFFFF)) * 0x010000;
out += Math.round(greens[0] / 0x000100 * greens[1] / 0x00FF00) * 0x000100;
out += Math.round(blues[0] * blues[1] / 0x0000FF);
return out;
let baseColor: number = 0;
switch (props.pointNodeGen.resourceType) {
case ResourceType.Nothing:
baseColor = 0x99bbff; // blue that mixes in with bg
break;
case ResourceType.Mana0:
baseColor = 0xeeaaaa; // red
break;
case ResourceType.Mana1:
baseColor = 0xbb7733; // brown?
break;
case ResourceType.Mana2:
baseColor = 0x44aa44; // green
break;
}
this.container.tint = multiplyColor(baseColor, tint);