PWXZFCENNLWYEKNPRXSV3FC7VSARURBC6JECKGJCCZC6YP3PN2DQC
ZDAABIZI6MPCP5DPGUN24XLSWIKQQ6LYMKIH67ORLUSFUVS5AJ5AC
4CQWVYQVUFXWUZBVLT7X7YW6TVIUHAGABPLXZTC66WNQQP5BOREAC
3UFL673QX2JG7KHTAM7DFH4BBYVHDNMXBS2RW45G3JBNFZFLSRRQC
TWWXXFP7B7ESYFOB5BOLLUSYTVPBDW33SISI4HZINYZ7ODRKPMPQC
IZUPWMKDP7DYVZT4LI6WA4X2KGSLZ4GPVAYKDDNJUMRJ6AVZJLAAC
DDJJXZKSQLXUXIMLKMKHY75JKC2IRA2A7SEVSUNL5FSCFH77T4IAC
MFKZYXV3EZAQCPNCFKCK5DM3O66CEGWYEUM6HZ2I2PMGVE73EYZAC
CZPLX4O4R7K3TF3NSAL5PT7NO3CUOLDY3OR332GBIYYNKMZTW24AC
NXFHSO7QRL6QWEPDEK4E25UIYLH2HQX4BDWA5IHXSZQCGM6LV2YAC
for (let [chunkCoord, chunkGen] of props.zLevelGen?.chunks?.entries() || []) {
const chunkRef = new ChunkRef({
z: props.z,
chunkCoord,
chunkId: chunkGen.id,
});
this.updateChildren(props);
let allocatedPointNodeSubset = new HashSet(
props.allocatedPointNodeSubset.values()
.filter((pointNodeRef) => {
return pointNodeRef.chunkCoord.x === chunkRef.chunkCoord.x &&
pointNodeRef.chunkCoord.y === chunkRef.chunkCoord.y;
})
);
let childProps = {
delta: props.delta,
args: {
pointNodeTexture: props.args.pointNodeTexture,
},
selfChunkRef: chunkRef,
updaters: props.updaters,
position: chunkRef.chunkCoord.multiply(RenderedChunkConstants.CHUNK_SPACING_PX),
chunkGen: chunkGen,
selectedPointNode: props.selectedPointNode,
allocatedPointNodeSubset,
}
const childComponent = new ChunkComponent(childProps);
this.children.put(chunkRef, childComponent);
this.container.addChild(childComponent.container);
}
public update(props: Props) {
let staleState = { ... this.state };
this.updateSelf(props)
if (!this.shouldUpdate(this.staleProps, props)) { return; }
let childrenToDelete = this.children.clone();
doChild(props: Props, chunkCoord: Vector2, chunkGen: ChunkGen): { childKey: ChunkRef, childProps: ChunkComponentProps } {
const chunkRef = new ChunkRef({
z: props.z,
chunkCoord,
chunkId: chunkGen.id,
});
let allocatedPointNodeSubset = new HashSet(
props.allocatedPointNodeSubset.values()
.filter((pointNodeRef) => {
return pointNodeRef.chunkCoord.x === chunkRef.chunkCoord.x &&
pointNodeRef.chunkCoord.y === chunkRef.chunkCoord.y;
})
);
let childProps = {
delta: props.delta,
args: {
pointNodeTexture: props.args.pointNodeTexture,
},
selfChunkRef: chunkRef,
updaters: props.updaters,
position: chunkRef.chunkCoord.multiply(RenderedChunkConstants.CHUNK_SPACING_PX),
chunkGen: chunkGen,
selectedPointNode: props.selectedPointNode,
allocatedPointNodeSubset,
}
return {
childKey: chunkRef,
childProps
};
}
updateChildren(props: Props) {
let childrenToDelete = this.children.clone(); // track which children need to be destroyed according to new props
const chunkRef = new ChunkRef({
z: props.z,
chunkCoord,
chunkId: chunkGen.id,
});
let allocatedPointNodeSubset = new HashSet(
props.allocatedPointNodeSubset.values()
.filter((pointNodeRef) => {
return pointNodeRef.chunkCoord.x === chunkRef.chunkCoord.x &&
pointNodeRef.chunkCoord.y === chunkRef.chunkCoord.y;
})
);
let childProps = {
delta: props.delta,
args: {
pointNodeTexture: props.args.pointNodeTexture,
},
selfChunkRef: chunkRef,
updaters: props.updaters,
position: chunkRef.chunkCoord.multiply(RenderedChunkConstants.CHUNK_SPACING_PX),
chunkGen: chunkGen,
selectedPointNode: props.selectedPointNode,
allocatedPointNodeSubset,
}
let childComponent = this.children.get(chunkRef);
const { childKey, childProps } = this.doChild(props, chunkCoord, chunkGen);
let childComponent = this.children.get(childKey);