From 59f74e2dd5b87785fa02232f964e61a5604b1672 Mon Sep 17 00:00:00 2001 From: David Markowitz Date: Sat, 26 Sep 2026 21:56:43 -0700 Subject: [PATCH] Add OnStartup and OnTimer --- dGame/dPropertyBehaviors/Strip.cpp | 17 +++++++++++++++-- dGame/dPropertyBehaviors/Strip.h | 1 + 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/dGame/dPropertyBehaviors/Strip.cpp b/dGame/dPropertyBehaviors/Strip.cpp index bdb6577e6..bebd0f7d8 100644 --- a/dGame/dPropertyBehaviors/Strip.cpp +++ b/dGame/dPropertyBehaviors/Strip.cpp @@ -110,6 +110,7 @@ void Strip::HandleMsg(GameMessages::ResetModelToDefaults& msg) { m_InActionRotation = NiPoint3Constant::ZERO; m_RotationProgress = 0.0f; m_Speed = DEFAULT_SPEED; + m_PausedFromOnTimer = false; } void Strip::OnChatMessageReceived(const std::string& sMessage) { @@ -399,13 +400,25 @@ void Strip::Update(float deltaTime, ModelComponent& modelComponent, UpdateResult m_Speed = DEFAULT_SPEED; if (nextAction.GetType() == "OnInteract") { modelComponent.AddInteract(); + m_WaitingForAction = true; } else if (nextAction.GetType() == "OnChat") { - // logic here if needed + m_WaitingForAction = true; } else if (nextAction.GetType() == "OnAttack") { modelComponent.AddAttack(); + m_WaitingForAction = true; + } else if (nextAction.GetType() == "OnStartup") { + IncrementAction(); + } else if (nextAction.GetType() == "OnTimer") { + if (!m_PausedFromOnTimer) { + m_PausedTime = nextAction.GetValueParameterDouble(); + m_PausedFromOnTimer = true; + } else { + IncrementAction(); + m_PausedFromOnTimer = false; + } } + Game::entityManager->SerializeEntity(entity); - m_WaitingForAction = true; } else { // should be a normal block ProcNormalAction(deltaTime, modelComponent, updateResult); } diff --git a/dGame/dPropertyBehaviors/Strip.h b/dGame/dPropertyBehaviors/Strip.h index 3f8a781ba..24ee55b64 100644 --- a/dGame/dPropertyBehaviors/Strip.h +++ b/dGame/dPropertyBehaviors/Strip.h @@ -55,6 +55,7 @@ private: // The amount of time this strip is paused for. Any interactions with this strip should be bounced if this is greater than 0. // Actions that do not use time do not use this (ex. positions). float m_PausedTime{ 0.0f }; + bool m_PausedFromOnTimer{ false }; // The index of the next action to be played. This should always be within range of [0, m_Actions.size()). size_t m_NextActionIndex{ 0 };