IThingWithDescription в тайлах и их модиферах
This commit is contained in:
parent
7309f6be46
commit
b212ef7518
@ -72,8 +72,8 @@ interface IThingWithDescription {
|
|||||||
}
|
}
|
||||||
|
|
||||||
data class ThingDescription(
|
data class ThingDescription(
|
||||||
override val shortdescription: String,
|
override val shortdescription: String = "...",
|
||||||
override val description: String,
|
override val description: String = "...",
|
||||||
override val racialDescription: Map<String, String>,
|
override val racialDescription: Map<String, String>,
|
||||||
override val racialShortDescription: Map<String, String>,
|
override val racialShortDescription: Map<String, String>,
|
||||||
) : IThingWithDescription {
|
) : IThingWithDescription {
|
||||||
|
@ -3,24 +3,30 @@ package ru.dbotthepony.kstarbound.defs.tile
|
|||||||
import com.google.common.collect.ImmutableList
|
import com.google.common.collect.ImmutableList
|
||||||
import com.google.gson.GsonBuilder
|
import com.google.gson.GsonBuilder
|
||||||
import ru.dbotthepony.kstarbound.defs.AssetReference
|
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.FactoryAdapter
|
||||||
import ru.dbotthepony.kstarbound.io.json.builder.JsonFactory
|
import ru.dbotthepony.kstarbound.io.json.builder.JsonFactory
|
||||||
|
import ru.dbotthepony.kstarbound.io.json.builder.JsonPropertyConfig
|
||||||
|
|
||||||
@JsonFactory
|
@JsonFactory
|
||||||
data class MaterialModifier(
|
data class MaterialModifier(
|
||||||
val modId: Int,
|
val modId: Int,
|
||||||
val modName: String,
|
val modName: String,
|
||||||
val itemDrop: String? = null,
|
val itemDrop: String? = null,
|
||||||
val description: String = "...",
|
|
||||||
val health: Int = 0,
|
val health: Int = 0,
|
||||||
val harvestLevel: Int = 0,
|
val harvestLevel: Int = 0,
|
||||||
val breaksWithTile: Boolean = true,
|
val breaksWithTile: Boolean = true,
|
||||||
val grass: Boolean = false,
|
val grass: Boolean = false,
|
||||||
val miningSounds: ImmutableList<String> = ImmutableList.of(),
|
val miningSounds: ImmutableList<String> = ImmutableList.of(),
|
||||||
val miningParticle: String? = null,
|
val miningParticle: String? = null,
|
||||||
|
|
||||||
|
@JsonPropertyConfig(isFlat = true)
|
||||||
|
val descriptionData: ThingDescription,
|
||||||
|
|
||||||
override val renderTemplate: AssetReference<RenderTemplate>,
|
override val renderTemplate: AssetReference<RenderTemplate>,
|
||||||
override val renderParameters: RenderParameters
|
override val renderParameters: RenderParameters
|
||||||
) : IRenderableTile {
|
) : IRenderableTile, IThingWithDescription by descriptionData {
|
||||||
init {
|
init {
|
||||||
require(modId > 0) { "Invalid material modifier ID $modId" }
|
require(modId > 0) { "Invalid material modifier ID $modId" }
|
||||||
}
|
}
|
||||||
|
@ -2,8 +2,11 @@ package ru.dbotthepony.kstarbound.defs.tile
|
|||||||
|
|
||||||
import com.google.gson.GsonBuilder
|
import com.google.gson.GsonBuilder
|
||||||
import ru.dbotthepony.kstarbound.defs.AssetReference
|
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.FactoryAdapter
|
||||||
import ru.dbotthepony.kstarbound.io.json.builder.JsonFactory
|
import ru.dbotthepony.kstarbound.io.json.builder.JsonFactory
|
||||||
|
import ru.dbotthepony.kstarbound.io.json.builder.JsonPropertyConfig
|
||||||
import ru.dbotthepony.kstarbound.registerTypeAdapter
|
import ru.dbotthepony.kstarbound.registerTypeAdapter
|
||||||
import ru.dbotthepony.kvector.vector.Color
|
import ru.dbotthepony.kvector.vector.Color
|
||||||
|
|
||||||
@ -13,8 +16,6 @@ data class TileDefinition(
|
|||||||
val materialName: String,
|
val materialName: String,
|
||||||
val particleColor: Color? = null,
|
val particleColor: Color? = null,
|
||||||
val itemDrop: String? = null,
|
val itemDrop: String? = null,
|
||||||
val description: String = "...",
|
|
||||||
val shortdescription: String = "...",
|
|
||||||
val footstepSound: String? = null,
|
val footstepSound: String? = null,
|
||||||
|
|
||||||
val blocksLiquidFlow: Boolean = true,
|
val blocksLiquidFlow: Boolean = true,
|
||||||
@ -23,6 +24,9 @@ data class TileDefinition(
|
|||||||
val health: Double = 0.0,
|
val health: Double = 0.0,
|
||||||
val category: String,
|
val category: String,
|
||||||
|
|
||||||
|
@JsonPropertyConfig(isFlat = true)
|
||||||
|
val descriptionData: ThingDescription,
|
||||||
|
|
||||||
override val renderTemplate: AssetReference<RenderTemplate>,
|
override val renderTemplate: AssetReference<RenderTemplate>,
|
||||||
override val renderParameters: RenderParameters,
|
override val renderParameters: RenderParameters,
|
||||||
) : IRenderableTile
|
) : IRenderableTile, IThingWithDescription by descriptionData
|
||||||
|
Loading…
Reference in New Issue
Block a user