From d1d2deddff26f886e44d62138e6968fbd3f27e61 Mon Sep 17 00:00:00 2001 From: Fingercomp Date: Sun, 3 Aug 2025 22:36:37 +0300 Subject: [PATCH] `if` is an expression; use that --- .../ocelot/desktop/node/PositionalSoundSourcesNode.scala | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/main/scala/ocelot/desktop/node/PositionalSoundSourcesNode.scala b/src/main/scala/ocelot/desktop/node/PositionalSoundSourcesNode.scala index 1f2636a..377c24e 100644 --- a/src/main/scala/ocelot/desktop/node/PositionalSoundSourcesNode.scala +++ b/src/main/scala/ocelot/desktop/node/PositionalSoundSourcesNode.scala @@ -11,11 +11,9 @@ trait PositionalSoundSourcesNode extends Node { override def update(): Unit = { super.update() - var soundPosition: Vector3D = null - // Calculating position of sound source relative to center of workspace // but only if corresponding setting is enabled - if (Settings.get.soundPositional) { + val soundPosition = if (Settings.get.soundPositional) { val rootWidthHalf = OcelotDesktop.root.width / 2 val rootHeightHalf = OcelotDesktop.root.height / 2 @@ -26,13 +24,13 @@ trait PositionalSoundSourcesNode extends Node { // large monitors the sound may become too "non-audiophile" val limit = 0.05f - soundPosition = Vector3D( + Vector3D( (nodeCenterX - rootWidthHalf) / rootWidthHalf * limit, (nodeCenterY - rootHeightHalf) / rootHeightHalf * limit, 0, ) } else { - soundPosition = Vector3D.Zero + Vector3D.Zero } for (soundSource <- soundSources)