mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2024-11-25 06:57:28 +00:00
imagination costs that equal your capacity no longer abort qbs (#1338)
This commit is contained in:
parent
24c2361248
commit
e2391665b9
@ -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) {
|
||||
|
@ -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;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user