Refactor updateProductionProgress()
This commit is contained in:
parent
b1605b20fe
commit
833f17ecdb
@ -287,15 +287,14 @@ export class HideoutHelper
|
|||||||
const timeElapsed = this.getTimeElapsedSinceLastServerTick(pmcData, hideoutProperties.isGeneratorOn);
|
const timeElapsed = this.getTimeElapsedSinceLastServerTick(pmcData, hideoutProperties.isGeneratorOn);
|
||||||
|
|
||||||
// Increment progress by time passed
|
// Increment progress by time passed
|
||||||
pmcData.Hideout.Production[prodId].Progress += timeElapsed;
|
const production = pmcData.Hideout.Production[prodId];
|
||||||
|
production.Progress += timeElapsed;
|
||||||
|
|
||||||
// Limit progress to total production time if progress is over (dont run for continious crafts))
|
// Limit progress to total production time if progress is over (dont run for continious crafts))
|
||||||
if (!recipe.continuous)
|
if (!recipe.continuous)
|
||||||
{
|
{
|
||||||
if (pmcData.Hideout.Production[prodId].Progress > pmcData.Hideout.Production[prodId].ProductionTime)
|
// If progress is larger than prod time, return ProductionTime, hard cap the vaue
|
||||||
{
|
production.Progress = Math.min(production.Progress, production.ProductionTime);
|
||||||
pmcData.Hideout.Production[prodId].Progress = pmcData.Hideout.Production[prodId].ProductionTime;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user