feat(component): the BBB component only where the client has one

The client makes a BBB component (76) for a character (DoObjectPreLoad, LOT 1)
and for registry entries (none in the CDClient), and reads it last
(LWOBBBComponent::Deserialize: a metadata-source-item bit and the item).
DLU wrote a placeholder 0 bit at the end of every construction; now only a
character's BBBComponent writes it. Every other object sends one bit less,
which the client never read (live non-player constructions decode without
it; the zone control object stays byte for byte equal to live).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Aaron Kimbrell
2026-10-01 17:18:52 -05:00
parent 243b2106bc
commit 6627b022d4
3 changed files with 41 additions and 10 deletions

View File

@@ -99,6 +99,7 @@
#include "PetCreatorComponent.h"
#include "HFLightDirectionGadgetComponent.h"
#include "SpawnerComponent.h"
#include "BBBComponent.h"
#include "ExhibitComponent.h"
#include "PathfindingComponent.h"
#include "PhysicsSystemComponent.h"
@@ -929,6 +930,12 @@ void Entity::DoObjectComponentLoad(ObjectLoadState& state) {
if (id > -1) AddComponent<ExhibitComponent>(id);
break;
}
case eReplicaComponentType::BBB: {
// DoObjectPreLoad gives a character (LOT 1) one with id 0; any other object the registry's
const auto id = m_TemplateID == 1 ? 0 : state.GetComponentID(eReplicaComponentType::BBB, -1);
if (id > -1) AddComponent<BBBComponent>(id);
break;
}
case eReplicaComponentType::ROCKET_LANDING: {
// LWORocketAnimationControlComponent: the client makes it from the registry
const auto id = state.GetComponentID(eReplicaComponentType::ROCKET_LANDING, -1);
@@ -1301,7 +1308,7 @@ namespace {
PHANTOM_PHYSICS, SOUND_TRIGGER, RACING_SOUND_TRIGGER, BUFF, DESTROYABLE, COLLECTIBLE, PET, PLAYER_FORCED_MOVEMENT, CHARACTER,
INVENTORY,
SCRIPT, SKILL, BASE_COMBAT_AI, ITEM, QUICK_BUILD, MOVING_PLATFORM, SWITCH, VENDOR, DONATION_VENDOR, ACHIEVEMENT_VENDOR,
BOUNCER, SCRIPTED_ACTIVITY, SHOOTING_GALLERY, RACING_CONTROL, LUP_EXHIBIT, MODEL, RENDER, MINI_GAME_CONTROL,
BOUNCER, SCRIPTED_ACTIVITY, SHOOTING_GALLERY, RACING_CONTROL, LUP_EXHIBIT, MODEL, RENDER, MINI_GAME_CONTROL, BBB,
};
}();
@@ -1343,11 +1350,6 @@ void Entity::WriteComponents(RakNet::BitStream& outBitStream, eReplicaPacketType
}
component->Serialize(outBitStream, bIsInitialUpdate);
}
// BBB Component, unused currently
// Need to to write0 so that is serialized correctly
// TODO: Implement BBB Component
outBitStream.Write0();
}
void Entity::UpdateXMLDoc(tinyxml2::XMLDocument& doc) {

View File

@@ -0,0 +1,31 @@
#ifndef BBBCOMPONENT_H
#define BBBCOMPONENT_H
#include "BitStream.h"
#include "Component.h"
#include "dCommonVars.h"
#include "eReplicaComponentType.h"
/**
* The BBB component (76), as the client's LWOBBBComponent: DoObjectPreLoad gives every character one (and the registry
* any object listing it). It sends whether there is a metadata source item, then the item's ID.
*/
class BBBComponent final : public Component {
public:
static constexpr eReplicaComponentType ComponentType = eReplicaComponentType::BBB;
BBBComponent(Entity* parent, const int32_t componentID) : Component(parent, componentID) {}
// LWOBBBComponent::Deserialize 0x00bd6690
void Serialize(RakNet::BitStream& outBitStream, bool bIsInitialUpdate) override {
outBitStream.Write(m_MetadataSourceItem != LWOOBJID_EMPTY);
if (m_MetadataSourceItem != LWOOBJID_EMPTY) outBitStream.Write(m_MetadataSourceItem);
}
void SetMetadataSourceItem(const LWOOBJID item) { m_MetadataSourceItem = item; }
private:
LWOOBJID m_MetadataSourceItem = LWOOBJID_EMPTY;
};
#endif // BBBCOMPONENT_H

View File

@@ -283,10 +283,8 @@ namespace {
miniGameControlComponent->Serialize(outBitStream, bIsInitialUpdate);
}
// BBB Component, unused currently
// Need to to write0 so that is serialized correctly
// TODO: Implement BBB Component
outBitStream.Write0();
// The BBB component (characters): no metadata source item
if (entity.GetLOT() == 1) outBitStream.Write0();
}