From d1ec246f28b3ac111692ec7f984c0141f9825495 Mon Sep 17 00:00:00 2001 From: Joonas Rikkonen Date: Wed, 30 May 2018 18:36:31 +0300 Subject: [PATCH] Fixed motion sensors sending out signals even if the output is set to nothing. Closes #426 --- .../Source/Items/Components/Signal/MotionSensor.cs | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/Barotrauma/BarotraumaShared/Source/Items/Components/Signal/MotionSensor.cs b/Barotrauma/BarotraumaShared/Source/Items/Components/Signal/MotionSensor.cs index a3581bd0f..3015cfb50 100644 --- a/Barotrauma/BarotraumaShared/Source/Items/Components/Signal/MotionSensor.cs +++ b/Barotrauma/BarotraumaShared/Source/Items/Components/Signal/MotionSensor.cs @@ -49,14 +49,9 @@ namespace Barotrauma.Items.Components public override void Update(float deltaTime, Camera cam) { - if (motionDetected) - { - item.SendSignal(1, output, "state_out", null); - } - else if (!string.IsNullOrWhiteSpace(falseOutput)) - { - item.SendSignal(1, falseOutput, "state_out", null); - } + string signalOut = motionDetected ? output : falseOutput; + + if (!string.IsNullOrEmpty(signalOut)) item.SendSignal(1, signalOut, "state_out", null); updateTimer -= deltaTime; if (updateTimer > 0.0f) return;