mirror of
https://gitlab.com/cc-ru/ocelot/ocelot-desktop.git
synced 2025-12-20 11:09:20 +01:00
Added countdown beep sound for Self-Destructing card
This commit is contained in:
parent
82d98ff4f8
commit
549833f3e9
@ -132,4 +132,7 @@ object SoundSource {
|
|||||||
|
|
||||||
lazy val MachineFloppyEject: SoundSource =
|
lazy val MachineFloppyEject: SoundSource =
|
||||||
SoundSource.fromBuffer(SoundBuffers.MachineFloppyEject, SoundCategory.Environment)
|
SoundSource.fromBuffer(SoundBuffers.MachineFloppyEject, SoundCategory.Environment)
|
||||||
|
|
||||||
|
lazy val SelfDestructingCardBeep: SoundSource =
|
||||||
|
BeepGenerator.newBeep(".", 1000, 100)
|
||||||
}
|
}
|
||||||
|
|||||||
@ -2,6 +2,7 @@ package ocelot.desktop.node
|
|||||||
|
|
||||||
import ocelot.desktop.{ColorScheme, OcelotDesktop, Settings => DesktopSettings}
|
import ocelot.desktop.{ColorScheme, OcelotDesktop, Settings => DesktopSettings}
|
||||||
import ocelot.desktop.audio._
|
import ocelot.desktop.audio._
|
||||||
|
import ocelot.desktop.geometry.{Vector2D, Vector3D}
|
||||||
import ocelot.desktop.graphics.{Graphics, IconSource}
|
import ocelot.desktop.graphics.{Graphics, IconSource}
|
||||||
import ocelot.desktop.inventory.SyncedInventory
|
import ocelot.desktop.inventory.SyncedInventory
|
||||||
import ocelot.desktop.node.ComputerAwareNode._
|
import ocelot.desktop.node.ComputerAwareNode._
|
||||||
@ -13,6 +14,7 @@ import ocelot.desktop.ui.particle.Particle
|
|||||||
import ocelot.desktop.util.Messages
|
import ocelot.desktop.util.Messages
|
||||||
import totoro.ocelot.brain.Settings
|
import totoro.ocelot.brain.Settings
|
||||||
import totoro.ocelot.brain.entity.traits.{Entity, Environment, WorkspaceAware}
|
import totoro.ocelot.brain.entity.traits.{Entity, Environment, WorkspaceAware}
|
||||||
|
import totoro.ocelot.brain.entity.SelfDestructingCard
|
||||||
import totoro.ocelot.brain.event._
|
import totoro.ocelot.brain.event._
|
||||||
|
|
||||||
import java.util.Calendar
|
import java.util.Calendar
|
||||||
@ -22,12 +24,16 @@ abstract class ComputerAwareNode(entity: Entity with Environment with WorkspaceA
|
|||||||
with SyncedInventory
|
with SyncedInventory
|
||||||
with DiskActivityHandler
|
with DiskActivityHandler
|
||||||
with OcelotLogParticleNode
|
with OcelotLogParticleNode
|
||||||
with ShiftClickNode {
|
with ShiftClickNode
|
||||||
|
with PositionalSoundSourcesNode {
|
||||||
|
|
||||||
private lazy val soundCardSounds: (SoundStream, SoundSource) = Audio.newStream(SoundCategory.Records)
|
private lazy val soundCardSounds: (SoundStream, SoundSource) = Audio.newStream(SoundCategory.Records)
|
||||||
private def soundCardStream: SoundStream = soundCardSounds._1
|
private def soundCardStream: SoundStream = soundCardSounds._1
|
||||||
private def soundCardSource: SoundSource = soundCardSounds._2
|
private def soundCardSource: SoundSource = soundCardSounds._2
|
||||||
|
|
||||||
|
// PositionalSoundSourcesNode
|
||||||
|
override def soundSources: Seq[SoundSource] = Seq(SoundSource.MinecraftExplosion)
|
||||||
|
|
||||||
eventHandlers += {
|
eventHandlers += {
|
||||||
case BrainEvent(event: MachineCrashEvent) =>
|
case BrainEvent(event: MachineCrashEvent) =>
|
||||||
val message = Messages.lift(event.message) match {
|
val message = Messages.lift(event.message) match {
|
||||||
@ -58,6 +64,19 @@ abstract class ComputerAwareNode(entity: Entity with Environment with WorkspaceA
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override def update(): Unit = {
|
||||||
|
for (slot <- brainInventory.inventory) {
|
||||||
|
slot.get match {
|
||||||
|
case Some(card: SelfDestructingCard) =>
|
||||||
|
if (card.time > 0 && card.time % 20 == 0) {
|
||||||
|
SoundSource.SelfDestructingCardBeep.play()
|
||||||
|
}
|
||||||
|
case _ =>
|
||||||
|
}
|
||||||
|
}
|
||||||
|
super.update()
|
||||||
|
}
|
||||||
|
|
||||||
protected def drawOverlay(g: Graphics): Unit = HolidayIcon match {
|
protected def drawOverlay(g: Graphics): Unit = HolidayIcon match {
|
||||||
case Some(icon) if DesktopSettings.get.enableFestiveDecorations =>
|
case Some(icon) if DesktopSettings.get.enableFestiveDecorations =>
|
||||||
val holidayOverlaySize = Size * 1.6f
|
val holidayOverlaySize = Size * 1.6f
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user