Skip to content

Commit

Permalink
chore: Replaced occurrences of cluster to group
Browse files Browse the repository at this point in the history
  • Loading branch information
phinner committed Nov 15, 2024
1 parent f748042 commit fa4c4bc
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 17 deletions.
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
4 changes: 2 additions & 2 deletions src/main/kotlin/com/xpdustry/nohorny/NoHornyAutoBan.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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<ImageAnalyzerEvent> { (result, cluster, _, author) ->
onEvent<ImageAnalyzerEvent> { (result, group, _, author) ->
if (result.rating == NoHornyInformation.Rating.UNSAFE &&
plugin.config.autoBan &&
author != null
Expand All @@ -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))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand All @@ -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) {
Expand All @@ -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)
Expand Down

0 comments on commit fa4c4bc

Please sign in to comment.