(be1093d88) Allow to edit the door closing and opening speed. Increase the default speed from 2 to 3.

This commit is contained in:
Joonas Rikkonen
2019-06-09 17:38:01 +03:00
parent 6c90d14462
commit 77926908fc
@@ -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 bool? PredictedState { get; private set; }
public Gap LinkedGap public Gap LinkedGap
@@ -297,12 +303,12 @@ namespace Barotrauma.Items.Components
{ {
if (PredictedState == null) if (PredictedState == null)
{ {
OpenState += deltaTime * (isOpen ? 2.0f : -2.0f); OpenState += deltaTime * (isOpen ? OpeningSpeed : -ClosingSpeed);
isClosing = openState > 0.0f && openState < 1.0f && !isOpen; isClosing = openState > 0.0f && openState < 1.0f && !isOpen;
} }
else else
{ {
OpenState += deltaTime * ((bool)PredictedState ? 2.0f : -2.0f); OpenState += deltaTime * ((bool)PredictedState ? OpeningSpeed : -ClosingSpeed);
isClosing = openState > 0.0f && openState < 1.0f && !(bool)PredictedState; isClosing = openState > 0.0f && openState < 1.0f && !(bool)PredictedState;
resetPredictionTimer -= deltaTime; resetPredictionTimer -= deltaTime;