sound effects for tile placing and breaking

This commit is contained in:
minjaesong
2023-12-03 00:14:04 +09:00
parent d145edf11d
commit cba8d90321
7 changed files with 15 additions and 3 deletions

View File

@@ -147,6 +147,7 @@ object AxeCore {
// drop the item under cursor
PickaxeCore.dropItem(BlockCodex[tileBroken].drop, x, y) // todo use log item if applicable
PickaxeCore.makeDust(tile, x, y, 9)
PickaxeCore.makeNoise(actor, tile)
}
// tile not busted
if (Math.random() < actionInterval) {

View File

@@ -70,6 +70,7 @@ object BlockBase {
false
)
}
PickaxeCore.makeNoise(actor, itemID)
1L
}

View File

@@ -105,6 +105,7 @@ object PickaxeCore {
dropItem(drop, x, y)
}
makeDust(tile, x, y, 9)
makeNoise(actor, tile)
}
}
// tile not busted
@@ -166,6 +167,12 @@ object PickaxeCore {
}
}
fun makeNoise(actor: ActorWithBody, tile: ItemID) {
Terrarum.audioCodex.getRandomFootstep(BlockCodex[tile].material)?.let {
actor.startAudio(it, 2.0)
}
}
fun endPrimaryUse(actor: ActorWithBody, item: GameItem?): Boolean {
item?.using = false
// reset action timer to zero

View File

@@ -104,6 +104,7 @@ object SledgehammerCore {
PickaxeCore.dropItem("wall@$drop", x, y)
}
PickaxeCore.makeDust(wall, x, y, 9, WALL_OVERLAY_COLOUR)
PickaxeCore.makeNoise(actor, wall)
}
}
// tile not busted