fix pet taming minigame countdown

This commit is contained in:
jadebenn 2024-03-03 19:50:13 -06:00
parent 1c1b7337b1
commit c36bc8389a
2 changed files with 5 additions and 31 deletions

View File

@ -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();

View File

@ -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