mirror of
https://github.com/curioustorvald/Terrarum.git
synced 2026-06-12 11:34:05 +09:00
fix: punching tree would do nothing
This commit is contained in:
@@ -93,6 +93,7 @@ class MixerTrackProcessor(val bufferSize: Int, val rate: Int, val track: Terraru
|
|||||||
// fetch deviceBufferSize amount of sample from the disk
|
// fetch deviceBufferSize amount of sample from the disk
|
||||||
if (track.trackType != TrackType.MASTER && track.trackType != TrackType.BUS && track.streamPlaying) {
|
if (track.trackType != TrackType.MASTER && track.trackType != TrackType.BUS && track.streamPlaying) {
|
||||||
streamBuf.fetchBytes {
|
streamBuf.fetchBytes {
|
||||||
|
// FIXME THIS IS NOT THREAD SAFE: trying to play different audio too fast too much, shits happen
|
||||||
val bytesRead = track.currentTrack?.gdxMusic?.forceInvoke<Int>("read", arrayOf(it))
|
val bytesRead = track.currentTrack?.gdxMusic?.forceInvoke<Int>("read", arrayOf(it))
|
||||||
if (bytesRead == null || bytesRead <= 0) { // some class (namely Mp3) may return 0 instead of negative value
|
if (bytesRead == null || bytesRead <= 0) { // some class (namely Mp3) may return 0 instead of negative value
|
||||||
// printdbg("Finished reading audio stream")
|
// printdbg("Finished reading audio stream")
|
||||||
|
|||||||
@@ -2028,8 +2028,8 @@ open class ActorWithBody : Actor {
|
|||||||
val feetTiles = getFeetTiles()
|
val feetTiles = getFeetTiles()
|
||||||
|
|
||||||
if (collisionDamage > 1.0 / 1024.0) {
|
if (collisionDamage > 1.0 / 1024.0) {
|
||||||
printdbg(this, "Collision damage: $collisionDamage N, count: $particleCount, velocity: $vecSum, mass: ${this.mass}")
|
// printdbg(this, "Collision damage: $collisionDamage N, count: $particleCount, velocity: $vecSum, mass: ${this.mass}")
|
||||||
printdbg(this, "feetTileCount = ${feetTiles.size}")
|
// printdbg(this, "feetTileCount = ${feetTiles.size}")
|
||||||
val feetTileIndices = (feetTiles.indices).toList().toIntArray()
|
val feetTileIndices = (feetTiles.indices).toList().toIntArray()
|
||||||
|
|
||||||
for (i in 0 until trueParticleCount) {
|
for (i in 0 until trueParticleCount) {
|
||||||
@@ -2057,7 +2057,7 @@ open class ActorWithBody : Actor {
|
|||||||
Terrarum.audioCodex.getRandomFootstep(mat)?.let {
|
Terrarum.audioCodex.getRandomFootstep(mat)?.let {
|
||||||
val vol = volumeMax * (cnt / feetTileCnt)
|
val vol = volumeMax * (cnt / feetTileCnt)
|
||||||
startAudio(it, vol)
|
startAudio(it, vol)
|
||||||
printdbg(this, "Playing footstep $mat (vol: $vol, file: ${it.file.name}, cd: $collisionDamage)")
|
// printdbg(this, "Playing footstep $mat (vol: $vol, file: ${it.file.name}, cd: $collisionDamage)")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -22,11 +22,11 @@ object Calculate {
|
|||||||
* TODO Newtons as unit?
|
* TODO Newtons as unit?
|
||||||
*/
|
*/
|
||||||
@JvmStatic fun pickaxePower(actor: ActorWithBody, material: Material?): Float {
|
@JvmStatic fun pickaxePower(actor: ActorWithBody, material: Material?): Float {
|
||||||
return (4.0 * (material?.forceMod?.toDouble() ?: 0.0) * (actor.avStrength / 1000.0)).toFloat()
|
return (4.0 * (material?.forceMod?.toDouble() ?: 0.15) * (actor.avStrength / 1000.0)).toFloat()
|
||||||
}
|
}
|
||||||
|
|
||||||
@JvmStatic fun hatchetPower(actor: ActorWithBody, material: Material?): Float {
|
@JvmStatic fun hatchetPower(actor: ActorWithBody, material: Material?): Float {
|
||||||
return (1.0 * (material?.forceMod?.toDouble() ?: 0.0) * (actor.avStrength / 1000.0)).toFloat()
|
return (1.0 * (material?.forceMod?.toDouble() ?: 0.15) * (actor.avStrength / 1000.0)).toFloat()
|
||||||
}
|
}
|
||||||
|
|
||||||
private val fallDamageDampenMult = (32.0 / 1176.0).sqr()
|
private val fallDamageDampenMult = (32.0 / 1176.0).sqr()
|
||||||
|
|||||||
Reference in New Issue
Block a user