Skip to content

Commit

Permalink
fix: ReEmitEvent incorrectly setting event type
Browse files Browse the repository at this point in the history
chore: Use setup gradle action
  • Loading branch information
0ffz committed Jul 21, 2024
1 parent 539aff6 commit 77241ee
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 5 deletions.
6 changes: 4 additions & 2 deletions .github/workflows/gradle-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,9 @@ jobs:
with:
distribution: temurin
java-version: 21
cache: gradle

- name: Setup Gradle
uses: gradle/actions/setup-gradle@v3

- name: Build
run: gradle build
run: ./gradlew build
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,11 @@ class EventBind(
@Transient
val emitEvents = emit.flatMap { emitter ->
emitter.map { component ->
if (using != null) ReEmitEvent(SerializableComponentId(using.id), component) else component
if (using != null) ReEmitEvent(
SerializableComponentId(using.id),
componentId(component::class),
component,
) else component
}
}.map { CachedEvent(componentId(it::class), it) }
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
package com.mineinabyss.geary.prefabs.configuration.components

import com.mineinabyss.geary.datatypes.ComponentId

data class ReEmitEvent(
val findByRelationKind: SerializableComponentId,
val dataComponentId: ComponentId,
val data: Any?,
)

Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@ import com.mineinabyss.geary.systems.builders.observeWithData
fun GearyModule.reEmitEvent() = observeWithData<ReEmitEvent>().exec {
entity.getRelationsByKind(event.findByRelationKind.id).forEach { relation ->
val entity = relation.target.toGeary()
if (entity.exists()) entity.emit(event = event.findByRelationKind.id, data = event.data)
if (entity.exists()) entity.emit(event = event.dataComponentId, data = event.data)
}
}
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
4 changes: 3 additions & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https://services.gradle.org/distributions/gradle-8.7-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.8-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists

0 comments on commit 77241ee

Please sign in to comment.