feat: Property behaviors partially functional (#1759)

* most of gameplay tab works

* smash unsmash and wait working

* Add pausing of models and behaviors

* working basic behaviors

* play sound functioning

* add resetting

* Fix asynchronous actions executing other strips actions

* Add comments, remove dead code etc.

* Skip Smashes if they coincide with a UnSmash

Remove debug logs

Comment on return
This commit is contained in:
David Markowitz
2025-05-05 00:17:39 -07:00
committed by GitHub
parent 841b754b01
commit 3ebc6709db
13 changed files with 465 additions and 64 deletions

View File

@@ -4,9 +4,13 @@
#include "BehaviorStates.h"
#include "ControlBehaviorMsgs.h"
#include "tinyxml2.h"
#include "ModelComponent.h"
#include <ranges>
PropertyBehavior::PropertyBehavior() {
m_LastEditedState = BehaviorState::HOME_STATE;
m_ActiveState = BehaviorState::HOME_STATE;
}
template<>
@@ -84,6 +88,17 @@ void PropertyBehavior::HandleMsg(AddMessage& msg) {
isLoot = m_BehaviorId != 7965;
};
template<>
void PropertyBehavior::HandleMsg(GameMessages::RequestUse& msg) {
m_States[m_ActiveState].HandleMsg(msg);
}
template<>
void PropertyBehavior::HandleMsg(GameMessages::ResetModelToDefaults& msg) {
m_ActiveState = BehaviorState::HOME_STATE;
for (auto& state : m_States | std::views::values) state.HandleMsg(msg);
}
void PropertyBehavior::SendBehaviorListToClient(AMFArrayValue& args) const {
args.Insert("id", std::to_string(m_BehaviorId));
args.Insert("name", m_Name);
@@ -153,3 +168,7 @@ void PropertyBehavior::Deserialize(const tinyxml2::XMLElement& behavior) {
m_States[static_cast<BehaviorState>(stateId)].Deserialize(*stateElement);
}
}
void PropertyBehavior::Update(float deltaTime, ModelComponent& modelComponent) {
for (auto& state : m_States | std::views::values) state.Update(deltaTime, modelComponent);
}