root.materialMiningSound root.materialFootstepSound
This commit is contained in:
parent
3a29b49bf6
commit
b311c8516b
@ -72,7 +72,6 @@ import ru.dbotthepony.kstarbound.util.ITimeSource
|
|||||||
import ru.dbotthepony.kstarbound.util.ItemStack
|
import ru.dbotthepony.kstarbound.util.ItemStack
|
||||||
import ru.dbotthepony.kstarbound.util.JVMTimeSource
|
import ru.dbotthepony.kstarbound.util.JVMTimeSource
|
||||||
import ru.dbotthepony.kstarbound.util.PathStack
|
import ru.dbotthepony.kstarbound.util.PathStack
|
||||||
import ru.dbotthepony.kstarbound.util.PausableTimeSource
|
|
||||||
import ru.dbotthepony.kstarbound.util.SBPattern
|
import ru.dbotthepony.kstarbound.util.SBPattern
|
||||||
import ru.dbotthepony.kstarbound.util.WriteOnce
|
import ru.dbotthepony.kstarbound.util.WriteOnce
|
||||||
import ru.dbotthepony.kstarbound.util.filterNotNull
|
import ru.dbotthepony.kstarbound.util.filterNotNull
|
||||||
@ -90,10 +89,8 @@ import java.util.function.BinaryOperator
|
|||||||
import java.util.function.Function
|
import java.util.function.Function
|
||||||
import java.util.function.Supplier
|
import java.util.function.Supplier
|
||||||
import java.util.stream.Collector
|
import java.util.stream.Collector
|
||||||
import kotlin.NoSuchElementException
|
|
||||||
import kotlin.collections.ArrayList
|
import kotlin.collections.ArrayList
|
||||||
import kotlin.random.Random
|
import kotlin.random.Random
|
||||||
import kotlin.random.nextInt
|
|
||||||
|
|
||||||
class Starbound : ISBFileLocator {
|
class Starbound : ISBFileLocator {
|
||||||
private val logger = LogManager.getLogger()
|
private val logger = LogManager.getLogger()
|
||||||
@ -645,6 +642,36 @@ class Starbound : ISBFileLocator {
|
|||||||
1
|
1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
state.setTableFunction("materialMiningSound", 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.miningSounds.firstOrNull())
|
||||||
|
} else {
|
||||||
|
val getMod = tileModifiers[mod] ?: throw NoSuchElementException("No such material modifier $mod")
|
||||||
|
args.push(getMod.value.miningSounds.firstOrNull() ?: mat.value.miningSounds.firstOrNull())
|
||||||
|
}
|
||||||
|
|
||||||
|
1
|
||||||
|
}
|
||||||
|
|
||||||
|
state.setTableFunction("materialFootstepSound", 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.footstepSound)
|
||||||
|
} else {
|
||||||
|
val getMod = tileModifiers[mod] ?: throw NoSuchElementException("No such material modifier $mod")
|
||||||
|
args.push(getMod.value.footstepSound ?: mat.value.footstepSound)
|
||||||
|
}
|
||||||
|
|
||||||
|
1
|
||||||
|
}
|
||||||
|
|
||||||
state.pop()
|
state.pop()
|
||||||
|
|
||||||
state.load(polyfill, "@starbound.jar!/scripts/polyfill.lua")
|
state.load(polyfill, "@starbound.jar!/scripts/polyfill.lua")
|
||||||
|
@ -18,9 +18,11 @@ data class MaterialModifier(
|
|||||||
val harvestLevel: Int = 0,
|
val harvestLevel: Int = 0,
|
||||||
val breaksWithTile: Boolean = true,
|
val breaksWithTile: Boolean = true,
|
||||||
val grass: Boolean = false,
|
val grass: Boolean = false,
|
||||||
val miningSounds: ImmutableList<String> = ImmutableList.of(),
|
|
||||||
val miningParticle: String? = null,
|
val miningParticle: String? = null,
|
||||||
|
|
||||||
|
val footstepSound: String? = null,
|
||||||
|
val miningSounds: ImmutableList<String> = ImmutableList.of(),
|
||||||
|
|
||||||
@JsonPropertyConfig(isFlat = true)
|
@JsonPropertyConfig(isFlat = true)
|
||||||
val descriptionData: ThingDescription,
|
val descriptionData: ThingDescription,
|
||||||
|
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package ru.dbotthepony.kstarbound.defs.tile
|
package ru.dbotthepony.kstarbound.defs.tile
|
||||||
|
|
||||||
|
import com.google.common.collect.ImmutableList
|
||||||
import com.google.gson.GsonBuilder
|
import com.google.gson.GsonBuilder
|
||||||
import ru.dbotthepony.kstarbound.defs.AssetReference
|
import ru.dbotthepony.kstarbound.defs.AssetReference
|
||||||
import ru.dbotthepony.kstarbound.defs.IThingWithDescription
|
import ru.dbotthepony.kstarbound.defs.IThingWithDescription
|
||||||
@ -17,6 +18,7 @@ data class TileDefinition(
|
|||||||
val particleColor: Color? = null,
|
val particleColor: Color? = null,
|
||||||
val itemDrop: String? = null,
|
val itemDrop: String? = null,
|
||||||
val footstepSound: String? = null,
|
val footstepSound: String? = null,
|
||||||
|
val miningSounds: ImmutableList<String> = ImmutableList.of(),
|
||||||
|
|
||||||
val blocksLiquidFlow: Boolean = true,
|
val blocksLiquidFlow: Boolean = true,
|
||||||
val soil: Boolean = false,
|
val soil: Boolean = false,
|
||||||
|
Loading…
Reference in New Issue
Block a user