fix: punching tree would do nothing

This commit is contained in:
minjaesong
2023-12-03 00:28:06 +09:00
parent cba8d90321
commit 0edd248194
3 changed files with 6 additions and 5 deletions

View File

@@ -93,6 +93,7 @@ class MixerTrackProcessor(val bufferSize: Int, val rate: Int, val track: Terraru
// fetch deviceBufferSize amount of sample from the disk
if (track.trackType != TrackType.MASTER && track.trackType != TrackType.BUS && track.streamPlaying) {
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))
if (bytesRead == null || bytesRead <= 0) { // some class (namely Mp3) may return 0 instead of negative value
// printdbg("Finished reading audio stream")

View File

@@ -2028,8 +2028,8 @@ open class ActorWithBody : Actor {
val feetTiles = getFeetTiles()
if (collisionDamage > 1.0 / 1024.0) {
printdbg(this, "Collision damage: $collisionDamage N, count: $particleCount, velocity: $vecSum, mass: ${this.mass}")
printdbg(this, "feetTileCount = ${feetTiles.size}")
// printdbg(this, "Collision damage: $collisionDamage N, count: $particleCount, velocity: $vecSum, mass: ${this.mass}")
// printdbg(this, "feetTileCount = ${feetTiles.size}")
val feetTileIndices = (feetTiles.indices).toList().toIntArray()
for (i in 0 until trueParticleCount) {
@@ -2057,7 +2057,7 @@ open class ActorWithBody : Actor {
Terrarum.audioCodex.getRandomFootstep(mat)?.let {
val vol = volumeMax * (cnt / feetTileCnt)
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)")
}
}
}

View File

@@ -22,11 +22,11 @@ object Calculate {
* TODO Newtons as unit?
*/
@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 {
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()