From e506c84a8b907a1a28563ddfc1df9aca3f9291e7 Mon Sep 17 00:00:00 2001 From: Danielle Voznyy Date: Sat, 27 Jul 2024 22:53:37 -0400 Subject: [PATCH] fix: ActionWhen serializer --- .../geary/actions/event_binds/EntityObservers.kt | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/addons/geary-actions/src/commonMain/kotlin/com/mineinabyss/geary/actions/event_binds/EntityObservers.kt b/addons/geary-actions/src/commonMain/kotlin/com/mineinabyss/geary/actions/event_binds/EntityObservers.kt index cd4b65f1..14286b36 100644 --- a/addons/geary-actions/src/commonMain/kotlin/com/mineinabyss/geary/actions/event_binds/EntityObservers.kt +++ b/addons/geary-actions/src/commonMain/kotlin/com/mineinabyss/geary/actions/event_binds/EntityObservers.kt @@ -5,6 +5,7 @@ import com.mineinabyss.geary.actions.actions.EnsureAction import com.mineinabyss.geary.serialization.serializers.InnerSerializer import com.mineinabyss.geary.serialization.serializers.SerializableComponentId import kotlinx.serialization.Serializable +import kotlinx.serialization.builtins.ListSerializer import kotlinx.serialization.builtins.MapSerializer import kotlin.jvm.JvmInline @@ -30,9 +31,15 @@ class EntityObservers( } -@JvmInline -@Serializable -value class ActionWhen(val conditions: List) +@Serializable(with = ActionWhen.Serializer::class) +class ActionWhen(val conditions: List) { + object Serializer : InnerSerializer, ActionWhen>( + serialName = "geary:when", + inner = ListSerializer(EnsureAction.serializer()), + inverseTransform = ActionWhen::conditions, + transform = ::ActionWhen + ) +} @JvmInline @Serializable