mirror of
https://github.com/thepaperpilot/Planar-Pioneers.git
synced 2024-11-22 00:21:31 +00:00
Added update() method to nodes
This commit is contained in:
parent
fbe4f7883f
commit
0ced1d7cd7
2 changed files with 12 additions and 2 deletions
|
@ -68,6 +68,14 @@ function updateLayers(diff: DecimalSource) {
|
|||
);
|
||||
}
|
||||
layers[layer].update?.(diff);
|
||||
if (layers[layer].boards) {
|
||||
Reflect.ownKeys(player.layers[layer].boards).forEach(board => {
|
||||
player.layers[layer].boards[board.toString()].forEach(node => {
|
||||
const nodeType = layers[layer].boards!.data[board.toString()].types[node.type];
|
||||
nodeType.update?.(node, diff);
|
||||
});
|
||||
});
|
||||
}
|
||||
});
|
||||
// Automate each active layer
|
||||
activeLayers.forEach(layer => {
|
||||
|
|
6
src/typings/features/board.d.ts
vendored
6
src/typings/features/board.d.ts
vendored
|
@ -1,3 +1,4 @@
|
|||
import { DecimalSource } from "@/lib/break_eternity";
|
||||
import { State } from "../state";
|
||||
import { Feature, RawFeature } from "./feature";
|
||||
|
||||
|
@ -41,7 +42,8 @@ export interface NodeType extends Feature {
|
|||
fillColor?: string | ((node: BoardNode) => string);
|
||||
outlineColor?: string | ((node: BoardNode) => string);
|
||||
titleColor?: string | ((node: BoardNode) => string);
|
||||
onClick: (node: BoardNode) => void;
|
||||
onDrop: (node: BoardNode, otherNode: BoardNode) => void;
|
||||
onClick?: (node: BoardNode) => void;
|
||||
onDrop?: (node: BoardNode, otherNode: BoardNode) => void;
|
||||
update?: (node: BoardNode, diff: DecimalSource) => void;
|
||||
nodes: BoardNode[];
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue