mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2026-11-18 17:55:27 +00:00
refactor(component): the destroyable loads itself in the client's phases
The DestructibleComponent row moves from Entity::Initialize into LoadDataFromTemplate and the level keys into LoadConfigData; a character's save loads after both. Like the client (LWODestroyableComponent::LoadConfigData reads them for every destroyable), the destroyables added for models and quickbuilds now also read set_faction, is_smashable and the level loot matrix; their live defaults become their template. Nothing changes for objects without those keys. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -44,9 +44,13 @@ class DestroyableComponent final : public Component {
|
||||
public:
|
||||
static constexpr eReplicaComponentType ComponentType = eReplicaComponentType::DESTROYABLE;
|
||||
|
||||
DestroyableComponent(Entity* parentEntity, const int32_t componentID);
|
||||
// smashableDefaults: a destroyable the loader adds to a model or quickbuild, with live's defaults and no row
|
||||
DestroyableComponent(Entity* parentEntity, const int32_t componentID, const bool smashableDefaults = false);
|
||||
~DestroyableComponent() override;
|
||||
|
||||
void LoadDataFromTemplate() override;
|
||||
void LoadConfigData() override;
|
||||
|
||||
void Run(float deltaTime) override;
|
||||
void Serialize(RakNet::BitStream& outBitStream, bool bIsInitialUpdate) override;
|
||||
void LoadFromSaveData(const tinyxml2::XMLDocument& doc) override;
|
||||
@@ -700,6 +704,9 @@ private:
|
||||
* Damage immunity cooldown timer. Set to a value that then counts down to create a damage cooldown for players
|
||||
*/
|
||||
float m_DamageCooldownTimer;
|
||||
|
||||
// Made by the loader for a model or quickbuild: live's smashable defaults in place of a row
|
||||
bool m_SmashableDefaults{ false };
|
||||
};
|
||||
|
||||
#endif // DESTROYABLECOMPONENT_H
|
||||
|
||||
Reference in New Issue
Block a user