diff --git a/dGame/dComponents/PetComponent.cpp b/dGame/dComponents/PetComponent.cpp index 392b1c11..55658389 100644 --- a/dGame/dComponents/PetComponent.cpp +++ b/dGame/dComponents/PetComponent.cpp @@ -343,13 +343,15 @@ void PetComponent::Update(float deltaTime) { return; } - // Remove "left behind" pets + // Remove "left behind" pets and handle failing pet taming minigame if (m_Owner != LWOOBJID_EMPTY) { const Entity* const owner = GetOwner(); if (!owner) { m_Parent->Kill(); return; } + } else { + ClientFailTamingMinigame(); // TODO: This is not despawning the built model correctly } if (HasFlag(SPAWNING)) OnSpawn(); @@ -384,28 +386,6 @@ void PetComponent::Update(float deltaTime) { } } -void PetComponent::UpdateUnowned(float deltaTime) { //TODO: CURRENTLY UNUSED - if (m_Tamer != LWOOBJID_EMPTY) { - if (m_Timer > 0) { - m_Timer -= deltaTime; - - if (m_Timer <= 0) { - m_Timer = 0; - - ClientFailTamingMinigame(); - } - } - } else { - if (m_Timer > 0) { - m_Timer -= deltaTime; - - if (m_Timer <= 0) Wander(); - } else { - m_Timer = 5; - } - } -} - void PetComponent::TryBuild(uint32_t numBricks, bool clientFailed) { if (m_Tamer == LWOOBJID_EMPTY) return; @@ -894,7 +874,7 @@ void PetComponent::StopInteract(bool bDontSerialize) { SetInteractType(PetInteractType::none); SetAbility(petAbility); SetPetAiState(PetAiState::follow); - SetOnlyFlag(IDLE); //SetStatus(PetFlag::NONE); + SetOnlyFlag(IDLE); SetIsReadyToInteract(false); SetIsHandlingInteraction(false); // Needed? m_MovementAI->SetMaxSpeed(m_PetInfo.sprintSpeed); @@ -1071,7 +1051,7 @@ void PetComponent::Activate(Item* item, bool registerPet, bool fromTaming) { // auto* const inventoryComponent = item->GetInventory()->GetComponent(); - if (inventoryComponent == nullptr) return; + if (!inventoryComponent) return; inventoryComponent->DespawnPet(); diff --git a/dGame/dComponents/PetComponent.h b/dGame/dComponents/PetComponent.h index 7f3e79aa..0d823b53 100644 --- a/dGame/dComponents/PetComponent.h +++ b/dGame/dComponents/PetComponent.h @@ -139,12 +139,6 @@ public: */ void Update(float deltaTime) override; - /** - * Handles updates for unowned pets - * @param deltaTime time since last update - */ - void UpdateUnowned(float deltaTime); - /** * Handles an OnUse event from another entity, initializing the pet taming minigame if this pet is untamed. * @param originator the entity that triggered the event