imagination costs that equal your capacity no longer abort qbs (#1338)

This commit is contained in:
jadebenn 2023-12-16 19:35:16 -06:00 committed by GitHub
parent 24c2361248
commit e2391665b9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 6 deletions

View File

@ -197,18 +197,17 @@ void RebuildComponent::Update(float deltaTime) {
DestroyableComponent* destComp = builder->GetComponent<DestroyableComponent>();
if (!destComp) break;
int newImagination = destComp->GetImagination();
++m_DrainedImagination;
--newImagination;
const int32_t imaginationCostRemaining = m_TakeImagination - m_DrainedImagination;
const int32_t newImagination = destComp->GetImagination() - 1;
destComp->SetImagination(newImagination);
Game::entityManager->SerializeEntity(builder);
if (newImagination <= 0) {
if (newImagination <= 0 && imaginationCostRemaining > 0) {
CancelRebuild(builder, eQuickBuildFailReason::OUT_OF_IMAGINATION, true);
break;
}
}
if (m_Timer >= m_CompleteTime && m_DrainedImagination >= m_TakeImagination) {

View File

@ -285,7 +285,7 @@ private:
float m_CompleteTime = 0;
/**
* The imagination that's deducted when compeleting the rebuild
* The imagination that's deducted when completing the rebuild
*/
int m_TakeImagination = 0;