From b212ef7518ef7b6b44f3b20a595333a0109a923f Mon Sep 17 00:00:00 2001 From: DBotThePony Date: Sun, 5 Feb 2023 22:45:49 +0700 Subject: [PATCH] =?UTF-8?q?IThingWithDescription=20=D0=B2=20=D1=82=D0=B0?= =?UTF-8?q?=D0=B9=D0=BB=D0=B0=D1=85=20=D0=B8=20=D0=B8=D1=85=20=D0=BC=D0=BE?= =?UTF-8?q?=D0=B4=D0=B8=D1=84=D0=B5=D1=80=D0=B0=D1=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../kstarbound/defs/IThingWithDescription.kt | 4 ++-- .../kstarbound/defs/tile/MaterialModifier.kt | 10 ++++++++-- .../dbotthepony/kstarbound/defs/tile/TileDefinition.kt | 10 +++++++--- 3 files changed, 17 insertions(+), 7 deletions(-) diff --git a/src/main/kotlin/ru/dbotthepony/kstarbound/defs/IThingWithDescription.kt b/src/main/kotlin/ru/dbotthepony/kstarbound/defs/IThingWithDescription.kt index 68e09f60..dd643e1e 100644 --- a/src/main/kotlin/ru/dbotthepony/kstarbound/defs/IThingWithDescription.kt +++ b/src/main/kotlin/ru/dbotthepony/kstarbound/defs/IThingWithDescription.kt @@ -72,8 +72,8 @@ interface IThingWithDescription { } data class ThingDescription( - override val shortdescription: String, - override val description: String, + override val shortdescription: String = "...", + override val description: String = "...", override val racialDescription: Map, override val racialShortDescription: Map, ) : IThingWithDescription { diff --git a/src/main/kotlin/ru/dbotthepony/kstarbound/defs/tile/MaterialModifier.kt b/src/main/kotlin/ru/dbotthepony/kstarbound/defs/tile/MaterialModifier.kt index 117a33f5..d484321d 100644 --- a/src/main/kotlin/ru/dbotthepony/kstarbound/defs/tile/MaterialModifier.kt +++ b/src/main/kotlin/ru/dbotthepony/kstarbound/defs/tile/MaterialModifier.kt @@ -3,24 +3,30 @@ package ru.dbotthepony.kstarbound.defs.tile import com.google.common.collect.ImmutableList import com.google.gson.GsonBuilder import ru.dbotthepony.kstarbound.defs.AssetReference +import ru.dbotthepony.kstarbound.defs.IThingWithDescription +import ru.dbotthepony.kstarbound.defs.ThingDescription import ru.dbotthepony.kstarbound.io.json.builder.FactoryAdapter import ru.dbotthepony.kstarbound.io.json.builder.JsonFactory +import ru.dbotthepony.kstarbound.io.json.builder.JsonPropertyConfig @JsonFactory data class MaterialModifier( val modId: Int, val modName: String, val itemDrop: String? = null, - val description: String = "...", val health: Int = 0, val harvestLevel: Int = 0, val breaksWithTile: Boolean = true, val grass: Boolean = false, val miningSounds: ImmutableList = ImmutableList.of(), val miningParticle: String? = null, + + @JsonPropertyConfig(isFlat = true) + val descriptionData: ThingDescription, + override val renderTemplate: AssetReference, override val renderParameters: RenderParameters -) : IRenderableTile { +) : IRenderableTile, IThingWithDescription by descriptionData { init { require(modId > 0) { "Invalid material modifier ID $modId" } } diff --git a/src/main/kotlin/ru/dbotthepony/kstarbound/defs/tile/TileDefinition.kt b/src/main/kotlin/ru/dbotthepony/kstarbound/defs/tile/TileDefinition.kt index b2c2d32f..5d278533 100644 --- a/src/main/kotlin/ru/dbotthepony/kstarbound/defs/tile/TileDefinition.kt +++ b/src/main/kotlin/ru/dbotthepony/kstarbound/defs/tile/TileDefinition.kt @@ -2,8 +2,11 @@ package ru.dbotthepony.kstarbound.defs.tile import com.google.gson.GsonBuilder import ru.dbotthepony.kstarbound.defs.AssetReference +import ru.dbotthepony.kstarbound.defs.IThingWithDescription +import ru.dbotthepony.kstarbound.defs.ThingDescription import ru.dbotthepony.kstarbound.io.json.builder.FactoryAdapter import ru.dbotthepony.kstarbound.io.json.builder.JsonFactory +import ru.dbotthepony.kstarbound.io.json.builder.JsonPropertyConfig import ru.dbotthepony.kstarbound.registerTypeAdapter import ru.dbotthepony.kvector.vector.Color @@ -13,8 +16,6 @@ data class TileDefinition( val materialName: String, val particleColor: Color? = null, val itemDrop: String? = null, - val description: String = "...", - val shortdescription: String = "...", val footstepSound: String? = null, val blocksLiquidFlow: Boolean = true, @@ -23,6 +24,9 @@ data class TileDefinition( val health: Double = 0.0, val category: String, + @JsonPropertyConfig(isFlat = true) + val descriptionData: ThingDescription, + override val renderTemplate: AssetReference, override val renderParameters: RenderParameters, -) : IRenderableTile +) : IRenderableTile, IThingWithDescription by descriptionData