Added some actions to the factory

(Not actually usable yet until materials can be selected)
This commit is contained in:
thepaperpilot 2023-04-22 20:50:50 -05:00
parent 1ed499b720
commit 3b1ca588cf

View file

@ -174,7 +174,7 @@ export const main = createLayer("main", function (this: BaseLayer) {
title: "🛠️", title: "🛠️",
label: node => label: node =>
node === board.selectedNode.value ? { text: "Broken Forge" } : null, node === board.selectedNode.value ? { text: "Broken Forge" } : null,
actionDistance: 80, actionDistance: 100,
actions: [ actions: [
{ {
id: "repair", id: "repair",
@ -207,6 +207,45 @@ export const main = createLayer("main", function (this: BaseLayer) {
node === board.selectedNode.value node === board.selectedNode.value
? { text: hasForged.value ? "Forge" : "Forge - Drag a material to me!" } ? { text: hasForged.value ? "Forge" : "Forge - Drag a material to me!" }
: null, : null,
actionDistance: 100,
actions: [
{
id: "deselect",
icon: "",
tooltip: { text: "De-select material" },
onClick(node) {
if (board.selectedAction.value === this) {
node.state = undefined;
} else {
((board as GenericBoard).state as Persistent<BoardData>).value = {
...((board as GenericBoard).state as Persistent<BoardData>)
.value,
selectedAction: this.id
};
}
return true;
},
visibility: node => node.state != null
},
{
id: "craft",
icon: "",
tooltip: node => ({ text: "Craft unknown item" }),
onClick(node) {
if (board.selectedAction.value === this) {
// TODO create tool
} else {
((board as GenericBoard).state as Persistent<BoardData>).value = {
...((board as GenericBoard).state as Persistent<BoardData>)
.value,
selectedAction: this.id
};
}
return true;
},
visibility: node => node.state != null
}
],
draggable: true draggable: true
}, },
resource: { resource: {