From e2b2c4c48d4088c9e3df7066a34c10ee91749439 Mon Sep 17 00:00:00 2001 From: Aaron Kimbrell Date: Thu, 1 Oct 2026 06:54:42 -0500 Subject: [PATCH] feat(entity): the client's chest component (22) Co-Authored-By: Claude Opus 5.5 --- dGame/Entity.cpp | 7 +++++++ dGame/dComponents/ChestComponent.h | 17 +++++++++++++++++ 2 files changed, 24 insertions(+) create mode 100644 dGame/dComponents/ChestComponent.h diff --git a/dGame/Entity.cpp b/dGame/Entity.cpp index bb00d6c47..807d46175 100644 --- a/dGame/Entity.cpp +++ b/dGame/Entity.cpp @@ -90,6 +90,7 @@ #include "CollectibleComponent.h" #include "ItemComponent.h" #include "MinifigComponent.h" +#include "ChestComponent.h" #include "RebuildActivatorComponent.h" #include "BuildControllerComponent.h" #include "ModularBuildComponent.h" @@ -987,6 +988,12 @@ void Entity::Initialize() { if (id > -1) AddComponent(id); break; } + case eReplicaComponentType::CHEST: { + // LWOChestComponent: the client makes it from the registry + const auto id = compRegistryTable->GetByIDAndType(m_TemplateID, eReplicaComponentType::CHEST, -1); + if (id > -1) AddComponent(id); + break; + } default: break; } diff --git a/dGame/dComponents/ChestComponent.h b/dGame/dComponents/ChestComponent.h new file mode 100644 index 000000000..391904202 --- /dev/null +++ b/dGame/dComponents/ChestComponent.h @@ -0,0 +1,17 @@ +#ifndef CHESTCOMPONENT_H +#define CHESTCOMPONENT_H + +#include "Component.h" +#include "eReplicaComponentType.h" + +/** + * Chest, as the client's LWOChestComponent makes it from the registry. Nothing of it is sent or done on the server yet. + */ +class ChestComponent final : public Component { +public: + static constexpr eReplicaComponentType ComponentType = eReplicaComponentType::CHEST; + + ChestComponent(Entity* parent, const int32_t componentID) : Component(parent, componentID) {} +}; + +#endif // CHESTCOMPONENT_H