mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2025-11-27 03:38:25 +00:00
feat: add speed behavior (#1831)
This commit is contained in:
@@ -37,6 +37,7 @@ bool ModelComponent::OnResetModelToDefaults(GameMessages::GameMsg& msg) {
|
||||
m_Parent->SetRotation(m_OriginalRotation);
|
||||
m_Parent->SetVelocity(NiPoint3Constant::ZERO);
|
||||
|
||||
m_Speed = 3.0f;
|
||||
m_NumListeningInteract = 0;
|
||||
m_NumActiveUnSmash = 0;
|
||||
m_Dirty = true;
|
||||
@@ -279,6 +280,7 @@ bool ModelComponent::TrySetVelocity(const NiPoint3& velocity) const {
|
||||
currentVelocity = velocity;
|
||||
}
|
||||
|
||||
currentVelocity *= m_Speed;
|
||||
m_Parent->SetVelocity(currentVelocity);
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -66,7 +66,7 @@ public:
|
||||
*
|
||||
* @tparam Msg The message type to pass
|
||||
* @param args the arguments of the message to be deserialized
|
||||
*
|
||||
*
|
||||
* @return returns true if a new behaviorID is needed.
|
||||
*/
|
||||
template<typename Msg>
|
||||
@@ -145,6 +145,8 @@ public:
|
||||
void SetVelocity(const NiPoint3& velocity) const;
|
||||
|
||||
void OnChatMessageReceived(const std::string& sMessage);
|
||||
|
||||
void SetSpeed(const float newSpeed) { m_Speed = newSpeed; }
|
||||
private:
|
||||
|
||||
// Loads a behavior from the database.
|
||||
@@ -185,4 +187,7 @@ private:
|
||||
* The ID of the user that made the model
|
||||
*/
|
||||
LWOOBJID m_userModelID;
|
||||
|
||||
// The speed at which this model moves
|
||||
float m_Speed{ 3.0f };
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user