mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2026-11-16 00:35:27 +00:00
fix(entity): models get their item component, as the client makes it
The client makes the registry's item component for models too (only a pet takes it away); DLU skipped it and the model component wrote the item block itself, for the 30 model LOTs without an item row as well, and with the object id as ug_id. Live (Raven Bluff property capture): the item block carries the userModelID for brick built models (LOT 14) and 0 for reward models (LOT 8069). 1,455 LOTs gain the item component; nothing else changes (LoaderSnapshotTest). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -262,6 +262,8 @@ void Entity::Initialize() {
|
||||
|
||||
AddComponent<SimplePhysicsComponent>(simplePhysicsComponentID);
|
||||
|
||||
AddComponent<ItemComponent>(compRegistryTable->GetByIDAndType(m_TemplateID, eReplicaComponentType::ITEM));
|
||||
|
||||
AddComponent<ModelComponent>(-1)->LoadBehaviors();
|
||||
|
||||
AddComponent<RenderComponent>(-1);
|
||||
@@ -646,11 +648,11 @@ void Entity::Initialize() {
|
||||
break;
|
||||
}
|
||||
case eReplicaComponentType::ITEM: {
|
||||
// A pet takes the item (and model) component away (LWOPetComponent::Factory); models keep theirs (live: an
|
||||
// item block before the model's)
|
||||
PetComponent* petComponent{};
|
||||
const auto itemID = compRegistryTable->GetByIDAndType(m_TemplateID, eReplicaComponentType::ITEM);
|
||||
// The model (42) comes later in the client's order: a model without a pet has no item component
|
||||
const bool hasModel = compRegistryTable->GetByIDAndType(m_TemplateID, eReplicaComponentType::MODEL, -1) > -1 && petComponentID <= 0;
|
||||
if (itemID > 0 && !TryGetComponent(eReplicaComponentType::PET, petComponent) && !hasModel) {
|
||||
if (itemID > 0 && !TryGetComponent(eReplicaComponentType::PET, petComponent)) {
|
||||
AddComponent<ItemComponent>(itemID);
|
||||
}
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user