Fixed bug when enabling generator for long-running generator-off crafts gaining a burst of progress as if generator was on the whole time
Refactor updateProductionProgress() to get seconds between `sptUpdateLastRunTimestamp` and now instead of crafts `StartTimestamp` and now Store hideout craft progress as decimal for better accuracy when crafting without generator Added code to EventOutputHolder to ensure we continue to return progress as an int
This commit is contained in:
parent
d411f5ce1d
commit
f52c42e8b7
@ -289,12 +289,12 @@ export class HideoutHelper
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get seconds since production started + now
|
// Get seconds since last hideout update + now
|
||||||
let timeElapsed = (this.timeUtil.getTimestamp() - pmcData.Hideout.Production[prodId].StartTimestamp) - pmcData.Hideout.Production[prodId].Progress;
|
let timeElapsed = this.timeUtil.getTimestamp() - pmcData.Hideout.sptUpdateLastRunTimestamp;
|
||||||
if (!hideoutProperties.isGeneratorOn)
|
if (!hideoutProperties.isGeneratorOn)
|
||||||
{
|
{
|
||||||
// Adjust for running without fuel
|
// Adjust for running without fuel
|
||||||
timeElapsed = Math.floor(timeElapsed * this.databaseServer.getTables().hideout.settings.generatorSpeedWithoutFuel);
|
timeElapsed *= this.databaseServer.getTables().hideout.settings.generatorSpeedWithoutFuel;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Increment progress by time passed
|
// Increment progress by time passed
|
||||||
|
@ -146,6 +146,12 @@ export class EventOutputHolder
|
|||||||
{
|
{
|
||||||
this.clientActiveSessionStorage[productionKey] = {clientInformed: true};
|
this.clientActiveSessionStorage[productionKey] = {clientInformed: true};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Only return integer for progress, ignore the decimal progress gained when generator is off
|
||||||
|
if (production.Progress > 0)
|
||||||
|
{
|
||||||
|
Math.round(production.Progress);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return productions;
|
return productions;
|
||||||
|
Loading…
Reference in New Issue
Block a user