From fa4c4bc9e3bf7a55ddcc2d91e73508e82bb44d4e Mon Sep 17 00:00:00 2001 From: phinner <62483793+phinner@users.noreply.github.com> Date: Fri, 15 Nov 2024 19:11:23 +0100 Subject: [PATCH] chore: Replaced occurrences of cluster to group --- README.md | 12 ++++++------ .../com/xpdustry/nohorny/NoHornyAutoBan.kt | 4 ++-- .../geometry/GroupingBlockIndexImplTest.kt | 18 +++++++++--------- 3 files changed, 17 insertions(+), 17 deletions(-) diff --git a/README.md b/README.md index f7b7d07..dfabea2 100644 --- a/README.md +++ b/README.md @@ -82,7 +82,7 @@ dependencies { } ``` -Then you will be able to intercept `ImageAnalyzerEvent`, which is posted every time a cluster of `NoHornyImage` is processed, +Then you will be able to intercept `ImageAnalyzerEvent`, which is posted every time a group of `NoHornyImage` is processed, see [NoHornyAutoBan](src/main/kotlin/com/xpdustry/nohorny/NoHornyAutoBan.kt) for an example. ## Advanced Configuration @@ -98,18 +98,18 @@ auto-ban: true processing-delay: 5s # Display tracker configuration displays: - # The minimum number of draw instructions in a logic processor to be part of a cluster + # The minimum number of draw instructions in a logic processor to be part of a group minimum-instruction-count: 100 - # The minimum number of logic processors in a cluster to be eligible for processing + # The minimum number of logic processors in a group to be eligible for processing minimum-processor-count: 5 - # The search radius of linked logic processors around a cluster of logic displays, + # The search radius of linked logic processors around a group of logic displays, # tweak depending on the average size of your server maps processor-search-radius: 10 # Canvas tracker configuration canvases: - # The minimum number of canvases in a cluster to be eligible for processing, + # The minimum number of canvases in a group to be eligible for processing, # relatively high since you a lot of canvases are needed for a clear picture - minimum-canvas-cluster-size: 9 + minimum-group-size: 9 ``` ## Building diff --git a/src/main/kotlin/com/xpdustry/nohorny/NoHornyAutoBan.kt b/src/main/kotlin/com/xpdustry/nohorny/NoHornyAutoBan.kt index 20b2528..a49ebb8 100644 --- a/src/main/kotlin/com/xpdustry/nohorny/NoHornyAutoBan.kt +++ b/src/main/kotlin/com/xpdustry/nohorny/NoHornyAutoBan.kt @@ -41,7 +41,7 @@ import mindustry.world.blocks.logic.LogicDisplay internal class NoHornyAutoBan(private val plugin: NoHornyPlugin) : NoHornyListener("Auto Ban", Dispatchers.Default) { override fun onInit() { - onEvent { (result, cluster, _, author) -> + onEvent { (result, group, _, author) -> if (result.rating == NoHornyInformation.Rating.UNSAFE && plugin.config.autoBan && author != null @@ -55,7 +55,7 @@ internal class NoHornyAutoBan(private val plugin: NoHornyPlugin) : NoHornyListen ) } } - cluster.blocks + group.blocks .asSequence() .flatMap { block -> val points = mutableListOf(ImmutablePoint(block.x, block.y)) diff --git a/src/test/kotlin/com/xpdustry/nohorny/geometry/GroupingBlockIndexImplTest.kt b/src/test/kotlin/com/xpdustry/nohorny/geometry/GroupingBlockIndexImplTest.kt index b25cd33..c4fc497 100644 --- a/src/test/kotlin/com/xpdustry/nohorny/geometry/GroupingBlockIndexImplTest.kt +++ b/src/test/kotlin/com/xpdustry/nohorny/geometry/GroupingBlockIndexImplTest.kt @@ -43,12 +43,12 @@ class GroupingBlockIndexImplTest { index.insert(1, 0, 1, Unit) Assertions.assertEquals(1, index.groups().size) - val cluster = index.groups().toList()[0] - Assertions.assertEquals(2, cluster.blocks.size) - Assertions.assertEquals(0, cluster.x) - Assertions.assertEquals(0, cluster.y) - Assertions.assertEquals(2, cluster.w) - Assertions.assertEquals(1, cluster.h) + val group = index.groups().toList()[0] + Assertions.assertEquals(2, group.blocks.size) + Assertions.assertEquals(0, group.x) + Assertions.assertEquals(0, group.y) + Assertions.assertEquals(2, group.w) + Assertions.assertEquals(1, group.h) } @Test @@ -120,7 +120,7 @@ class GroupingBlockIndexImplTest { } @Test - fun `test cluster split`() { + fun `test group split`() { val index = createIndex() for (x in 0..2) { index.insert(x, 0, 1, Unit) @@ -132,7 +132,7 @@ class GroupingBlockIndexImplTest { } @Test - fun `test cluster merge`() { + fun `test group merge`() { val index = createIndex() for (y in 0..2) { for (x in 0..2) { @@ -147,7 +147,7 @@ class GroupingBlockIndexImplTest { } @Test - fun `test cluster on same axis spaced by 1`() { + fun `test group on same axis spaced by 1`() { val index = createIndex() index.insert(0, 0, 6, Unit) index.insert(7, 0, 6, Unit)