mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2025-08-09 20:24:16 +00:00
Move in all directions is functional
This commit is contained in:
@@ -30,10 +30,16 @@ bool ModelComponent::OnResetModelToDefaults(GameMessages::GameMsg& msg) {
|
||||
unsmash.target = GetParent()->GetObjectID();
|
||||
unsmash.duration = 0.0f;
|
||||
unsmash.Send(UNASSIGNED_SYSTEM_ADDRESS);
|
||||
|
||||
m_Parent->SetPosition(m_OriginalPosition);
|
||||
m_Parent->SetRotation(m_OriginalRotation);
|
||||
m_Parent->SetVelocity(NiPoint3Constant::ZERO);
|
||||
|
||||
m_NumListeningInteract = 0;
|
||||
m_NumActiveUnSmash = 0;
|
||||
m_Dirty = true;
|
||||
Game::entityManager->SerializeEntity(GetParent());
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@@ -41,7 +41,7 @@ public:
|
||||
* Returns the original position of the model
|
||||
* @return the original position of the model
|
||||
*/
|
||||
const NiPoint3& GetPosition() { return m_OriginalPosition; }
|
||||
const NiPoint3& GetOriginalPosition() { return m_OriginalPosition; }
|
||||
|
||||
/**
|
||||
* Sets the original position of the model
|
||||
@@ -53,7 +53,7 @@ public:
|
||||
* Returns the original rotation of the model
|
||||
* @return the original rotation of the model
|
||||
*/
|
||||
const NiQuaternion& GetRotation() { return m_OriginalRotation; }
|
||||
const NiQuaternion& GetOriginalRotation() { return m_OriginalRotation; }
|
||||
|
||||
/**
|
||||
* Sets the original rotation of the model
|
||||
|
@@ -696,8 +696,9 @@ void PropertyManagementComponent::Save() {
|
||||
Database::Get()->AddBehavior(info);
|
||||
}
|
||||
|
||||
const auto position = entity->GetPosition();
|
||||
const auto rotation = entity->GetRotation();
|
||||
// Always save the original position so we can move the model freely
|
||||
const auto& position = modelComponent->GetOriginalPosition();
|
||||
const auto& rotation = modelComponent->GetOriginalRotation();
|
||||
|
||||
if (std::find(present.begin(), present.end(), id) == present.end()) {
|
||||
IPropertyContents::Model model;
|
||||
|
@@ -33,6 +33,13 @@ SimplePhysicsComponent::SimplePhysicsComponent(Entity* parent, int32_t component
|
||||
SimplePhysicsComponent::~SimplePhysicsComponent() {
|
||||
}
|
||||
|
||||
void SimplePhysicsComponent::Update(const float deltaTime) {
|
||||
if (m_Velocity == NiPoint3Constant::ZERO) return;
|
||||
m_Position += m_Velocity * deltaTime;
|
||||
m_DirtyPosition = true;
|
||||
Game::entityManager->SerializeEntity(m_Parent);
|
||||
}
|
||||
|
||||
void SimplePhysicsComponent::Serialize(RakNet::BitStream& outBitStream, bool bIsInitialUpdate) {
|
||||
if (bIsInitialUpdate) {
|
||||
outBitStream.Write(m_ClimbableType != eClimbableType::CLIMBABLE_TYPE_NOT);
|
||||
|
@@ -33,6 +33,8 @@ public:
|
||||
SimplePhysicsComponent(Entity* parent, int32_t componentID);
|
||||
~SimplePhysicsComponent() override;
|
||||
|
||||
void Update(const float deltaTime) override;
|
||||
|
||||
void Serialize(RakNet::BitStream& outBitStream, bool bIsInitialUpdate) override;
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user