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MEFRHVDBO5QC
P55M772YOYQKCH3NKZWRGVFNULQA6K5L3SWC6M52R32QBC4VON5QC
X7IQA5I46B6EHXPBIWTPCMZR4RZQ7PSJN5IMSEHA7H6F2NWQSNSQC
PWXZFCENNLWYEKNPRXSV3FC7VSARURBC6JECKGJCCZC6YP3PN2DQC
ZDAABIZI6MPCP5DPGUN24XLSWIKQQ6LYMKIH67ORLUSFUVS5AJ5AC
for (let [pointNodeCoord, pointNodeGen] of props.chunkGen.pointNodes.entries()) {
const pointNodeRef = new PointNodeRef({
z: props.selfChunkRef.z,
chunkCoord: props.selfChunkRef.chunkCoord,
pointNodeCoord: pointNodeCoord,
pointNodeId: pointNodeGen.id
})
let childProps = {
delta: props.delta,
args: {
pointNodeTexture: props.args.pointNodeTexture,
},
selfPointNodeRef: pointNodeRef,
updaters: props.updaters,
pointNodeGen,
position: pointNodeRef.pointNodeCoord.multiply(RenderedChunkConstants.SPACING_PX),
isSelected: props.selectedPointNode?.pointNodeId === pointNodeRef.pointNodeId,
isAllocated: props.allocatedPointNodeSubset.contains(pointNodeRef),
};
let childComponent = new PointNodeComponent(childProps);
this.children.put(pointNodeRef, childComponent);
this.container.addChild(childComponent.container);
}
this.upsertChildren(props);
/** callback passed to child - since child is not a pure component, it needs to inform us of updates if otherwise we wouldnt update */
markForceUpdate = (childInstance: any) => {
this.staleProps.args.markForceUpdate(this); // mark us for update in OUR parent
if ((this._children as any[]).indexOf(childInstance) === -1) {
throw new Error(`Error, child ${childInstance} not found in ${this}`);
} else {
this.forceUpdates.push(this._children[(this._children as any[]).indexOf(childInstance)])
}
}
public update(props: Props) {
// let staleState = { ...this.state };
this.updateSelf(props)
if (!this.shouldUpdate(this.staleProps, props)) { return; }
upsertChildren(props: Props) {
let childrenToDelete = this.children.clone(); // track which children need to be destroyed according to new props
this.tooltippableArea = new TooltippableAreaComponent({
hitArea
});
this.tooltippableAreaPropsFactory = (p: Props, s: State) => {
return {
hitArea: this.hitArea
}
}
this.tooltippableArea = new TooltippableAreaComponent(this.tooltippableAreaPropsFactory(props, this.state));
/** callback passed to child - since child is not a pure component, it needs to inform us of updates if otherwise we wouldnt update */
markForceUpdate = (childInstance: any) => {
this.staleProps.args.markForceUpdate(this); // mark us for update in OUR parent
if ((this._children as any[]).indexOf(childInstance) === -1) {
throw new Error(`Error, child ${childInstance} not found in ${this}`);
} else {
this.forceUpdates.push(this._children[(this._children as any[]).indexOf(childInstance)])
}
}
if (!this.shouldUpdate(this.staleProps, props)) { return; }
if (!this.shouldUpdate(this.staleProps, props)) {
// update the chidlren that asked us to forcefully update them even though props didnt change
let forceUpdates = [...this.forceUpdates];
this.forceUpdates = [];
for (let { instance, propsFactory } of forceUpdates) {
instance._update(propsFactory(props, this.state)); // why are we even calling props factory here?? theres no point... we should just tell the child to use their own stale props, like this:
// instance._forceUpdate();
}
// no need to do anything else -- stale props has not changed
return;
}
const childProps = {
delta: 0,
args: {
pointNodeTexture: this.state.pointNodeTexture.get(),
},
z: this.state.playerCurrentZ,
updaters: props.updaters,
position: props.appSize.multiply(0.5),
zLevelGen: props.gameState.worldGen.zLevels[this.state.playerCurrentZ],
selectedPointNode: props.gameState.playerUI.selectedPointNode,
allocatedPointNodeSubset: props.gameState.playerSave.allocatedPointNodeSet,
};
this.zLevelPropsFactory = (p: Props, s: State) => {
return {
delta: p.delta,
args: {
pointNodeTexture: this.state.pointNodeTexture.get(),
markForceUpdate: this.markForceUpdate,
},
z: this.state.playerCurrentZ,
updaters: props.updaters,
position: props.appSize.multiply(0.5),
zLevelGen: props.gameState.worldGen.zLevels[this.state.playerCurrentZ],
selectedPointNode: props.gameState.playerUI.selectedPointNode,
allocatedPointNodeSubset: props.gameState.playerSave.allocatedPointNodeSet,
};
}
}
/** callback passed to child - since child is not a pure component, it needs to inform us of updates if otherwise we wouldnt update */
markForceUpdate = (childInstance: any) => {
this.staleProps.args.markForceUpdate(this); // mark us for update in OUR parent
if ((this._children as any[]).indexOf(childInstance) === -1) {
throw new Error(`Error, child ${childInstance} not found in ${this}`);
} else {
this.forceUpdates.push(this._children[(this._children as any[]).indexOf(childInstance)])
}
const childProps = {
delta: 0,
args: {
pointNodeTexture: this.state.pointNodeTexture.get(),
},
z: this.state.playerCurrentZ,
updaters: props.updaters,
position: props.appSize.multiply(0.5),
zLevelGen: props.gameState.worldGen.zLevels[this.state.playerCurrentZ],
selectedPointNode: props.gameState.playerUI.selectedPointNode,
allocatedPointNodeSubset: props.gameState.playerSave.allocatedPointNodeSet,
};
}
/** callback passed to child - since child is not a pure component, it needs to inform us of updates if otherwise we wouldnt update */
markForceUpdate = (childInstance: any) => {
this.staleProps.args.markForceUpdate(this); // mark us for update in OUR parent
if ((this._children as any[]).indexOf(childInstance) === -1) {
throw new Error(`Error, child ${childInstance} not found in ${this}`);
} else {
this.forceUpdates.push(this._children[(this._children as any[]).indexOf(childInstance)])
}
export type { Props as ZLevelComponentProps };