From 77926908fced395e389b49130b95b6f10fa78223 Mon Sep 17 00:00:00 2001 From: Joonas Rikkonen Date: Sun, 9 Jun 2019 17:38:01 +0300 Subject: [PATCH] (be1093d88) Allow to edit the door closing and opening speed. Increase the default speed from 2 to 3. --- .../BarotraumaShared/Source/Items/Components/Door.cs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/Barotrauma/BarotraumaShared/Source/Items/Components/Door.cs b/Barotrauma/BarotraumaShared/Source/Items/Components/Door.cs index 6f3068515..0884b7a5d 100644 --- a/Barotrauma/BarotraumaShared/Source/Items/Components/Door.cs +++ b/Barotrauma/BarotraumaShared/Source/Items/Components/Door.cs @@ -73,6 +73,12 @@ namespace Barotrauma.Items.Components } } + [Serialize(3.0f, true), Editable] + public float OpeningSpeed { get; private set; } + + [Serialize(3.0f, true), Editable] + public float ClosingSpeed { get; private set; } + public bool? PredictedState { get; private set; } public Gap LinkedGap @@ -297,12 +303,12 @@ namespace Barotrauma.Items.Components { if (PredictedState == null) { - OpenState += deltaTime * (isOpen ? 2.0f : -2.0f); + OpenState += deltaTime * (isOpen ? OpeningSpeed : -ClosingSpeed); isClosing = openState > 0.0f && openState < 1.0f && !isOpen; } else { - OpenState += deltaTime * ((bool)PredictedState ? 2.0f : -2.0f); + OpenState += deltaTime * ((bool)PredictedState ? OpeningSpeed : -ClosingSpeed); isClosing = openState > 0.0f && openState < 1.0f && !(bool)PredictedState; resetPredictionTimer -= deltaTime;