IScriptableItemDefinition

This commit is contained in:
DBotThePony 2023-01-07 12:24:59 +07:00
parent 6fa7b2193e
commit 093cec575e
Signed by: DBot
GPG Key ID: DCC23B5715498507
13 changed files with 21 additions and 16 deletions

View File

@ -15,6 +15,7 @@ data class ArmorItemDefinition(
override val consumeOnPickup: Boolean,
override val pickupQuestTemplates: List<String>,
override val scripts: List<String>,
override val scriptDelta: Int,
override val tooltipKind: ItemTooltipKind,
override val twoHanded: Boolean,
override val radioMessagesOnPickup: List<String>,

View File

@ -15,6 +15,9 @@ class ArmorItemPrototype : ItemPrototype(), IArmorItemDefinition {
override var level: Double = 1.0
override var leveledStatusEffects: List<LeveledStatusEffect> = listOf()
override var scripts: List<String> = listOf()
override var scriptDelta: Int = 1
override var armorType: ArmorPieceType by NotNullVar()
init {
@ -37,6 +40,7 @@ class ArmorItemPrototype : ItemPrototype(), IArmorItemDefinition {
consumeOnPickup = consumeOnPickup,
pickupQuestTemplates = pickupQuestTemplates,
scripts = scripts,
scriptDelta = scriptDelta,
tooltipKind = tooltipKind,
twoHanded = twoHanded,
radioMessagesOnPickup = radioMessagesOnPickup,
@ -62,6 +66,8 @@ class ArmorItemPrototype : ItemPrototype(), IArmorItemDefinition {
.auto(ArmorItemPrototype::femaleFrames)
.auto(ArmorItemPrototype::level)
.autoList(ArmorItemPrototype::leveledStatusEffects)
.autoList(ArmorItemPrototype::scripts)
.auto(ArmorItemPrototype::scriptDelta)
.build()
}
}

View File

@ -14,7 +14,6 @@ data class CurrencyItemDefinition(
override val eventCategory: String?,
override val consumeOnPickup: Boolean,
override val pickupQuestTemplates: List<String>,
override val scripts: List<String>,
override val tooltipKind: ItemTooltipKind,
override val twoHanded: Boolean,
override val radioMessagesOnPickup: List<String>,

View File

@ -32,7 +32,6 @@ class CurrencyItemPrototype : ItemPrototype(), ICurrencyItemDefinition {
eventCategory = eventCategory,
consumeOnPickup = consumeOnPickup,
pickupQuestTemplates = pickupQuestTemplates,
scripts = scripts,
tooltipKind = tooltipKind,
twoHanded = twoHanded,
radioMessagesOnPickup = radioMessagesOnPickup,

View File

@ -4,7 +4,7 @@ import ru.dbotthepony.kstarbound.Starbound
import ru.dbotthepony.kstarbound.io.json.FactoryAdapter
import ru.dbotthepony.kstarbound.io.json.ifString
interface IArmorItemDefinition : ILeveledItemDefinition {
interface IArmorItemDefinition : ILeveledItemDefinition, IScriptableItemDefinition {
/**
* @see ArmorPieceType
*/

View File

@ -78,11 +78,6 @@ interface IItemDefinition : IThingWithDescription {
*/
val pickupQuestTemplates: List<String>
/**
* Lua скрипты для выполнения
*/
val scripts: List<String>
/**
* это где либо ещё применяется кроме брони?
*/

View File

@ -0,0 +1,13 @@
package ru.dbotthepony.kstarbound.defs.item
interface IScriptableItemDefinition : IItemDefinition {
/**
* Lua скрипты для выполнения
*/
val scripts: List<String>
/**
* Через какое количество тиков вызывать обновления скриптов
*/
val scriptDelta: Int
}

View File

@ -14,7 +14,6 @@ data class ItemDefinition(
override val eventCategory: String?,
override val consumeOnPickup: Boolean,
override val pickupQuestTemplates: List<String>,
override val scripts: List<String>,
override val tooltipKind: ItemTooltipKind,
override val twoHanded: Boolean,
override val radioMessagesOnPickup: List<String>,

View File

@ -19,7 +19,6 @@ open class ItemPrototype : IItemDefinition, INativeJsonHolder {
final override var eventCategory: String? = null
final override var consumeOnPickup: Boolean = false
final override var pickupQuestTemplates: List<String> = listOf()
final override var scripts: List<String> = listOf()
final override var tooltipKind: ItemTooltipKind = ItemTooltipKind.NORMAL
final override var twoHanded: Boolean = false
final override var radioMessagesOnPickup: List<String> = listOf()
@ -46,7 +45,6 @@ open class ItemPrototype : IItemDefinition, INativeJsonHolder {
eventCategory = eventCategory,
consumeOnPickup = consumeOnPickup,
pickupQuestTemplates = pickupQuestTemplates,
scripts = scripts,
tooltipKind = tooltipKind,
twoHanded = twoHanded,
radioMessagesOnPickup = radioMessagesOnPickup,
@ -76,7 +74,6 @@ open class ItemPrototype : IItemDefinition, INativeJsonHolder {
auto(ItemPrototype::eventCategory)
auto(ItemPrototype::consumeOnPickup)
autoList(ItemPrototype::pickupQuestTemplates)
autoList(ItemPrototype::scripts)
auto(ItemPrototype::tooltipKind)
auto(ItemPrototype::twoHanded)
autoList(ItemPrototype::radioMessagesOnPickup)

View File

@ -16,7 +16,6 @@ data class LiquidItemDefinition(
override val eventCategory: String?,
override val consumeOnPickup: Boolean,
override val pickupQuestTemplates: List<String>,
override val scripts: List<String>,
override val tooltipKind: ItemTooltipKind,
override val twoHanded: Boolean,
override val radioMessagesOnPickup: List<String>,

View File

@ -33,7 +33,6 @@ class LiquidItemPrototype : ItemPrototype() {
eventCategory = eventCategory,
consumeOnPickup = consumeOnPickup,
pickupQuestTemplates = pickupQuestTemplates,
scripts = scripts,
tooltipKind = tooltipKind,
twoHanded = twoHanded,
radioMessagesOnPickup = radioMessagesOnPickup,

View File

@ -16,7 +16,6 @@ data class MaterialItemDefinition(
override val eventCategory: String?,
override val consumeOnPickup: Boolean,
override val pickupQuestTemplates: List<String>,
override val scripts: List<String>,
override val tooltipKind: ItemTooltipKind,
override val twoHanded: Boolean,
override val radioMessagesOnPickup: List<String>,

View File

@ -33,7 +33,6 @@ class MaterialItemPrototype : ItemPrototype() {
eventCategory = eventCategory,
consumeOnPickup = consumeOnPickup,
pickupQuestTemplates = pickupQuestTemplates,
scripts = scripts,
tooltipKind = tooltipKind,
twoHanded = twoHanded,
radioMessagesOnPickup = radioMessagesOnPickup,