diff --git a/dGame/dComponents/Property/PropertyManagementComponent.cpp b/dGame/dComponents/Property/PropertyManagementComponent.cpp index 1a9f1ba7e..4012f006a 100644 --- a/dGame/dComponents/Property/PropertyManagementComponent.cpp +++ b/dGame/dComponents/Property/PropertyManagementComponent.cpp @@ -529,6 +529,15 @@ void PropertyManagementComponent::UpdateModelPosition(Entity& builder, const LWO return; } + // Only a model is placed on a property + const auto* const itemInventory = item->GetInventory(); + const auto itemInventoryType = itemInventory ? itemInventory->GetType() : eInventoryType::INVALID; + if (itemInventoryType != eInventoryType::MODELS && itemInventoryType != eInventoryType::MODELS_IN_BBB && itemInventoryType != eInventoryType::TEMP_MODELS) { + LOG("Item %llu (LOT %i) is not in a model inventory and can not be placed", id, item->GetLot()); + + return; + } + const NiQuaternion originalRotation = rotation; if (rotation != QuatUtils::IDENTITY) { rotation = { rotation.w, rotation.z, rotation.y, rotation.x }; diff --git a/dGame/dGameMessages/PropertyMessages.cpp b/dGame/dGameMessages/PropertyMessages.cpp index 25c3a6212..0709904a3 100644 --- a/dGame/dGameMessages/PropertyMessages.cpp +++ b/dGame/dGameMessages/PropertyMessages.cpp @@ -444,11 +444,11 @@ namespace GameMessages { } void PropertyContentsFromClient::Handle(Entity& entity, const SystemAddress& sysAddr) { - User* user = UserManager::Instance()->GetUser(sysAddr); + const auto* const player = PlayerManager::GetPlayer(sysAddr); + const auto* const propertyManagementComponent = PropertyManagementComponent::Instance(); + if (!player || !propertyManagementComponent) return; - Entity* player = Game::entityManager->GetEntity(user->GetLoggedInChar()); - - const auto& models = PropertyManagementComponent::Instance()->GetModels(); + const auto& models = propertyManagementComponent->GetModels(); GetModelsOnProperty modelsOnProperty; modelsOnProperty.target = player->GetObjectID(); modelsOnProperty.models = { models.begin(), models.end() };