mirror of
https://github.com/DarkflameUniverse/DarkflameServer
synced 2024-08-30 18:43:58 +00:00
climbable server side settings
This commit is contained in:
parent
cc23538244
commit
03a5aa4da0
@ -17,6 +17,17 @@ SimplePhysicsComponent::SimplePhysicsComponent(uint32_t componentID, Entity* par
|
|||||||
m_Position = m_Parent->GetDefaultPosition();
|
m_Position = m_Parent->GetDefaultPosition();
|
||||||
m_Rotation = m_Parent->GetDefaultRotation();
|
m_Rotation = m_Parent->GetDefaultRotation();
|
||||||
m_IsDirty = true;
|
m_IsDirty = true;
|
||||||
|
|
||||||
|
std::u16string climbable_type = m_Parent->GetVar<std::u16string>(u"climbable");
|
||||||
|
if (climbable_type == u"wall") {
|
||||||
|
SetClimbableType(CLIMBABLE_TYPE_WALL);
|
||||||
|
} else if (climbable_type == u"ladder") {
|
||||||
|
SetClimbableType(CLIMBABLE_TYPE_LADDER);
|
||||||
|
} else if (climbable_type == u"wallstick") {
|
||||||
|
SetClimbableType(CLIMBABLE_TYPE_WALL_STICK);
|
||||||
|
} else {
|
||||||
|
SetClimbableType(CLIMBABLE_TYPE_NOT);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
SimplePhysicsComponent::~SimplePhysicsComponent() {
|
SimplePhysicsComponent::~SimplePhysicsComponent() {
|
||||||
@ -24,8 +35,8 @@ SimplePhysicsComponent::~SimplePhysicsComponent() {
|
|||||||
|
|
||||||
void SimplePhysicsComponent::Serialize(RakNet::BitStream* outBitStream, bool bIsInitialUpdate, unsigned int& flags) {
|
void SimplePhysicsComponent::Serialize(RakNet::BitStream* outBitStream, bool bIsInitialUpdate, unsigned int& flags) {
|
||||||
if (bIsInitialUpdate) {
|
if (bIsInitialUpdate) {
|
||||||
outBitStream->Write0(); // climbable
|
outBitStream->Write(m_ClimbableType > 0);
|
||||||
outBitStream->Write<int32_t>(0); // climbableType
|
outBitStream->Write<int32_t>(m_ClimbableType);
|
||||||
}
|
}
|
||||||
|
|
||||||
outBitStream->Write(m_DirtyVelocity || bIsInitialUpdate);
|
outBitStream->Write(m_DirtyVelocity || bIsInitialUpdate);
|
||||||
|
@ -14,6 +14,14 @@
|
|||||||
|
|
||||||
class Entity;
|
class Entity;
|
||||||
|
|
||||||
|
enum eClimbableType : int32_t {
|
||||||
|
CLIMBABLE_TYPE_NOT,
|
||||||
|
CLIMBABLE_TYPE_LADDER,
|
||||||
|
CLIMBABLE_TYPE_WALL,
|
||||||
|
CLIMBABLE_TYPE_WALL_STICK
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Component that serializes locations of entities to the client
|
* Component that serializes locations of entities to the client
|
||||||
*/
|
*/
|
||||||
@ -86,6 +94,18 @@ public:
|
|||||||
*/
|
*/
|
||||||
void SetPhysicsMotionState(uint32_t value);
|
void SetPhysicsMotionState(uint32_t value);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the ClimbableType of this entity
|
||||||
|
* @return the ClimbableType of this entity
|
||||||
|
*/
|
||||||
|
const eClimbableType& GetClimabbleType() { return m_ClimbableType; }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the ClimbableType of this entity
|
||||||
|
* @param value the ClimbableType to set
|
||||||
|
*/
|
||||||
|
void SetClimbableType(const eClimbableType& value) { m_ClimbableType = value; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -122,6 +142,11 @@ private:
|
|||||||
* The current physics motion state
|
* The current physics motion state
|
||||||
*/
|
*/
|
||||||
uint32_t m_PhysicsMotionState = 0;
|
uint32_t m_PhysicsMotionState = 0;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Whether or not the entity is climbable
|
||||||
|
*/
|
||||||
|
eClimbableType m_ClimbableType = CLIMBABLE_TYPE_NOT;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // SIMPLEPHYSICSCOMPONENT_H
|
#endif // SIMPLEPHYSICSCOMPONENT_H
|
||||||
|
Loading…
Reference in New Issue
Block a user