From a94c7bd728a2b2b80b016ee86f3310459e872e0d Mon Sep 17 00:00:00 2001 From: s1lentq Date: Sun, 9 Jun 2024 15:46:50 +0700 Subject: [PATCH] Fix crouch bot --- regamedll/game_shared/bot/bot.cpp | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/regamedll/game_shared/bot/bot.cpp b/regamedll/game_shared/bot/bot.cpp index 0a9ae70a..0f19e81f 100644 --- a/regamedll/game_shared/bot/bot.cpp +++ b/regamedll/game_shared/bot/bot.cpp @@ -261,6 +261,20 @@ void CBot::ExecuteCommand() // Adjust msec to command time interval adjustedMSec = ThrottledMsec(); + if (IsCrouching()) + { + m_buttonFlags |= IN_DUCK; + } + +#ifdef REGAMEDLL_FIXES + // don't move if frozen state present + if (pev->flags & FL_FROZEN) + { + adjustedMSec = 0; + ResetCommand(); + } +#endif + // Run mimic command usercmd_t botCmd; if (!RunMimicCommand(botCmd)) @@ -280,20 +294,6 @@ void CBot::ExecuteCommand() // save the command time m_flPreviousCommandTime = gpGlobals->time; - if (IsCrouching()) - { - m_buttonFlags |= IN_DUCK; - } - -#ifdef REGAMEDLL_FIXES - // don't move if frozen state present - if (pev->flags & FL_FROZEN) - { - adjustedMSec = 0; - ResetCommand(); - } -#endif - // Run the command PLAYER_RUN_MOVE(edict(), botCmd.viewangles, botCmd.forwardmove, botCmd.sidemove, botCmd.upmove, botCmd.buttons, 0, adjustedMSec); }