mirror of
https://github.com/thepaperpilot/Planar-Pioneers.git
synced 2024-11-22 00:21:31 +00:00
Drag portal to portal generator to copy tier + influences
This commit is contained in:
parent
8dfc9149d9
commit
7c28de797a
1 changed files with 19 additions and 1 deletions
|
@ -455,6 +455,11 @@ export const portalGenerator = {
|
|||
text: "Add influence",
|
||||
color: "var(--accent2)"
|
||||
};
|
||||
} else if (draggingNode?.type === "portal") {
|
||||
const portal = layers[
|
||||
(draggingNode.state as unknown as PortalState).id
|
||||
] as GenericPlane;
|
||||
return { text: `Copy tier/influences from ${portal.name}` };
|
||||
}
|
||||
return null;
|
||||
},
|
||||
|
@ -534,7 +539,11 @@ export const portalGenerator = {
|
|||
}
|
||||
],
|
||||
canAccept(node, otherNode) {
|
||||
return otherNode.type === "resource" || otherNode.type === "influence";
|
||||
return (
|
||||
otherNode.type === "resource" ||
|
||||
otherNode.type === "influence" ||
|
||||
otherNode.type === "portal"
|
||||
);
|
||||
},
|
||||
onDrop(node, otherNode) {
|
||||
if (otherNode.type === "resource") {
|
||||
|
@ -558,6 +567,15 @@ export const portalGenerator = {
|
|||
influences: [...currentInfluences, droppedInfluence]
|
||||
};
|
||||
}
|
||||
} else if (otherNode.type === "portal") {
|
||||
const portal = layers[(otherNode.state as unknown as PortalState).id] as GenericPlane;
|
||||
node.state = {
|
||||
...(node.state as object),
|
||||
tier: portal.tier.value,
|
||||
influences: (portal.influences.value as unknown as InfluenceState[]).map(
|
||||
influence => influence.type
|
||||
)
|
||||
};
|
||||
}
|
||||
main.board.selectedNode.value = node;
|
||||
},
|
||||
|
|
Loading…
Reference in a new issue