mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2025-08-05 18:24:12 +00:00
Split out Level progression component (#671)
* 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
This commit is contained in:
@@ -28,6 +28,7 @@
|
||||
#include "BuffComponent.h"
|
||||
#include "BouncerComponent.h"
|
||||
#include "InventoryComponent.h"
|
||||
#include "LevelProgressionComponent.h"
|
||||
#include "ScriptComponent.h"
|
||||
#include "SkillComponent.h"
|
||||
#include "SimplePhysicsComponent.h"
|
||||
@@ -442,8 +443,14 @@ void Entity::Initialize()
|
||||
}*/
|
||||
|
||||
if (compRegistryTable->GetByIDAndType(m_TemplateID, COMPONENT_TYPE_CHARACTER) > 0 || m_Character) {
|
||||
// Character Component always has a possessor component
|
||||
// Character Component always has a possessor and level components
|
||||
m_Components.insert(std::make_pair(COMPONENT_TYPE_POSSESSOR, new PossessorComponent(this)));
|
||||
|
||||
// load in the xml for the level
|
||||
auto* levelComp = new LevelProgressionComponent(this);
|
||||
levelComp->LoadFromXml(m_Character->GetXMLDoc());
|
||||
m_Components.insert(std::make_pair(COMPONENT_TYPE_LEVEL_PROGRESSION, levelComp));
|
||||
|
||||
CharacterComponent* comp = new CharacterComponent(this, m_Character);
|
||||
m_Components.insert(std::make_pair(COMPONENT_TYPE_CHARACTER, comp));
|
||||
}
|
||||
@@ -770,10 +777,9 @@ void Entity::Initialize()
|
||||
|
||||
if (m_Character) {
|
||||
auto* controllablePhysicsComponent = GetComponent<ControllablePhysicsComponent>();
|
||||
auto* characterComponent = GetComponent<CharacterComponent>();
|
||||
auto* levelComponent = GetComponent<LevelProgressionComponent>();
|
||||
|
||||
if (controllablePhysicsComponent != nullptr && characterComponent->GetLevel() >= 20)
|
||||
{
|
||||
if (controllablePhysicsComponent != nullptr && levelComponent->GetLevel() >= 20) {
|
||||
controllablePhysicsComponent->SetSpeedMultiplier(525.0f / 500.0f);
|
||||
}
|
||||
}
|
||||
@@ -1088,6 +1094,15 @@ void Entity::WriteComponents(RakNet::BitStream* outBitStream, eReplicaPacketType
|
||||
// Should never happen, but just to be safe
|
||||
outBitStream->Write0();
|
||||
}
|
||||
|
||||
LevelProgressionComponent* levelProgressionComponent;
|
||||
if (TryGetComponent(COMPONENT_TYPE_LEVEL_PROGRESSION, levelProgressionComponent)) {
|
||||
levelProgressionComponent->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