Skip to content

Commit

Permalink
fix: Ugc model pickup (#1275)
Browse files Browse the repository at this point in the history
* Ugc: Make it so we dont bin the model

Users must dismantle the model as opposed to accidentally picking it up in model mode

* Fix editing model in brick mode

* PropEntrance: Remove debug log
  • Loading branch information
EmosewaMC authored Nov 16, 2023
1 parent a44f998 commit f59ca8b
Showing 1 changed file with 19 additions and 8 deletions.
27 changes: 19 additions & 8 deletions dGame/dComponents/PropertyManagementComponent.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -423,6 +423,25 @@ void PropertyManagementComponent::DeleteModel(const LWOOBJID id, const int delet
return;
}

auto* model = Game::entityManager->GetEntity(id);

if (model == nullptr) {
LOG("Failed to find model entity");

return;
}

if (model->GetLOT() == 14 && deleteReason == 0) {
LOG("User is trying to pick up a BBB model, but this is not implemented, so we return to prevent the user from losing the model");

GameMessages::SendUGCEquipPostDeleteBasedOnEditMode(entity->GetObjectID(), entity->GetSystemAddress(), LWOOBJID_EMPTY, 0);

// Need this to pop the user out of their current state
GameMessages::SendPlaceModelResponse(entity->GetObjectID(), entity->GetSystemAddress(), entity->GetPosition(), m_Parent->GetObjectID(), 14, entity->GetRotation());

return;
}

const auto index = models.find(id);

if (index == models.end()) {
Expand All @@ -441,14 +460,6 @@ void PropertyManagementComponent::DeleteModel(const LWOOBJID id, const int delet
LOG("Failed to find spawner");
}

auto* model = Game::entityManager->GetEntity(id);

if (model == nullptr) {
LOG("Failed to find model entity");

return;
}

Game::entityManager->DestructEntity(model);

LOG("Deleting model LOT %i", model->GetLOT());
Expand Down

0 comments on commit f59ca8b

Please sign in to comment.