mirror of
https://github.com/thepaperpilot/Planar-Pioneers.git
synced 2025-04-01 13:31:07 +00:00
Fix "disconnect all" visibilities
This commit is contained in:
parent
cd9429b54a
commit
609885e8ff
2 changed files with 15 additions and 57 deletions
|
@ -25,11 +25,18 @@ export const deselectAllAction = {
|
||||||
id: "deselect",
|
id: "deselect",
|
||||||
icon: "close",
|
icon: "close",
|
||||||
tooltip: (node: BoardNode) => ({
|
tooltip: (node: BoardNode) => ({
|
||||||
text: "tools" in (node.state as object) ? "Disconnect tools" : "Disconnect resources"
|
text:
|
||||||
|
"portals" in (node.state as object)
|
||||||
|
? "Disconnect portals"
|
||||||
|
: "tools" in (node.state as object)
|
||||||
|
? "Disconnect tools"
|
||||||
|
: "Disconnect resources"
|
||||||
}),
|
}),
|
||||||
onClick(node: BoardNode) {
|
onClick(node: BoardNode) {
|
||||||
if (Array.isArray((node.state as unknown as InfluenceState)?.data)) {
|
if (Array.isArray((node.state as unknown as InfluenceState)?.data)) {
|
||||||
node.state = { ...(node.state as object), data: [] };
|
node.state = { ...(node.state as object), data: [] };
|
||||||
|
} else if ("portals" in (node.state as object)) {
|
||||||
|
node.state = { ...(node.state as object), portals: [] };
|
||||||
} else if ("resources" in (node.state as object)) {
|
} else if ("resources" in (node.state as object)) {
|
||||||
node.state = { ...(node.state as object), resources: [] };
|
node.state = { ...(node.state as object), resources: [] };
|
||||||
} else if ("tools" in (node.state as object)) {
|
} else if ("tools" in (node.state as object)) {
|
||||||
|
@ -42,6 +49,9 @@ export const deselectAllAction = {
|
||||||
if (Array.isArray((node.state as unknown as InfluenceState)?.data)) {
|
if (Array.isArray((node.state as unknown as InfluenceState)?.data)) {
|
||||||
return ((node.state as unknown as InfluenceState).data as string[]).length > 0;
|
return ((node.state as unknown as InfluenceState).data as string[]).length > 0;
|
||||||
}
|
}
|
||||||
|
if ("portals" in (node.state as object)) {
|
||||||
|
return (node.state as { portals: string[] }).portals.length > 0;
|
||||||
|
}
|
||||||
if ("resources" in (node.state as object)) {
|
if ("resources" in (node.state as object)) {
|
||||||
return (node.state as { resources: Resources[] }).resources.length > 0;
|
return (node.state as { resources: Resources[] }).resources.length > 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -652,20 +652,7 @@ export const booster = {
|
||||||
},
|
},
|
||||||
actionDistance: Math.PI / 4,
|
actionDistance: Math.PI / 4,
|
||||||
actions: [
|
actions: [
|
||||||
{
|
deselectAllAction,
|
||||||
id: "deselect",
|
|
||||||
icon: "close",
|
|
||||||
tooltip: {
|
|
||||||
text: "Disconnect portals"
|
|
||||||
},
|
|
||||||
onClick(node: BoardNode) {
|
|
||||||
node.state = { ...(node.state as object), portals: [] };
|
|
||||||
main.board.selectedAction.value = null;
|
|
||||||
main.board.selectedNode.value = null;
|
|
||||||
},
|
|
||||||
visibility: (node: BoardNode) =>
|
|
||||||
(node.state as unknown as BoosterState)?.portals.length ?? 0 > 0
|
|
||||||
},
|
|
||||||
getIncreaseConnectionsAction(x => x.add(6).pow_base(1000)),
|
getIncreaseConnectionsAction(x => x.add(6).pow_base(1000)),
|
||||||
{
|
{
|
||||||
id: "increaseBoost",
|
id: "increaseBoost",
|
||||||
|
@ -733,20 +720,7 @@ export const upgrader = {
|
||||||
},
|
},
|
||||||
actionDistance: Math.PI / 4,
|
actionDistance: Math.PI / 4,
|
||||||
actions: [
|
actions: [
|
||||||
{
|
deselectAllAction,
|
||||||
id: "deselect",
|
|
||||||
icon: "close",
|
|
||||||
tooltip: {
|
|
||||||
text: "Disconnect portals"
|
|
||||||
},
|
|
||||||
onClick(node: BoardNode) {
|
|
||||||
node.state = { ...(node.state as object), portals: [] };
|
|
||||||
main.board.selectedAction.value = null;
|
|
||||||
main.board.selectedNode.value = null;
|
|
||||||
},
|
|
||||||
visibility: (node: BoardNode) =>
|
|
||||||
(node.state as unknown as UpgraderState)?.portals.length ?? 0 > 0
|
|
||||||
},
|
|
||||||
getIncreaseConnectionsAction(x => x.add(4).pow_base(1e6)),
|
getIncreaseConnectionsAction(x => x.add(4).pow_base(1e6)),
|
||||||
togglePoweredAction
|
togglePoweredAction
|
||||||
],
|
],
|
||||||
|
@ -782,20 +756,7 @@ export const automator = {
|
||||||
},
|
},
|
||||||
actionDistance: Math.PI / 4,
|
actionDistance: Math.PI / 4,
|
||||||
actions: [
|
actions: [
|
||||||
{
|
deselectAllAction,
|
||||||
id: "deselect",
|
|
||||||
icon: "close",
|
|
||||||
tooltip: {
|
|
||||||
text: "Disconnect portals"
|
|
||||||
},
|
|
||||||
onClick(node: BoardNode) {
|
|
||||||
node.state = { ...(node.state as object), portals: [] };
|
|
||||||
main.board.selectedAction.value = null;
|
|
||||||
main.board.selectedNode.value = null;
|
|
||||||
},
|
|
||||||
visibility: (node: BoardNode) =>
|
|
||||||
(node.state as unknown as AutomatorState)?.portals.length ?? 0 > 0
|
|
||||||
},
|
|
||||||
getIncreaseConnectionsAction(x => x.add(4).pow_base(1e6)),
|
getIncreaseConnectionsAction(x => x.add(4).pow_base(1e6)),
|
||||||
togglePoweredAction
|
togglePoweredAction
|
||||||
],
|
],
|
||||||
|
@ -831,20 +792,7 @@ export const investments = {
|
||||||
},
|
},
|
||||||
actionDistance: Math.PI / 4,
|
actionDistance: Math.PI / 4,
|
||||||
actions: [
|
actions: [
|
||||||
{
|
deselectAllAction,
|
||||||
id: "deselect",
|
|
||||||
icon: "close",
|
|
||||||
tooltip: {
|
|
||||||
text: "Disconnect portals"
|
|
||||||
},
|
|
||||||
onClick(node: BoardNode) {
|
|
||||||
node.state = { ...(node.state as object), portals: [] };
|
|
||||||
main.board.selectedAction.value = null;
|
|
||||||
main.board.selectedNode.value = null;
|
|
||||||
},
|
|
||||||
visibility: (node: BoardNode) =>
|
|
||||||
(node.state as unknown as InvestmentsState)?.portals.length ?? 0 > 0
|
|
||||||
},
|
|
||||||
getIncreaseConnectionsAction(x => x.add(3).pow_base(1e8)),
|
getIncreaseConnectionsAction(x => x.add(3).pow_base(1e8)),
|
||||||
togglePoweredAction
|
togglePoweredAction
|
||||||
],
|
],
|
||||||
|
|
Loading…
Add table
Reference in a new issue