mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2025-04-27 00:56:30 +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>();
|
DestroyableComponent* destComp = builder->GetComponent<DestroyableComponent>();
|
||||||
if (!destComp) break;
|
if (!destComp) break;
|
||||||
|
|
||||||
int newImagination = destComp->GetImagination();
|
|
||||||
|
|
||||||
++m_DrainedImagination;
|
++m_DrainedImagination;
|
||||||
--newImagination;
|
const int32_t imaginationCostRemaining = m_TakeImagination - m_DrainedImagination;
|
||||||
|
|
||||||
|
const int32_t newImagination = destComp->GetImagination() - 1;
|
||||||
destComp->SetImagination(newImagination);
|
destComp->SetImagination(newImagination);
|
||||||
Game::entityManager->SerializeEntity(builder);
|
Game::entityManager->SerializeEntity(builder);
|
||||||
|
|
||||||
if (newImagination <= 0) {
|
if (newImagination <= 0 && imaginationCostRemaining > 0) {
|
||||||
CancelRebuild(builder, eQuickBuildFailReason::OUT_OF_IMAGINATION, true);
|
CancelRebuild(builder, eQuickBuildFailReason::OUT_OF_IMAGINATION, true);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_Timer >= m_CompleteTime && m_DrainedImagination >= m_TakeImagination) {
|
if (m_Timer >= m_CompleteTime && m_DrainedImagination >= m_TakeImagination) {
|
||||||
|
@ -285,7 +285,7 @@ private:
|
|||||||
float m_CompleteTime = 0;
|
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;
|
int m_TakeImagination = 0;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user