root.itemType
This commit is contained in:
parent
9e6d54cea7
commit
59fd54499b
@ -463,6 +463,12 @@ class Starbound : ISBFileLocator {
|
||||
1
|
||||
}
|
||||
|
||||
state.setTableFunction("itemType", this) { args ->
|
||||
val name = args.getString()
|
||||
args.lua.push(items[name]?.value?.itemType ?: throw NoSuchElementException("No such item $name"))
|
||||
1
|
||||
}
|
||||
|
||||
state.pop()
|
||||
|
||||
state.load(polyfill, "@starbound.jar!/scripts/polyfill.lua")
|
||||
|
@ -7,14 +7,14 @@ import ru.dbotthepony.kstarbound.io.json.builder.JsonIgnoreProperty
|
||||
|
||||
@JsonBuilder
|
||||
abstract class ArmorItemPrototype : ItemPrototype(), IArmorItemDefinition {
|
||||
override var colorOptions: ImmutableList<Map<String, String>> by NotNull(ImmutableList.of())
|
||||
override var maleFrames: IArmorItemDefinition.Frames by NotNull()
|
||||
override var femaleFrames: IArmorItemDefinition.Frames by NotNull()
|
||||
override var level: Double by NotNull(1.0)
|
||||
override var leveledStatusEffects: ImmutableList<LeveledStatusEffect> by NotNull(ImmutableList.of())
|
||||
final override var colorOptions: ImmutableList<Map<String, String>> by NotNull(ImmutableList.of())
|
||||
final override var maleFrames: IArmorItemDefinition.Frames by NotNull()
|
||||
final override var femaleFrames: IArmorItemDefinition.Frames by NotNull()
|
||||
final override var level: Double by NotNull(1.0)
|
||||
final override var leveledStatusEffects: ImmutableList<LeveledStatusEffect> by NotNull(ImmutableList.of())
|
||||
|
||||
override var scripts: ImmutableList<DirectAssetReference> by NotNull(ImmutableList.of())
|
||||
override var scriptDelta: Int by NotNull(1)
|
||||
final override var scripts: ImmutableList<DirectAssetReference> by NotNull(ImmutableList.of())
|
||||
final override var scriptDelta: Int by NotNull(1)
|
||||
|
||||
init {
|
||||
maxStack = 1L
|
||||
@ -22,13 +22,25 @@ abstract class ArmorItemPrototype : ItemPrototype(), IArmorItemDefinition {
|
||||
}
|
||||
|
||||
@JsonBuilder
|
||||
class HeadArmorItemPrototype : ArmorItemPrototype()
|
||||
class HeadArmorItemPrototype : ArmorItemPrototype() {
|
||||
override val itemType: String
|
||||
get() = "headarmor"
|
||||
}
|
||||
|
||||
@JsonBuilder
|
||||
class ChestArmorItemPrototype : ArmorItemPrototype()
|
||||
class ChestArmorItemPrototype : ArmorItemPrototype() {
|
||||
override val itemType: String
|
||||
get() = "chestarmor"
|
||||
}
|
||||
|
||||
@JsonBuilder
|
||||
class LegsArmorItemPrototype : ArmorItemPrototype()
|
||||
class LegsArmorItemPrototype : ArmorItemPrototype() {
|
||||
override val itemType: String
|
||||
get() = "legsarmor"
|
||||
}
|
||||
|
||||
@JsonBuilder
|
||||
class BackArmorItemPrototype : ArmorItemPrototype()
|
||||
class BackArmorItemPrototype : ArmorItemPrototype() {
|
||||
override val itemType: String
|
||||
get() = "backarmor"
|
||||
}
|
||||
|
@ -10,4 +10,7 @@ interface ICurrencyItemDefinition : IItemDefinition {
|
||||
* Ценность одного предмета в [currency]
|
||||
*/
|
||||
val value: Long
|
||||
|
||||
override val itemType: String
|
||||
get() = "currency"
|
||||
}
|
||||
|
@ -109,4 +109,10 @@ interface IItemDefinition : IThingWithDescription {
|
||||
* Количество предметов ниже или равному данному значению (но не меньше [smallStackLimit]) проиграет звук [pickupSoundsMedium]
|
||||
*/
|
||||
val mediumStackLimit: Long?
|
||||
|
||||
/**
|
||||
* Тип предмета, используется Lua скриптами
|
||||
*/
|
||||
val itemType: String
|
||||
get() = "item"
|
||||
}
|
||||
|
@ -7,4 +7,7 @@ interface ILiquidItem : IItemDefinition {
|
||||
* То, какую жидкость из себя представляет данный предмет
|
||||
*/
|
||||
val liquid: Either<Int, String>
|
||||
|
||||
override val itemType: String
|
||||
get() = "liquid"
|
||||
}
|
||||
|
@ -7,4 +7,7 @@ interface IMaterialItem : IItemDefinition {
|
||||
* То, какой материал (блок) из себя представляет данный предмет
|
||||
*/
|
||||
val material: Either<Int, String>
|
||||
|
||||
override val itemType: String
|
||||
get() = "material"
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user