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