mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2026-11-17 01:05:28 +00:00
refactor(component): the client's component lifecycle
Components get the client's per-component functions: LoadDataFromTemplate, PrepareConfigData, LoadConfigData, LoadFromSaveData, Startup, Run, OnEnterScope, OnLeaveScope, Preshutdown and Shutdown, called by the entity in the client's order. Update is renamed Run, LoadFromXml LoadFromSaveData and UpdateXml WriteSaveData. Nothing sent changes. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -163,7 +163,7 @@ BaseCombatAIComponent::~BaseCombatAIComponent() {
|
||||
dpWorld::RemoveEntity(m_dpEntityEnemy);
|
||||
}
|
||||
|
||||
void BaseCombatAIComponent::Update(const float deltaTime) {
|
||||
void BaseCombatAIComponent::Run(const float deltaTime) {
|
||||
//First, we need to process physics:
|
||||
if (!m_dpEntity) return;
|
||||
|
||||
|
||||
@@ -57,7 +57,7 @@ public:
|
||||
static float TetherSpeedOf(int32_t componentID);
|
||||
~BaseCombatAIComponent() override;
|
||||
|
||||
void Update(float deltaTime) override;
|
||||
void Run(float deltaTime) override;
|
||||
void Serialize(RakNet::BitStream& outBitStream, bool bIsInitialUpdate) override;
|
||||
|
||||
/**
|
||||
|
||||
@@ -70,7 +70,7 @@ void BuffComponent::Serialize(RakNet::BitStream& outBitStream, bool bIsInitialUp
|
||||
outBitStream.Write0(); // something to do with immunity buffs?
|
||||
}
|
||||
|
||||
void BuffComponent::Update(float deltaTime) {
|
||||
void BuffComponent::Run(float deltaTime) {
|
||||
/**
|
||||
* Loop through all buffs and apply deltaTime to ther time.
|
||||
* If they have expired, remove the buff and break.
|
||||
@@ -353,7 +353,7 @@ Entity* BuffComponent::GetParent() const {
|
||||
return m_Parent;
|
||||
}
|
||||
|
||||
void BuffComponent::LoadFromXml(const tinyxml2::XMLDocument& doc) {
|
||||
void BuffComponent::LoadFromSaveData(const tinyxml2::XMLDocument& doc) {
|
||||
// Load buffs
|
||||
auto* dest = doc.FirstChildElement("obj")->FirstChildElement("dest");
|
||||
|
||||
@@ -413,7 +413,7 @@ void BuffComponent::LoadFromXml(const tinyxml2::XMLDocument& doc) {
|
||||
}
|
||||
}
|
||||
|
||||
void BuffComponent::UpdateXml(tinyxml2::XMLDocument& doc) {
|
||||
void BuffComponent::WriteSaveData(tinyxml2::XMLDocument& doc) {
|
||||
// Save buffs
|
||||
auto* dest = doc.FirstChildElement("obj")->FirstChildElement("dest");
|
||||
|
||||
|
||||
@@ -57,13 +57,13 @@ public:
|
||||
|
||||
Entity* GetParent() const;
|
||||
|
||||
void LoadFromXml(const tinyxml2::XMLDocument& doc) override;
|
||||
void LoadFromSaveData(const tinyxml2::XMLDocument& doc) override;
|
||||
|
||||
void UpdateXml(tinyxml2::XMLDocument& doc) override;
|
||||
void WriteSaveData(tinyxml2::XMLDocument& doc) override;
|
||||
|
||||
void Serialize(RakNet::BitStream& outBitStream, bool bIsInitialUpdate) override;
|
||||
|
||||
void Update(float deltaTime) override;
|
||||
void Run(float deltaTime) override;
|
||||
|
||||
/**
|
||||
* Applies a buff to the parent entity
|
||||
|
||||
@@ -292,7 +292,7 @@ void CharacterComponent::SetGMLevel(eGameMasterLevel gmlevel) {
|
||||
m_GMLevel = gmlevel;
|
||||
}
|
||||
|
||||
void CharacterComponent::LoadFromXml(const tinyxml2::XMLDocument& doc) {
|
||||
void CharacterComponent::LoadFromSaveData(const tinyxml2::XMLDocument& doc) {
|
||||
|
||||
auto* character = doc.FirstChildElement("obj")->FirstChildElement("char");
|
||||
if (!character) {
|
||||
@@ -398,7 +398,7 @@ void CharacterComponent::LoadFromXml(const tinyxml2::XMLDocument& doc) {
|
||||
}
|
||||
}
|
||||
|
||||
void CharacterComponent::UpdateXml(tinyxml2::XMLDocument& doc) {
|
||||
void CharacterComponent::WriteSaveData(tinyxml2::XMLDocument& doc) {
|
||||
tinyxml2::XMLElement* minifig = doc.FirstChildElement("obj")->FirstChildElement("mf");
|
||||
if (!minifig) {
|
||||
LOG("Failed to find mf tag while updating XML!");
|
||||
|
||||
@@ -48,8 +48,8 @@ public:
|
||||
CharacterComponent(Entity* parent, const int32_t componentID, Character* character, const SystemAddress& systemAddress);
|
||||
~CharacterComponent() override;
|
||||
|
||||
void LoadFromXml(const tinyxml2::XMLDocument& doc) override;
|
||||
void UpdateXml(tinyxml2::XMLDocument& doc) override;
|
||||
void LoadFromSaveData(const tinyxml2::XMLDocument& doc) override;
|
||||
void WriteSaveData(tinyxml2::XMLDocument& doc) override;
|
||||
|
||||
void Serialize(RakNet::BitStream& outBitStream, bool bIsInitialUpdate) override;
|
||||
|
||||
|
||||
@@ -15,7 +15,13 @@ namespace GameMessages {
|
||||
class Entity;
|
||||
|
||||
/**
|
||||
* Component base class, provides methods for game loop updates, usage events and loading and saving to XML.
|
||||
* Component base class, with the client's component lifecycle (LWOGameObjComponent's vtable,
|
||||
* LWOGameObjComponentFunctions), which the entity calls in the client's order (ObjectLoader2::DoObjectComponentLoad):
|
||||
* constructed, LoadDataFromTemplate (its CDClient row), PrepareConfigData and LoadConfigData (the object's level
|
||||
* config), LoadFromSaveData (a character's save), then Startup once every component of the object exists; Run every
|
||||
* frame; OnEnterScope / OnLeaveScope when a player starts or stops seeing the object; Preshutdown and Shutdown before it
|
||||
* is deleted. Serialize is the server side of the client's Deserialize. Client-only slots (GetSizeInMemory,
|
||||
* GraphicsDeviceReset, GetPickTypePriority) are left out.
|
||||
*/
|
||||
class Component {
|
||||
public:
|
||||
@@ -30,11 +36,26 @@ public:
|
||||
|
||||
[[nodiscard]] int32_t GetComponentID() const noexcept { return m_ComponentID; }
|
||||
|
||||
/**
|
||||
* Updates the component in the game loop
|
||||
* @param deltaTime time passed since last update
|
||||
*/
|
||||
virtual void Update(float deltaTime) {}
|
||||
// The CDClient row (componentID) of the component's table
|
||||
virtual void LoadDataFromTemplate() {}
|
||||
|
||||
// The object's level config (LDF): PrepareConfigData first, then LoadConfigData
|
||||
virtual void PrepareConfigData() {}
|
||||
virtual void LoadConfigData() {}
|
||||
|
||||
// After every component of the object exists
|
||||
virtual void Startup() {}
|
||||
|
||||
// Every frame
|
||||
virtual void Run(float deltaTime) {}
|
||||
|
||||
// A player starts or stops seeing the object (ghosting)
|
||||
virtual void OnEnterScope(Entity& player) {}
|
||||
virtual void OnLeaveScope(Entity& player) {}
|
||||
|
||||
// Before the object is deleted
|
||||
virtual void Preshutdown() {}
|
||||
virtual void Shutdown() {}
|
||||
|
||||
/**
|
||||
* Event called when this component is being used, e.g. when some entity interacted with it
|
||||
@@ -42,17 +63,9 @@ public:
|
||||
*/
|
||||
virtual void OnUse(Entity* originator) {}
|
||||
|
||||
/**
|
||||
* Save data from this componennt to character XML
|
||||
* @param doc the document to write data to
|
||||
*/
|
||||
virtual void UpdateXml(tinyxml2::XMLDocument& doc) {}
|
||||
|
||||
/**
|
||||
* Load base data for this component from character XML
|
||||
* @param doc the document to read data from
|
||||
*/
|
||||
virtual void LoadFromXml(const tinyxml2::XMLDocument& doc) {}
|
||||
// A character's save (its XML): read on load, written on save
|
||||
virtual void LoadFromSaveData(const tinyxml2::XMLDocument& doc) {}
|
||||
virtual void WriteSaveData(tinyxml2::XMLDocument& doc) {}
|
||||
|
||||
virtual void Serialize(RakNet::BitStream& outBitStream, bool isConstruction) {}
|
||||
protected:
|
||||
|
||||
@@ -70,7 +70,7 @@ ControllablePhysicsComponent::~ControllablePhysicsComponent() {
|
||||
}
|
||||
}
|
||||
|
||||
void ControllablePhysicsComponent::Update(float deltaTime) {
|
||||
void ControllablePhysicsComponent::Run(float deltaTime) {
|
||||
|
||||
}
|
||||
|
||||
@@ -166,7 +166,7 @@ void ControllablePhysicsComponent::Serialize(RakNet::BitStream& outBitStream, bo
|
||||
}
|
||||
}
|
||||
|
||||
void ControllablePhysicsComponent::LoadFromXml(const tinyxml2::XMLDocument& doc) {
|
||||
void ControllablePhysicsComponent::LoadFromSaveData(const tinyxml2::XMLDocument& doc) {
|
||||
auto* character = doc.FirstChildElement("obj")->FirstChildElement("char");
|
||||
if (!character) {
|
||||
LOG("Failed to find char tag!");
|
||||
@@ -186,7 +186,7 @@ void ControllablePhysicsComponent::LoadFromXml(const tinyxml2::XMLDocument& doc)
|
||||
m_DirtyPosition = true;
|
||||
}
|
||||
|
||||
void ControllablePhysicsComponent::UpdateXml(tinyxml2::XMLDocument& doc) {
|
||||
void ControllablePhysicsComponent::WriteSaveData(tinyxml2::XMLDocument& doc) {
|
||||
tinyxml2::XMLElement* character = doc.FirstChildElement("obj")->FirstChildElement("char");
|
||||
if (!character) {
|
||||
LOG("Failed to find char tag while updating XML!");
|
||||
|
||||
@@ -28,10 +28,10 @@ public:
|
||||
ControllablePhysicsComponent(Entity* entity, const int32_t componentID);
|
||||
~ControllablePhysicsComponent() override;
|
||||
|
||||
void Update(float deltaTime) override;
|
||||
void Run(float deltaTime) override;
|
||||
void Serialize(RakNet::BitStream& outBitStream, bool bIsInitialUpdate) override;
|
||||
void LoadFromXml(const tinyxml2::XMLDocument& doc) override;
|
||||
void UpdateXml(tinyxml2::XMLDocument& doc) override;
|
||||
void LoadFromSaveData(const tinyxml2::XMLDocument& doc) override;
|
||||
void WriteSaveData(tinyxml2::XMLDocument& doc) override;
|
||||
|
||||
/**
|
||||
* Sets the position of this entity, also ensures this update is serialized next tick.
|
||||
|
||||
@@ -158,11 +158,11 @@ void DestroyableComponent::Serialize(RakNet::BitStream& outBitStream, bool bIsIn
|
||||
}
|
||||
}
|
||||
|
||||
void DestroyableComponent::Update(float deltaTime) {
|
||||
void DestroyableComponent::Run(float deltaTime) {
|
||||
m_DamageCooldownTimer -= deltaTime;
|
||||
}
|
||||
|
||||
void DestroyableComponent::LoadFromXml(const tinyxml2::XMLDocument& doc) {
|
||||
void DestroyableComponent::LoadFromSaveData(const tinyxml2::XMLDocument& doc) {
|
||||
auto* dest = doc.FirstChildElement("obj")->FirstChildElement("dest");
|
||||
if (!dest) {
|
||||
LOG("Failed to find dest tag!");
|
||||
@@ -172,7 +172,7 @@ void DestroyableComponent::LoadFromXml(const tinyxml2::XMLDocument& doc) {
|
||||
auto* buffComponent = m_Parent->GetComponent<BuffComponent>();
|
||||
|
||||
if (buffComponent != nullptr) {
|
||||
buffComponent->LoadFromXml(doc);
|
||||
buffComponent->LoadFromSaveData(doc);
|
||||
}
|
||||
|
||||
dest->QueryAttribute("hc", &m_iHealth);
|
||||
@@ -184,7 +184,7 @@ void DestroyableComponent::LoadFromXml(const tinyxml2::XMLDocument& doc) {
|
||||
m_DirtyHealth = true;
|
||||
}
|
||||
|
||||
void DestroyableComponent::UpdateXml(tinyxml2::XMLDocument& doc) {
|
||||
void DestroyableComponent::WriteSaveData(tinyxml2::XMLDocument& doc) {
|
||||
tinyxml2::XMLElement* dest = doc.FirstChildElement("obj")->FirstChildElement("dest");
|
||||
if (!dest) {
|
||||
LOG("Failed to find dest tag!");
|
||||
@@ -194,7 +194,7 @@ void DestroyableComponent::UpdateXml(tinyxml2::XMLDocument& doc) {
|
||||
auto* buffComponent = m_Parent->GetComponent<BuffComponent>();
|
||||
|
||||
if (buffComponent != nullptr) {
|
||||
buffComponent->UpdateXml(doc);
|
||||
buffComponent->WriteSaveData(doc);
|
||||
}
|
||||
|
||||
dest->SetAttribute("hc", m_iHealth);
|
||||
|
||||
@@ -47,10 +47,10 @@ public:
|
||||
DestroyableComponent(Entity* parentEntity, const int32_t componentID);
|
||||
~DestroyableComponent() override;
|
||||
|
||||
void Update(float deltaTime) override;
|
||||
void Run(float deltaTime) override;
|
||||
void Serialize(RakNet::BitStream& outBitStream, bool bIsInitialUpdate) override;
|
||||
void LoadFromXml(const tinyxml2::XMLDocument& doc) override;
|
||||
void UpdateXml(tinyxml2::XMLDocument& doc) override;
|
||||
void LoadFromSaveData(const tinyxml2::XMLDocument& doc) override;
|
||||
void WriteSaveData(tinyxml2::XMLDocument& doc) override;
|
||||
|
||||
/**
|
||||
* Sets the health of this entity. Makes sure this is serialized on the next tick and if this is a character its
|
||||
|
||||
@@ -798,7 +798,7 @@ void InventoryComponent::LoadXml(const tinyxml2::XMLDocument& document) {
|
||||
}
|
||||
}
|
||||
|
||||
void InventoryComponent::UpdateXml(tinyxml2::XMLDocument& document) {
|
||||
void InventoryComponent::WriteSaveData(tinyxml2::XMLDocument& document) {
|
||||
UpdatePetXml(document);
|
||||
|
||||
auto* inventoryElement = document.FirstChildElement("obj")->FirstChildElement("inv");
|
||||
@@ -964,7 +964,7 @@ void InventoryComponent::Serialize(RakNet::BitStream& outBitStream, const bool b
|
||||
if (bIsInitialUpdate) outBitStream.Write<uint32_t>(0);
|
||||
}
|
||||
|
||||
void InventoryComponent::Update(float deltaTime) {
|
||||
void InventoryComponent::Run(float deltaTime) {
|
||||
for (auto* set : m_Itemsets) {
|
||||
set->Update(deltaTime);
|
||||
}
|
||||
|
||||
@@ -101,10 +101,10 @@ public:
|
||||
static constexpr eReplicaComponentType ComponentType = eReplicaComponentType::INVENTORY;
|
||||
InventoryComponent(Entity* parent, const int32_t componentID);
|
||||
|
||||
void Update(float deltaTime) override;
|
||||
void Run(float deltaTime) override;
|
||||
void Serialize(RakNet::BitStream& outBitStream, bool bIsInitialUpdate) override;
|
||||
void LoadXml(const tinyxml2::XMLDocument& document);
|
||||
void UpdateXml(tinyxml2::XMLDocument& document) override;
|
||||
void WriteSaveData(tinyxml2::XMLDocument& document) override;
|
||||
|
||||
/**
|
||||
* Returns an inventory of the specified type, if it exists
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#include "LUPExhibitComponent.h"
|
||||
#include "EntityManager.h"
|
||||
|
||||
void LUPExhibitComponent::Update(float deltaTime) {
|
||||
void LUPExhibitComponent::Run(float deltaTime) {
|
||||
m_UpdateTimer += deltaTime;
|
||||
if (m_UpdateTimer > 20.0f) {
|
||||
NextLUPExhibit();
|
||||
|
||||
@@ -17,7 +17,7 @@ public:
|
||||
static constexpr eReplicaComponentType ComponentType = eReplicaComponentType::LUP_EXHIBIT;
|
||||
|
||||
LUPExhibitComponent(Entity* parent, const int32_t componentID) : Component(parent, componentID) {};
|
||||
void Update(float deltaTime) override;
|
||||
void Run(float deltaTime) override;
|
||||
void Serialize(RakNet::BitStream& outBitStream, bool bIsInitialUpdate) override;
|
||||
void NextLUPExhibit();
|
||||
private:
|
||||
|
||||
@@ -14,7 +14,7 @@ LevelProgressionComponent::LevelProgressionComponent(Entity* parent, const int32
|
||||
m_CharacterVersion = eCharacterVersion::LIVE;
|
||||
}
|
||||
|
||||
void LevelProgressionComponent::UpdateXml(tinyxml2::XMLDocument& doc) {
|
||||
void LevelProgressionComponent::WriteSaveData(tinyxml2::XMLDocument& doc) {
|
||||
tinyxml2::XMLElement* level = doc.FirstChildElement("obj")->FirstChildElement("lvl");
|
||||
if (!level) {
|
||||
LOG("Failed to find lvl tag while updating XML!");
|
||||
@@ -25,7 +25,7 @@ void LevelProgressionComponent::UpdateXml(tinyxml2::XMLDocument& doc) {
|
||||
level->SetAttribute("cv", static_cast<uint32_t>(m_CharacterVersion));
|
||||
}
|
||||
|
||||
void LevelProgressionComponent::LoadFromXml(const tinyxml2::XMLDocument& doc) {
|
||||
void LevelProgressionComponent::LoadFromSaveData(const tinyxml2::XMLDocument& doc) {
|
||||
auto* level = doc.FirstChildElement("obj")->FirstChildElement("lvl");
|
||||
if (!level) {
|
||||
LOG("Failed to find lvl tag while loading XML!");
|
||||
|
||||
@@ -27,13 +27,13 @@ public:
|
||||
* Save data from this componennt to character XML
|
||||
* @param doc the document to write data to
|
||||
*/
|
||||
void UpdateXml(tinyxml2::XMLDocument& doc) override;
|
||||
void WriteSaveData(tinyxml2::XMLDocument& doc) override;
|
||||
|
||||
/**
|
||||
* Load base data for this component from character XML
|
||||
* @param doc the document to read data from
|
||||
*/
|
||||
void LoadFromXml(const tinyxml2::XMLDocument& doc) override;
|
||||
void LoadFromSaveData(const tinyxml2::XMLDocument& doc) override;
|
||||
|
||||
/**
|
||||
* Gets the current level of the entity
|
||||
|
||||
@@ -446,7 +446,7 @@ bool MissionComponent::RequiresItem(const LOT lot) {
|
||||
}
|
||||
|
||||
|
||||
void MissionComponent::LoadFromXml(const tinyxml2::XMLDocument& doc) {
|
||||
void MissionComponent::LoadFromSaveData(const tinyxml2::XMLDocument& doc) {
|
||||
auto* mis = doc.FirstChildElement("obj")->FirstChildElement("mis");
|
||||
|
||||
if (mis == nullptr) return;
|
||||
@@ -512,7 +512,7 @@ void MissionComponent::LoadFromXml(const tinyxml2::XMLDocument& doc) {
|
||||
}
|
||||
|
||||
|
||||
void MissionComponent::UpdateXml(tinyxml2::XMLDocument& doc) {
|
||||
void MissionComponent::WriteSaveData(tinyxml2::XMLDocument& doc) {
|
||||
auto shouldInsertMis = false;
|
||||
|
||||
auto* obj = doc.FirstChildElement("obj");
|
||||
|
||||
@@ -33,8 +33,8 @@ public:
|
||||
explicit MissionComponent(Entity* parent, const int32_t componentID);
|
||||
~MissionComponent() override;
|
||||
void Serialize(RakNet::BitStream& outBitStream, bool bIsInitialUpdate, unsigned int& flags);
|
||||
void LoadFromXml(const tinyxml2::XMLDocument& doc) override;
|
||||
void UpdateXml(tinyxml2::XMLDocument& doc) override;
|
||||
void LoadFromSaveData(const tinyxml2::XMLDocument& doc) override;
|
||||
void WriteSaveData(tinyxml2::XMLDocument& doc) override;
|
||||
|
||||
/**
|
||||
* Returns all the missions for this entity, mapped by mission ID
|
||||
|
||||
@@ -73,7 +73,7 @@ bool ModelComponent::OnRequestUse(GameMessages::RequestUseEvent& event) {
|
||||
return toReturn;
|
||||
}
|
||||
|
||||
void ModelComponent::Update(float deltaTime) {
|
||||
void ModelComponent::Run(float deltaTime) {
|
||||
if (m_IsPaused) return;
|
||||
|
||||
for (auto& behavior : m_Behaviors) {
|
||||
|
||||
@@ -32,7 +32,7 @@ public:
|
||||
ModelComponent(Entity* parent, const int32_t componentID);
|
||||
|
||||
void LoadBehaviors();
|
||||
void Update(float deltaTime) override;
|
||||
void Run(float deltaTime) override;
|
||||
|
||||
bool OnRequestUse(GameMessages::RequestUseEvent& event);
|
||||
bool OnResetModelToDefaults(GameMessages::ResetModelToDefaults& resetModelToDefaults);
|
||||
|
||||
@@ -64,7 +64,7 @@ void ModuleAssemblyComponent::Serialize(RakNet::BitStream& outBitStream, bool bI
|
||||
}
|
||||
}
|
||||
|
||||
void ModuleAssemblyComponent::Update(float deltaTime) {
|
||||
void ModuleAssemblyComponent::Run(float deltaTime) {
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@ public:
|
||||
~ModuleAssemblyComponent() override;
|
||||
|
||||
void Serialize(RakNet::BitStream& outBitStream, bool bIsInitialUpdate) override;
|
||||
void Update(float deltaTime) override;
|
||||
void Run(float deltaTime) override;
|
||||
|
||||
/**
|
||||
* Sets the subkey of this entity
|
||||
|
||||
@@ -107,7 +107,7 @@ void MovementAIComponent::Resume() {
|
||||
Game::entityManager->SerializeEntity(m_Parent);
|
||||
}
|
||||
|
||||
void MovementAIComponent::Update(const float deltaTime) {
|
||||
void MovementAIComponent::Run(const float deltaTime) {
|
||||
if (IsKnockedBack()) {
|
||||
UpdateKnockback(deltaTime);
|
||||
return;
|
||||
|
||||
@@ -68,7 +68,7 @@ public:
|
||||
|
||||
void SetPath(const std::string pathName);
|
||||
|
||||
void Update(float deltaTime) override;
|
||||
void Run(float deltaTime) override;
|
||||
|
||||
/**
|
||||
* Returns the basic settings that this entity uses to move around
|
||||
|
||||
@@ -449,7 +449,7 @@ void MovingPlatformComponent::MoverArrive() {
|
||||
FireArrivalHooks(arrived, atDesired, atEnd);
|
||||
}
|
||||
|
||||
void MovingPlatformComponent::Update(const float deltaTime) {
|
||||
void MovingPlatformComponent::Run(const float deltaTime) {
|
||||
if (!IsMover()) return;
|
||||
auto* const mover = GetMoverSubComponent();
|
||||
if ((mover->mState & ePlatformStateFlag::Travelling) != 0) {
|
||||
|
||||
@@ -282,7 +282,7 @@ private:
|
||||
void MoverArrive();
|
||||
|
||||
public:
|
||||
void Update(float deltaTime) override;
|
||||
void Run(float deltaTime) override;
|
||||
|
||||
// The mover's state as a PlatformResync gives it (RequestPlatformResync)
|
||||
void FillResync(GameMessages::PlatformResync& resync) const;
|
||||
|
||||
@@ -256,7 +256,7 @@ void PetComponent::OnUse(Entity* originator) {
|
||||
}
|
||||
}
|
||||
|
||||
void PetComponent::Update(float deltaTime) {
|
||||
void PetComponent::Run(float deltaTime) {
|
||||
if (m_StartPosition == NiPoint3Constant::ZERO) {
|
||||
m_StartPosition = m_Parent->GetPosition();
|
||||
m_StartRotation = m_Parent->GetRotation();
|
||||
|
||||
@@ -40,7 +40,7 @@ public:
|
||||
~PetComponent() override;
|
||||
|
||||
void Serialize(RakNet::BitStream& outBitStream, bool bIsInitialUpdate) override;
|
||||
void Update(float deltaTime) override;
|
||||
void Run(float deltaTime) override;
|
||||
|
||||
/**
|
||||
* Handles an OnUse event from another entity, initializing the pet taming minigame if this pet is untamed.
|
||||
|
||||
@@ -179,7 +179,7 @@ void ApplyCollisionEffect(const LWOOBJID& target, const ePhysicsEffectType effec
|
||||
// The other types are not handled by the server and are here to handle all cases of the enum.
|
||||
}
|
||||
|
||||
void PhantomPhysicsComponent::Update(float deltaTime) {
|
||||
void PhantomPhysicsComponent::Run(float deltaTime) {
|
||||
if (!m_dpEntity || !m_PhysicsActive) return;
|
||||
|
||||
//Process enter events
|
||||
|
||||
@@ -29,7 +29,7 @@ public:
|
||||
|
||||
PhantomPhysicsComponent(Entity* parent, const int32_t componentID);
|
||||
~PhantomPhysicsComponent() override;
|
||||
void Update(float deltaTime) override;
|
||||
void Run(float deltaTime) override;
|
||||
void Serialize(RakNet::BitStream& outBitStream, bool bIsInitialUpdate) override;
|
||||
|
||||
/**
|
||||
|
||||
@@ -100,7 +100,7 @@ bool ProximityMonitorComponent::OnGetObjectReportInfo(GameMessages::GetObjectRep
|
||||
return true;
|
||||
}
|
||||
|
||||
void ProximityMonitorComponent::Update(float deltaTime) {
|
||||
void ProximityMonitorComponent::Run(float deltaTime) {
|
||||
for (const auto& prox : m_ProximitiesData) {
|
||||
if (!prox.second) continue;
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@ public:
|
||||
|
||||
ProximityMonitorComponent(Entity* parentEntity, const int32_t componentID, int smallRadius = -1, int largeRadius = -1);
|
||||
~ProximityMonitorComponent() override;
|
||||
void Update(float deltaTime) override;
|
||||
void Run(float deltaTime) override;
|
||||
|
||||
/**
|
||||
* Creates an entry to check proximity for, given a name
|
||||
|
||||
@@ -111,7 +111,7 @@ void QuickBuildComponent::Serialize(RakNet::BitStream& outBitStream, bool bIsIni
|
||||
}
|
||||
}
|
||||
|
||||
void QuickBuildComponent::Update(float deltaTime) {
|
||||
void QuickBuildComponent::Run(float deltaTime) {
|
||||
SetActivator(GetActivator());
|
||||
|
||||
switch (m_State) {
|
||||
|
||||
@@ -28,7 +28,7 @@ public:
|
||||
~QuickBuildComponent() override;
|
||||
|
||||
void Serialize(RakNet::BitStream& outBitStream, bool bIsInitialUpdate) override;
|
||||
void Update(float deltaTime) override;
|
||||
void Run(float deltaTime) override;
|
||||
|
||||
/**
|
||||
* Handles a OnUse event from some entity, initiating the quick build
|
||||
|
||||
@@ -572,7 +572,7 @@ RacingPlayerInfo* RacingControlComponent::GetPlayerData(LWOOBJID playerID) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void RacingControlComponent::Update(float deltaTime) {
|
||||
void RacingControlComponent::Run(float deltaTime) {
|
||||
// This method is a mess.
|
||||
|
||||
// Pre-load routine
|
||||
|
||||
@@ -129,7 +129,7 @@ public:
|
||||
~RacingControlComponent();
|
||||
|
||||
void Serialize(RakNet::BitStream& outBitStream, bool bIsInitialUpdate) override;
|
||||
void Update(float deltaTime) override;
|
||||
void Run(float deltaTime) override;
|
||||
|
||||
/**
|
||||
* Invoked when a player loads into the zone.
|
||||
|
||||
@@ -83,7 +83,7 @@ void RenderComponent::RemoveEffect(const std::string& name) {
|
||||
m_Effects.pop_back();
|
||||
}
|
||||
|
||||
void RenderComponent::Update(const float deltaTime) {
|
||||
void RenderComponent::Run(const float deltaTime) {
|
||||
for (auto& effect : m_Effects) {
|
||||
if (effect.time == 0) continue; // Skip persistent effects
|
||||
|
||||
|
||||
@@ -66,7 +66,7 @@ public:
|
||||
RenderComponent(Entity* const parentEntity, const int32_t componentID);
|
||||
|
||||
void Serialize(RakNet::BitStream& outBitStream, bool bIsInitialUpdate) override;
|
||||
void Update(float deltaTime) override;
|
||||
void Run(float deltaTime) override;
|
||||
|
||||
/**
|
||||
* Adds an effect to this entity, if successful the effect is returned
|
||||
|
||||
@@ -37,7 +37,7 @@ void RigidbodyPhantomPhysicsComponent::Serialize(RakNet::BitStream& outBitStream
|
||||
PhysicsComponent::Serialize(outBitStream, bIsInitialUpdate);
|
||||
}
|
||||
|
||||
void RigidbodyPhantomPhysicsComponent::Update(const float deltaTime) {
|
||||
void RigidbodyPhantomPhysicsComponent::Run(const float deltaTime) {
|
||||
if (!m_dpEntity) return;
|
||||
|
||||
//Process enter events
|
||||
|
||||
@@ -23,7 +23,7 @@ public:
|
||||
|
||||
RigidbodyPhantomPhysicsComponent(Entity* parent, const int32_t componentID);
|
||||
|
||||
void Update(const float deltaTime) override;
|
||||
void Run(const float deltaTime) override;
|
||||
|
||||
void Serialize(RakNet::BitStream& outBitStream, bool bIsInitialUpdate) override;
|
||||
|
||||
|
||||
@@ -41,7 +41,7 @@ SimplePhysicsComponent::SimplePhysicsComponent(Entity* parent, const int32_t com
|
||||
SimplePhysicsComponent::~SimplePhysicsComponent() {
|
||||
}
|
||||
|
||||
void SimplePhysicsComponent::Update(const float deltaTime) {
|
||||
void SimplePhysicsComponent::Run(const float deltaTime) {
|
||||
if (m_Velocity == NiPoint3Constant::ZERO) return;
|
||||
m_Position += m_Velocity * deltaTime;
|
||||
m_DirtyPosition = true;
|
||||
|
||||
@@ -38,7 +38,7 @@ public:
|
||||
SimplePhysicsComponent(Entity* parent, const int32_t componentID);
|
||||
~SimplePhysicsComponent() override;
|
||||
|
||||
void Update(const float deltaTime) override;
|
||||
void Run(const float deltaTime) override;
|
||||
|
||||
void Serialize(RakNet::BitStream& outBitStream, bool bIsInitialUpdate) override;
|
||||
|
||||
|
||||
@@ -63,7 +63,7 @@ void SkillComponent::StartCooldown(const uint32_t skillID) {
|
||||
left = std::max(left, skill.cooldown);
|
||||
}
|
||||
|
||||
void SkillComponent::LoadFromXml(const tinyxml2::XMLDocument& doc) {
|
||||
void SkillComponent::LoadFromSaveData(const tinyxml2::XMLDocument& doc) {
|
||||
m_CooldownGroups.clear();
|
||||
const auto* const obj = doc.FirstChildElement("obj");
|
||||
const auto* const skil = obj ? obj->FirstChildElement("skil") : nullptr;
|
||||
@@ -81,7 +81,7 @@ void SkillComponent::LoadFromXml(const tinyxml2::XMLDocument& doc) {
|
||||
}
|
||||
}
|
||||
|
||||
void SkillComponent::UpdateXml(tinyxml2::XMLDocument& doc) {
|
||||
void SkillComponent::WriteSaveData(tinyxml2::XMLDocument& doc) {
|
||||
auto* const obj = doc.FirstChildElement("obj");
|
||||
if (!obj) return;
|
||||
auto* skil = obj->FirstChildElement("skil");
|
||||
@@ -184,7 +184,7 @@ void SkillComponent::RegisterPlayerProjectile(const LWOOBJID projectileId, Behav
|
||||
this->m_managedProjectiles.push_back(entry);
|
||||
}
|
||||
|
||||
void SkillComponent::Update(const float deltaTime) {
|
||||
void SkillComponent::Run(const float deltaTime) {
|
||||
for (auto it = m_CooldownGroups.begin(); it != m_CooldownGroups.end();) {
|
||||
it->second -= deltaTime;
|
||||
it = it->second <= 0.0f ? m_CooldownGroups.erase(it) : std::next(it);
|
||||
|
||||
@@ -71,18 +71,18 @@ public:
|
||||
/**
|
||||
* Computes skill updates. Invokes CalculateUpdate.
|
||||
*/
|
||||
void Update(float deltaTime) override;
|
||||
void Run(float deltaTime) override;
|
||||
|
||||
/**
|
||||
* Loads the cooldown groups still running at the last save: <skil sc="group:seconds;group:seconds;"/>
|
||||
*/
|
||||
void LoadFromXml(const tinyxml2::XMLDocument& doc) override;
|
||||
void LoadFromSaveData(const tinyxml2::XMLDocument& doc) override;
|
||||
|
||||
/**
|
||||
* Saves the running cooldown groups the way live did and the client reads them (LWOSkillComponent::LoadFromSaveData
|
||||
* 0x00c2a9c0 splits sc on ';' and ':' into a cooldown group and the seconds left)
|
||||
*/
|
||||
void UpdateXml(tinyxml2::XMLDocument& doc) override;
|
||||
void WriteSaveData(tinyxml2::XMLDocument& doc) override;
|
||||
|
||||
/**
|
||||
* Starts the cooldown of a skill's cooldown group (SkillBehavior.cooldowngroup, cooldown) when the player casts it
|
||||
|
||||
@@ -94,7 +94,7 @@ void SwitchComponent::EntityLeave(Entity* entity) {
|
||||
|
||||
}
|
||||
|
||||
void SwitchComponent::Update(float deltaTime) {
|
||||
void SwitchComponent::Run(float deltaTime) {
|
||||
if (m_Active) {
|
||||
m_Timer -= deltaTime;
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@ public:
|
||||
SwitchComponent(Entity* parent, const int32_t componentID);
|
||||
~SwitchComponent() override;
|
||||
|
||||
void Update(float deltaTime) override;
|
||||
void Run(float deltaTime) override;
|
||||
void OnUse(Entity* originator) override;
|
||||
|
||||
Entity* GetParentEntity() const;
|
||||
|
||||
Reference in New Issue
Block a user