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