fix(entity): a quick build without a destroyable gets one, as the client makes it

DoObjectComponentLoad adds a destroyable (componentID -1) to a quick build that has none and marks it smashable. DLU's quick build wrote three empty flags instead. The construction's destroyable now matches live field for field (AG LOT 7804: health 1 / 1.0, armor 1 / 0, faction -1, smashable). 117 LOTs gain it; nothing else changes (LoaderSnapshotTest).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Aaron Kimbrell
2026-10-01 06:31:19 -05:00
parent cc337a298d
commit 3bd299d682

View File

@@ -669,6 +669,17 @@ void Entity::Initialize() {
if (quickBuildComponentID > 0) {
auto* const quickBuildComponent = AddComponent<QuickBuildComponent>(quickBuildComponentID);
// A quick build without a destroyable gets one (componentID -1) and is smashable, as the client makes it
// (DoObjectComponentLoad); live: health 1 / 1.0, armor 1 / 0, faction -1, smashable (AG LOT 7804)
if (!HasComponent(eReplicaComponentType::DESTROYABLE)) {
auto* const destroyable = AddComponent<DestroyableComponent>(-1);
destroyable->SetMaxHealth(1.0f);
destroyable->SetHealth(1);
destroyable->SetArmor(1);
destroyable->SetFaction(-1, true);
destroyable->SetIsSmashable(true);
}
CDRebuildComponentTable* const rebCompTable = CDClientManager::GetTable<CDRebuildComponentTable>();
const std::vector<CDRebuildComponent> rebCompData = rebCompTable->Query([quickBuildComponentID](CDRebuildComponent entry) { return (entry.id == quickBuildComponentID); });