root.materialHealth
This commit is contained in:
parent
b311c8516b
commit
11d73a6fd5
src/main/kotlin/ru/dbotthepony/kstarbound
@ -672,6 +672,21 @@ class Starbound : ISBFileLocator {
|
|||||||
1
|
1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
state.setTableFunction("materialHealth", this) { args ->
|
||||||
|
val name = args.getString()
|
||||||
|
val mod = if (args.hasSomethingAt()) args.getString() else null
|
||||||
|
val mat = tiles[name] ?: throw NoSuchElementException("No such material $name")
|
||||||
|
|
||||||
|
if (mod == null) {
|
||||||
|
args.push(mat.value.health)
|
||||||
|
} else {
|
||||||
|
val getMod = tileModifiers[mod] ?: throw NoSuchElementException("No such material modifier $mod")
|
||||||
|
args.push(getMod.value.health + mat.value.health)
|
||||||
|
}
|
||||||
|
|
||||||
|
1
|
||||||
|
}
|
||||||
|
|
||||||
state.pop()
|
state.pop()
|
||||||
|
|
||||||
state.load(polyfill, "@starbound.jar!/scripts/polyfill.lua")
|
state.load(polyfill, "@starbound.jar!/scripts/polyfill.lua")
|
||||||
|
@ -14,8 +14,8 @@ data class MaterialModifier(
|
|||||||
val modId: Int,
|
val modId: Int,
|
||||||
val modName: String,
|
val modName: String,
|
||||||
val itemDrop: String? = null,
|
val itemDrop: String? = null,
|
||||||
val health: Int = 0,
|
val health: Double = 0.0,
|
||||||
val harvestLevel: Int = 0,
|
val harvestLevel: Double = 0.0,
|
||||||
val breaksWithTile: Boolean = true,
|
val breaksWithTile: Boolean = true,
|
||||||
val grass: Boolean = false,
|
val grass: Boolean = false,
|
||||||
val miningParticle: String? = null,
|
val miningParticle: String? = null,
|
||||||
|
Loading…
Reference in New Issue
Block a user