mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2025-08-05 18:24:12 +00:00
Player forced movement component (#672)
* Split out Level progression component from Character Component This is to get to the Player forced movement Comp in a sane way * move XML to component insted of abusing charComp * use overrides should probably make everything that calls that call it correctly * fix linking issue * Add proper Player Force movement component Not used, yet
This commit is contained in:
@@ -17,6 +17,7 @@ set(DGAME_DCOMPONENTS_SOURCES "BaseCombatAIComponent.cpp"
|
||||
"MovingPlatformComponent.cpp"
|
||||
"PetComponent.cpp"
|
||||
"PhantomPhysicsComponent.cpp"
|
||||
"PlayerForcedMovementComponent.cpp"
|
||||
"PossessableComponent.cpp"
|
||||
"PossessorComponent.cpp"
|
||||
"PropertyComponent.cpp"
|
||||
|
16
dGame/dComponents/PlayerForcedMovementComponent.cpp
Normal file
16
dGame/dComponents/PlayerForcedMovementComponent.cpp
Normal file
@@ -0,0 +1,16 @@
|
||||
#include "PlayerForcedMovementComponent.h"
|
||||
|
||||
PlayerForcedMovementComponent::PlayerForcedMovementComponent(Entity* parent) : Component(parent) {
|
||||
m_Parent = parent;
|
||||
}
|
||||
|
||||
PlayerForcedMovementComponent::~PlayerForcedMovementComponent() {}
|
||||
|
||||
void PlayerForcedMovementComponent::Serialize(RakNet::BitStream* outBitStream, bool bIsInitialUpdate, unsigned int& flags){
|
||||
outBitStream->Write(m_DirtyInfo);
|
||||
if (m_DirtyInfo) {
|
||||
outBitStream->Write(m_PlayerOnRail);
|
||||
outBitStream->Write(m_ShowBillboard);
|
||||
}
|
||||
m_DirtyInfo = false;
|
||||
}
|
70
dGame/dComponents/PlayerForcedMovementComponent.h
Normal file
70
dGame/dComponents/PlayerForcedMovementComponent.h
Normal file
@@ -0,0 +1,70 @@
|
||||
#pragma once
|
||||
|
||||
#include "Entity.h"
|
||||
#include "GameMessages.h"
|
||||
#include "Component.h"
|
||||
|
||||
/**
|
||||
* Component that handles player forced movement
|
||||
*
|
||||
*/
|
||||
class PlayerForcedMovementComponent : public Component {
|
||||
public:
|
||||
static const uint32_t ComponentType = eReplicaComponentType::COMPONENT_TYPE_PLAYER_FORCED_MOVEMENT;
|
||||
|
||||
/**
|
||||
* Constructor for this component
|
||||
* @param parent parent that contains this component
|
||||
*/
|
||||
PlayerForcedMovementComponent(Entity* parent);
|
||||
~PlayerForcedMovementComponent() override;
|
||||
|
||||
void Serialize(RakNet::BitStream* outBitStream, bool bIsInitialUpdate, unsigned int& flags);
|
||||
|
||||
/**
|
||||
* @brief Set the Player On Rail object
|
||||
*
|
||||
* @param value if the player is on a rail
|
||||
*/
|
||||
void SetPlayerOnRail(bool value){ m_PlayerOnRail = value; m_DirtyInfo = true; }
|
||||
|
||||
/**
|
||||
* @brief Set the Show Billboard object
|
||||
*
|
||||
* @param value if the billboard should be shown
|
||||
*/
|
||||
void SetShowBillboard(bool value){ m_ShowBillboard = value; m_DirtyInfo = true; }
|
||||
|
||||
/**
|
||||
* @brief Get the Player On Rail object
|
||||
*
|
||||
* @return true
|
||||
* @return false
|
||||
*/
|
||||
|
||||
/**
|
||||
* @brief Get the Player On Rail object
|
||||
*
|
||||
* @return true
|
||||
* @return false
|
||||
*/
|
||||
bool GetPlayerOnRail(){ return m_PlayerOnRail; }
|
||||
bool GetShowBillboard(){ return m_ShowBillboard; }
|
||||
|
||||
private:
|
||||
/**
|
||||
* whether the info is dirty
|
||||
*/
|
||||
bool m_DirtyInfo = false;
|
||||
|
||||
/**
|
||||
* whether the player is on a rail
|
||||
*/
|
||||
bool m_PlayerOnRail = false;
|
||||
|
||||
/**
|
||||
* whether the billboard should be showing
|
||||
*/
|
||||
bool m_ShowBillboard = false;
|
||||
|
||||
};
|
Reference in New Issue
Block a user