From a909546e2fb50f5238a06f50c43c7d05c7c408b8 Mon Sep 17 00:00:00 2001 From: David Markowitz Date: Wed, 2 Apr 2025 23:52:56 -0700 Subject: [PATCH] Fix asynchronous actions executing other strips actions --- dGame/dComponents/ModelComponent.cpp | 8 +++++--- dGame/dPropertyBehaviors/Strip.cpp | 2 ++ 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/dGame/dComponents/ModelComponent.cpp b/dGame/dComponents/ModelComponent.cpp index 28223f10..99562c6b 100644 --- a/dGame/dComponents/ModelComponent.cpp +++ b/dGame/dComponents/ModelComponent.cpp @@ -10,7 +10,6 @@ #include "SimplePhysicsComponent.h" #include "Database.h" -#include "EntityInfo.h" ModelComponent::ModelComponent(Entity* parent) : Component(parent) { m_OriginalPosition = m_Parent->GetDefaultPosition(); @@ -30,6 +29,9 @@ bool ModelComponent::OnResetModelToDefaults(GameMessages::GameMsg& msg) { unsmash.target = GetParent()->GetObjectID(); unsmash.duration = 0.0f; unsmash.Send(UNASSIGNED_SYSTEM_ADDRESS); + m_NumListeningInteract = 0; + m_Dirty = true; + Game::entityManager->SerializeEntity(GetParent()); return true; } @@ -171,14 +173,14 @@ std::array, 5> ModelComponent::GetBehaviorsForSa } void ModelComponent::AddInteract() { - LOG("adding interact %i", m_NumListeningInteract); + LOG_DEBUG("adding interact %i", m_NumListeningInteract); m_Dirty = true; m_NumListeningInteract++; } void ModelComponent::RemoveInteract() { DluAssert(m_NumListeningInteract > 0); - LOG("Removing interact %i", m_NumListeningInteract); + LOG_DEBUG("Removing interact %i", m_NumListeningInteract); m_Dirty = true; m_NumListeningInteract--; } diff --git a/dGame/dPropertyBehaviors/Strip.cpp b/dGame/dPropertyBehaviors/Strip.cpp index 7e9f7149..4ffead9d 100644 --- a/dGame/dPropertyBehaviors/Strip.cpp +++ b/dGame/dPropertyBehaviors/Strip.cpp @@ -82,6 +82,8 @@ void Strip::HandleMsg(MigrateActionsMessage& msg) { template<> void Strip::HandleMsg(GameMessages::RequestUse& msg) { + if (m_PausedTime > 0.0f) return; + if (m_Actions[m_NextActionIndex].GetType() == "OnInteract") { IncrementAction(); m_WaitingForAction = false;