refactor(component): an object's starting inventory loads in LoadDataFromTemplate

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Aaron Kimbrell
2026-10-01 08:19:07 -05:00
parent 2b8b682a0b
commit 1cdac362ff
2 changed files with 9 additions and 2 deletions

View File

@@ -108,9 +108,14 @@ InventoryComponent::InventoryComponent(Entity* parent, const int32_t componentID
if (character) LoadXml(character->GetXMLDoc());
CheckProxyIntegrity();
return;
}
}
// An object's starting inventory from the InventoryComponent rows, with the equipped items (a character's comes from
// its save instead)
void InventoryComponent::LoadDataFromTemplate() {
const auto lot = m_Parent->GetLOT();
if (lot == 1) return;
auto* compRegistryTable = CDClientManager::GetTable<CDComponentsRegistryTable>();
const auto componentId = compRegistryTable->GetByIDAndType(lot, eReplicaComponentType::INVENTORY);

View File

@@ -101,6 +101,8 @@ public:
static constexpr eReplicaComponentType ComponentType = eReplicaComponentType::INVENTORY;
InventoryComponent(Entity* parent, const int32_t componentID);
void LoadDataFromTemplate() override;
void Run(float deltaTime) override;
void Serialize(RakNet::BitStream& outBitStream, bool bIsInitialUpdate) override;
void LoadXml(const tinyxml2::XMLDocument& document);