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:
@@ -29,6 +29,7 @@
|
||||
#include "BouncerComponent.h"
|
||||
#include "InventoryComponent.h"
|
||||
#include "LevelProgressionComponent.h"
|
||||
#include "PlayerForcedMovementComponent.h"
|
||||
#include "ScriptComponent.h"
|
||||
#include "SkillComponent.h"
|
||||
#include "SimplePhysicsComponent.h"
|
||||
@@ -436,14 +437,8 @@ void Entity::Initialize()
|
||||
m_Components.insert(std::make_pair(COMPONENT_TYPE_DESTROYABLE, comp));
|
||||
}
|
||||
|
||||
/*if (compRegistryTable->GetByIDAndType(m_TemplateID, COMPONENT_TYPE_DESTROYABLE) > 0 || m_Character) {
|
||||
DestroyableComponent* comp = new DestroyableComponent();
|
||||
if (m_Character) comp->LoadFromXML(m_Character->GetXMLDoc());
|
||||
m_Components.push_back(std::make_pair(COMPONENT_TYPE_DESTROYABLE, comp));
|
||||
}*/
|
||||
|
||||
if (compRegistryTable->GetByIDAndType(m_TemplateID, COMPONENT_TYPE_CHARACTER) > 0 || m_Character) {
|
||||
// Character Component always has a possessor and level components
|
||||
// Character Component always has a possessor, level, and forced movement components
|
||||
m_Components.insert(std::make_pair(COMPONENT_TYPE_POSSESSOR, new PossessorComponent(this)));
|
||||
|
||||
// load in the xml for the level
|
||||
@@ -451,6 +446,8 @@ void Entity::Initialize()
|
||||
levelComp->LoadFromXml(m_Character->GetXMLDoc());
|
||||
m_Components.insert(std::make_pair(COMPONENT_TYPE_LEVEL_PROGRESSION, levelComp));
|
||||
|
||||
m_Components.insert(std::make_pair(COMPONENT_TYPE_PLAYER_FORCED_MOVEMENT, new PlayerForcedMovementComponent(this)));
|
||||
|
||||
CharacterComponent* comp = new CharacterComponent(this, m_Character);
|
||||
m_Components.insert(std::make_pair(COMPONENT_TYPE_CHARACTER, comp));
|
||||
}
|
||||
@@ -1103,6 +1100,14 @@ void Entity::WriteComponents(RakNet::BitStream* outBitStream, eReplicaPacketType
|
||||
outBitStream->Write0();
|
||||
}
|
||||
|
||||
PlayerForcedMovementComponent* playerForcedMovementComponent;
|
||||
if (TryGetComponent(COMPONENT_TYPE_PLAYER_FORCED_MOVEMENT, playerForcedMovementComponent)) {
|
||||
playerForcedMovementComponent->Serialize(outBitStream, bIsInitialUpdate, flags);
|
||||
} else {
|
||||
// Should never happen, but just to be safe
|
||||
outBitStream->Write0();
|
||||
}
|
||||
|
||||
characterComponent->Serialize(outBitStream, bIsInitialUpdate, flags);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user