From 425057453bb3d4b13fd32fd012bcd526a294b44a Mon Sep 17 00:00:00 2001 From: Blixibon Date: Fri, 23 Apr 2021 22:57:11 -0500 Subject: [PATCH] Fixed an issue with the ForceThisNPCToStopBusy input which caused NPCs to keep acting busy when they shouldn't --- sp/src/game/server/hl2/ai_behavior_actbusy.cpp | 11 +++++++++-- sp/src/game/server/hl2/ai_behavior_actbusy.h | 4 ++++ 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/sp/src/game/server/hl2/ai_behavior_actbusy.cpp b/sp/src/game/server/hl2/ai_behavior_actbusy.cpp index 288e93a0..c5ad733d 100644 --- a/sp/src/game/server/hl2/ai_behavior_actbusy.cpp +++ b/sp/src/game/server/hl2/ai_behavior_actbusy.cpp @@ -2742,8 +2742,15 @@ void CAI_ActBusyGoal::InputForceThisNPCToStopBusy( inputdata_t &inputdata ) if ( !pBehavior ) return; - // Just stop busying - pBehavior->StopBusying(); + if (!IsActive() && pBehavior->GetActBusyGoal() == this) + { + pBehavior->Disable(); + } + else + { + // Just stop busying + pBehavior->StopBusying(); + } } #endif diff --git a/sp/src/game/server/hl2/ai_behavior_actbusy.h b/sp/src/game/server/hl2/ai_behavior_actbusy.h index a33dd438..264fdb3d 100644 --- a/sp/src/game/server/hl2/ai_behavior_actbusy.h +++ b/sp/src/game/server/hl2/ai_behavior_actbusy.h @@ -153,6 +153,10 @@ public: bool IsInSafeZone( CBaseEntity *pEntity ); int CountEnemiesInSafeZone(); +#ifdef MAPBASE + CAI_ActBusyGoal *GetActBusyGoal() const { return m_hActBusyGoal; } +#endif + private: virtual int SelectSchedule( void ); int SelectScheduleForLeaving( void );