Add pet imagination draining

Address an issue where pets did not consume imagination when they were spawned.
This commit is contained in:
EmosewaMC
2022-06-17 23:53:09 -07:00
parent e28b084395
commit 35ea3d35ae
3 changed files with 73 additions and 0 deletions

View File

@@ -1351,6 +1351,14 @@ void InventoryComponent::SpawnPet(Item* item)
}
}
// First check if we can summon the pet. You need 1 imagination to do so.
auto destroyableComponent = m_Parent->GetComponent<DestroyableComponent>();
if (destroyableComponent && destroyableComponent->GetImagination() <= 0) {
GameMessages::SendUseItemRequirementsResponse(m_Parent->GetObjectID(), m_Parent->GetSystemAddress(), UseItemResponse::NoImaginationForPet);
return;
}
EntityInfo info {};
info.lot = item->GetLot();
info.pos = m_Parent->GetPosition();