diff --git a/assets/mods/basegame/audio/effects/accessibility/pickaxe_valuable.ogg b/assets/mods/basegame/audio/effects/accessibility/pickaxe_valuable.ogg new file mode 100644 index 000000000..c3e4d5ea7 --- /dev/null +++ b/assets/mods/basegame/audio/effects/accessibility/pickaxe_valuable.ogg @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:a5a5565f3a5bf177193cb3818eca6359fdeba5a28931d4ffb963eeb3ab9a5815 +size 6119 diff --git a/src/net/torvald/terrarum/CreditSingleton.kt b/src/net/torvald/terrarum/CreditSingleton.kt index f54b5bdda..05a0bb61b 100644 --- a/src/net/torvald/terrarum/CreditSingleton.kt +++ b/src/net/torvald/terrarum/CreditSingleton.kt @@ -337,6 +337,9 @@ Sound from ℗ 2012, 2015 j1987 and ScouseMouseJB Sound from and + - effects/accessibility/pickaxe_valuable.ogg +℗ 2009 Benboncan +Sound from $BULLET Impulse Responses: diff --git a/src/net/torvald/terrarum/TerrarumAppConfiguration.kt b/src/net/torvald/terrarum/TerrarumAppConfiguration.kt index 2029be238..f514cdd28 100644 --- a/src/net/torvald/terrarum/TerrarumAppConfiguration.kt +++ b/src/net/torvald/terrarum/TerrarumAppConfiguration.kt @@ -69,7 +69,7 @@ basegame * e.g. 0x02010034 will be translated as 2.1.52 * */ - const val VERSION_RAW: Long = 0x0000_000004_000002 + const val VERSION_RAW: Long = 0x0000_000004_000003 // Commit counts up to the Release 0.3.0: 2259 // Commit counts up to the Release 0.3.1: 2278 // Commit counts up to the Release 0.3.2: 2732 diff --git a/src/net/torvald/terrarum/modulebasegame/gameitems/PickaxeGeneric.kt b/src/net/torvald/terrarum/modulebasegame/gameitems/PickaxeGeneric.kt index 2faceab25..5fb18f647 100644 --- a/src/net/torvald/terrarum/modulebasegame/gameitems/PickaxeGeneric.kt +++ b/src/net/torvald/terrarum/modulebasegame/gameitems/PickaxeGeneric.kt @@ -5,6 +5,7 @@ import com.badlogic.gdx.graphics.g2d.TextureRegion import net.torvald.terrarum.* import net.torvald.terrarum.TerrarumAppConfiguration.TILE_SIZE import net.torvald.terrarum.TerrarumAppConfiguration.TILE_SIZED +import net.torvald.terrarum.audio.MusicContainer import net.torvald.terrarum.blockproperties.Block import net.torvald.terrarum.gameactors.AVKey import net.torvald.terrarum.gameactors.ActorWithBody @@ -222,31 +223,44 @@ object PickaxeCore { const val TOOL_DURABILITY_BASE = 350 // of iron pick fun showOresTooltip(actor: ActorWithBody, tool: GameItem, mx: Int, my: Int): Unit { - if (App.getConfigBoolean("basegame:showpickaxetooltip")) { - val overlayUIopen = (INGAME as? TerrarumIngame)?.uiBlur?.isVisible ?: false - var tooltipSet = false + val overlayUIopen = (INGAME as? TerrarumIngame)?.uiBlur?.isVisible ?: false + var tooltipSet = false - mouseInInteractableRangeTools(actor, tool) { - val tileUnderCursor = INGAME.world.getTileFromOre(mx, my).item - val playerCodex = (actor.actorValue.getAsString(AVKey.ORE_DICT) ?: "").split(',').filter { it.isNotBlank() } + val tooltipWasShown = tooltipShowing[hash] ?: false + mouseInInteractableRangeTools(actor, tool) { + val tileUnderCursor = INGAME.world.getTileFromOre(mx, my).item + val playerCodex = (actor.actorValue.getAsString(AVKey.ORE_DICT) ?: "").split(',').filter { it.isNotBlank() } - if (tileUnderCursor != Block.AIR && !overlayUIopen) { - val itemForOre = OreCodex[tileUnderCursor].item - val tileName = if (playerCodex.binarySearch(itemForOre) >= 0) - Lang[ItemCodex[itemForOre]!!.originalName] - else "???" + if (tileUnderCursor != Block.AIR && !overlayUIopen) { + val itemForOre = OreCodex[tileUnderCursor].item + val tileName = if (playerCodex.binarySearch(itemForOre) >= 0) + Lang[ItemCodex[itemForOre]!!.originalName] + else "???" + if (App.getConfigBoolean("basegame:showpickaxetooltip")) { INGAME.setTooltipMessage(tileName) tooltipShowing[hash] = true - tooltipSet = true } - - true // just a placeholder + tooltipSet = true } - if (!tooltipSet) tooltipShowing[hash] = false + // play sound cue + if (!tooltipWasShown && tooltipSet) { + actor.startAudio(soundCue, 0.7) // TODO play on the GUI track + } + + true // just a placeholder } + + if (App.getConfigBoolean("basegame:showpickaxetooltip") && !tooltipSet) tooltipShowing[hash] = false + } + + private val soundCue = MusicContainer( + "pickaxe_sound_cue", + ModMgr.getFile("basegame", "audio/effects/accessibility/pickaxe_valuable.ogg"), + ).also { + App.disposables.add(it) } }