diff options
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni/test/graph')
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/test/graph/GraphEditor.kt | 18 | ||||
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/test/graph/GraphNodeEditor.kt | 4 |
2 files changed, 17 insertions, 5 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/test/graph/GraphEditor.kt b/src/main/java/at/hannibal2/skyhanni/test/graph/GraphEditor.kt index e724a8fe6..af5a1ea3c 100644 --- a/src/main/java/at/hannibal2/skyhanni/test/graph/GraphEditor.kt +++ b/src/main/java/at/hannibal2/skyhanni/test/graph/GraphEditor.kt @@ -260,7 +260,8 @@ object GraphEditor { } } - private fun chatAtDisable() = ChatUtils.clickableChat("Graph Editor is now inactive. §lClick to activate.", + private fun chatAtDisable() = ChatUtils.clickableChat( + "Graph Editor is now inactive. §lClick to activate.", GraphEditor::commandIn ) @@ -530,14 +531,23 @@ object GraphEditor { private fun compileGraph(): Graph { prune() val indexedTable = nodes.mapIndexed { index, node -> node.id to index }.toMap() - val nodes = nodes.mapIndexed { index, it -> GraphNode(index, it.position, it.name, it.tags.mapNotNull { it.internalName }) } + val nodes = nodes.mapIndexed { index, node -> + GraphNode( + index, + node.position, + node.name, + node.tags.map { + it.internalName + } + ) + } val neighbours = GraphEditor.nodes.map { node -> edges.filter { it.isInEdge(node) }.map { edge -> val otherNode = if (node == edge.node1) edge.node2 else edge.node1 nodes[indexedTable[otherNode.id]!!] to node.position.distance(otherNode.position) }.sortedBy { it.second } } - nodes.forEachIndexed { index, it -> it.neighbours = neighbours[index].toMap() } + nodes.forEachIndexed { index, node -> node.neighbours = neighbours[index].toMap() } return Graph(nodes) } @@ -553,7 +563,7 @@ object GraphEditor { ) }, ) - val translation = graph.mapIndexed { index, it -> it to nodes[index] }.toMap() + val translation = graph.mapIndexed { index, node -> node to nodes[index] }.toMap() edges.addAll( graph.map { node -> node.neighbours.map { GraphingEdge(translation[node]!!, translation[it.key]!!) } diff --git a/src/main/java/at/hannibal2/skyhanni/test/graph/GraphNodeEditor.kt b/src/main/java/at/hannibal2/skyhanni/test/graph/GraphNodeEditor.kt index c4f6a3896..8c16b4c67 100644 --- a/src/main/java/at/hannibal2/skyhanni/test/graph/GraphNodeEditor.kt +++ b/src/main/java/at/hannibal2/skyhanni/test/graph/GraphNodeEditor.kt @@ -179,7 +179,9 @@ object GraphNodeEditor { ) private fun drawNodeNames(): List<Searchable> = buildList { - for ((node, distance: Double) in GraphEditor.nodes.map { it to it.position.distanceSqToPlayer() }.sortedBy { it.second }) { + for ((node, distance: Double) in GraphEditor.nodes.map { + it to it.position.distanceSqToPlayer() + }.sortedBy { it.second }) { if (node.tags.isNotEmpty()) { if (!node.tags.any { it in tagsToShow }) continue } |