52 lines
1.4 KiB
Kotlin
52 lines
1.4 KiB
Kotlin
package ru.dbotthepony.kstarbound.defs.tile
|
|
|
|
import com.google.gson.GsonBuilder
|
|
import ru.dbotthepony.kstarbound.io.json.KConcreteTypeAdapter
|
|
import ru.dbotthepony.kstarbound.registerTypeAdapter
|
|
import ru.dbotthepony.kvector.vector.Color
|
|
|
|
data class TileDefinition(
|
|
val materialId: Int,
|
|
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,
|
|
val soil: Boolean = false,
|
|
|
|
val health: Double = 0.0,
|
|
val category: String,
|
|
|
|
override val renderTemplate: RenderTemplate,
|
|
override val renderParameters: RenderParameters,
|
|
) : IRenderableTile {
|
|
companion object {
|
|
val ADAPTER = KConcreteTypeAdapter.Builder(TileDefinition::class)
|
|
.auto(
|
|
TileDefinition::materialId,
|
|
TileDefinition::materialName,
|
|
TileDefinition::particleColor,
|
|
TileDefinition::itemDrop,
|
|
TileDefinition::description,
|
|
TileDefinition::shortdescription,
|
|
TileDefinition::footstepSound,
|
|
TileDefinition::blocksLiquidFlow,
|
|
TileDefinition::soil,
|
|
TileDefinition::health,
|
|
TileDefinition::category
|
|
)
|
|
.plain(TileDefinition::renderTemplate, RenderTemplate.CACHE)
|
|
.auto(
|
|
TileDefinition::renderParameters,
|
|
)
|
|
.build()
|
|
|
|
fun registerGson(gsonBuilder: GsonBuilder) {
|
|
gsonBuilder.registerTypeAdapter(ADAPTER)
|
|
}
|
|
}
|
|
}
|