From a2bc835586d2ef2433abe44dda39dca6445da9a6 Mon Sep 17 00:00:00 2001 From: ForserX Date: Mon, 23 Oct 2023 15:14:15 +0300 Subject: [PATCH] Implement stopping animation of getting detector Works on contacting with ladder --- src/xrGame/CustomDetector.cpp | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/src/xrGame/CustomDetector.cpp b/src/xrGame/CustomDetector.cpp index 9ba276280..c3e5facd4 100644 --- a/src/xrGame/CustomDetector.cpp +++ b/src/xrGame/CustomDetector.cpp @@ -59,8 +59,24 @@ bool CCustomDetector::CheckCompatibility(CHudItem* itm) void CCustomDetector::HideDetector(bool bFastMode) { - if(GetState()==eIdle) + const CHUDState::EHudStates CurrentState = (CHUDState::EHudStates)GetState(); + switch (CurrentState) { + case CHUDState::EHudStates::eIdle: { ToggleDetector(bFastMode); + return; + } + case CHUDState::EHudStates::eShowing: { + bool bClimb = ((Actor()->MovingState() & mcClimb) != 0); + if (bClimb) { + StopCurrentAnimWithoutCallback(); + SetState(eIdle); + ToggleDetector(bFastMode); + } + break; + } + default: + break; + } } void CCustomDetector::ShowDetector(bool bFastMode)