mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2025-08-09 20:24:16 +00:00
chore: Physics Component abstraction and addition of tests (#1159)
* Make serialize actually virtual yep * Abstract to PhysicsComponent Move shared functionality of all physics related classes to a base class. Tested that there were no failed to unserialize errors when in main gameplay in Gnarled Forest or in a race. Tested that 2 players were able to see each other in the above scenarios just fine as well. * Update PhantomPhysicsComponent.cpp * Add SimplePhysicsTest * Add construction test * Update SimplePhysicsComponentTests.cpp * remove flags and fix override * Update VendorComponent.h
This commit is contained in:
@@ -6,7 +6,7 @@
|
||||
#include "NiPoint3.h"
|
||||
#include "NiQuaternion.h"
|
||||
#include "tinyxml2.h"
|
||||
#include "Component.h"
|
||||
#include "PhysicsComponent.h"
|
||||
#include "dpCollisionChecks.h"
|
||||
#include "PhantomPhysicsComponent.h"
|
||||
#include "eBubbleType.h"
|
||||
@@ -19,7 +19,7 @@ enum class eStateChangeType : uint32_t;
|
||||
/**
|
||||
* Handles the movement of controllable Entities, e.g. enemies and players
|
||||
*/
|
||||
class ControllablePhysicsComponent : public Component {
|
||||
class ControllablePhysicsComponent : public PhysicsComponent {
|
||||
public:
|
||||
static const eReplicaComponentType ComponentType = eReplicaComponentType::CONTROLLABLE_PHYSICS;
|
||||
|
||||
@@ -36,26 +36,14 @@ public:
|
||||
* If the entity is static, this is a no-op.
|
||||
* @param pos The position to set
|
||||
*/
|
||||
void SetPosition(const NiPoint3& pos);
|
||||
|
||||
/**
|
||||
* Returns the current position of the entity
|
||||
* @return The current position of the entity
|
||||
*/
|
||||
const NiPoint3& GetPosition() const { return m_Position; }
|
||||
void SetPosition(const NiPoint3& pos) override;
|
||||
|
||||
/**
|
||||
* Sets the rotation of this entity, ensures this change is serialized next tick. If the entity is static, this is
|
||||
* a no-op.
|
||||
* @param rot the rotation to set
|
||||
*/
|
||||
void SetRotation(const NiQuaternion& rot);
|
||||
|
||||
/**
|
||||
* Returns the current rotation of this entity
|
||||
* @return the current rotation of this entity
|
||||
*/
|
||||
const NiQuaternion& GetRotation() const { return m_Rotation; }
|
||||
void SetRotation(const NiQuaternion& rot) override;
|
||||
|
||||
/**
|
||||
* Sets the current velocity of this entity, ensures that this change is serialized next tick. If the entity is
|
||||
@@ -322,21 +310,6 @@ private:
|
||||
*/
|
||||
dpEntity* m_dpEntity;
|
||||
|
||||
/**
|
||||
* Whether or not the position is dirty, forcing a serialization update of the position
|
||||
*/
|
||||
bool m_DirtyPosition;
|
||||
|
||||
/**
|
||||
* The current position of the entity
|
||||
*/
|
||||
NiPoint3 m_Position;
|
||||
|
||||
/**
|
||||
* The current rotation of the entity
|
||||
*/
|
||||
NiQuaternion m_Rotation;
|
||||
|
||||
/**
|
||||
* Whether or not the velocity is dirty, forcing a serialization of the velocity
|
||||
*/
|
||||
|
Reference in New Issue
Block a user