Fix Stuns of duration zero (#938)

This commit is contained in:
David Markowitz 2023-01-03 09:21:57 -08:00 committed by GitHub
parent 09157506bf
commit dc7d0ce142
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -179,7 +179,7 @@ void BaseCombatAIComponent::Update(const float deltaTime) {
if (m_Disabled || m_Parent->GetIsDead()) if (m_Disabled || m_Parent->GetIsDead())
return; return;
bool stunnedThisFrame = m_Stunned;
CalculateCombat(deltaTime); // Putting this here for now CalculateCombat(deltaTime); // Putting this here for now
if (m_StartPosition == NiPoint3::ZERO) { if (m_StartPosition == NiPoint3::ZERO) {
@ -192,7 +192,7 @@ void BaseCombatAIComponent::Update(const float deltaTime) {
return; return;
} }
if (m_Stunned) { if (stunnedThisFrame) {
m_MovementAI->Stop(); m_MovementAI->Stop();
return; return;
@ -248,13 +248,13 @@ void BaseCombatAIComponent::CalculateCombat(const float deltaTime) {
if (m_Disabled) return; if (m_Disabled) return;
if (m_StunTime > 0.0f) { if (m_Stunned) {
m_StunTime -= deltaTime; m_StunTime -= deltaTime;
if (m_StunTime > 0.0f) { if (m_StunTime > 0.0f) {
return; return;
} }
m_StunTime = 0.0f;
m_Stunned = false; m_Stunned = false;
} }