Fix water collector craft not resetting after completion of craft
This commit is contained in:
parent
925d9b3f07
commit
fce724b380
@ -740,7 +740,7 @@ export class HideoutController
|
||||
counterHoursCrafting.value = hoursCrafting;
|
||||
|
||||
// Null production data now it's complete - will be cleaned up later by update() process
|
||||
pmcData.Hideout.Production[prodId] = null;
|
||||
pmcData.Hideout.Production[prodId].sptIsComplete = true;
|
||||
};
|
||||
|
||||
// Remove the old production from output object before its sent to client
|
||||
@ -820,8 +820,8 @@ export class HideoutController
|
||||
const callback = () =>
|
||||
{
|
||||
|
||||
// Null production data now it's complete - will be cleaned up later by update() process
|
||||
pmcData.Hideout.Production[prodId] = null;
|
||||
// Flag as complete - will be cleaned up later by update() process
|
||||
pmcData.Hideout.Production[prodId].sptIsComplete = true;
|
||||
};
|
||||
|
||||
return this.inventoryHelper.addItem(pmcData, newReq, output, sessionID, callback, true);
|
||||
|
@ -389,6 +389,8 @@ export interface Productive
|
||||
/** Used when sending data to client */
|
||||
NeedFuelForAllProductionTime?: boolean
|
||||
sptIsScavCase?: boolean
|
||||
/** Some crafts are always inProgress, but need to be reset, e.g. water collector */
|
||||
sptIsComplete?: boolean
|
||||
}
|
||||
|
||||
export interface Production extends Productive
|
||||
|
@ -92,6 +92,9 @@ export class EventOutputHolder
|
||||
profileChanges.production = this.getProductionsFromProfileAndFlagComplete(this.jsonUtil.clone(pmcData.Hideout.Production));
|
||||
profileChanges.improvements = this.jsonUtil.clone(this.getImprovementsFromProfileAndFlagComplete(pmcData));
|
||||
profileChanges.traderRelations = this.constructTraderRelations(pmcData.TradersInfo);
|
||||
|
||||
// Fixes container craft from water collector not resetting after collection
|
||||
this.resetSptIsCompleteFlaggedCrafts(pmcData.Hideout.Production);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -160,6 +163,13 @@ export class EventOutputHolder
|
||||
continue;
|
||||
}
|
||||
|
||||
// Complete and is a water collector craft
|
||||
// Needed as canister craft (water collector) is continuous
|
||||
if (production.sptIsComplete && productionKey === "5d5589c1f934db045e6c5492")
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
// Skip completed
|
||||
if (!production.inProgress)
|
||||
{
|
||||
@ -183,4 +193,22 @@ export class EventOutputHolder
|
||||
|
||||
return productions;
|
||||
}
|
||||
|
||||
/**
|
||||
* Required as continuous productions don't reset and stay at 100% completion but client thinks it hasn't started
|
||||
* @param productions Productions in a profile
|
||||
*/
|
||||
protected resetSptIsCompleteFlaggedCrafts(productions: Record<string, Productive>): void
|
||||
{
|
||||
for (const productionKey in productions)
|
||||
{
|
||||
const production = productions[productionKey];
|
||||
if (production.sptIsComplete)
|
||||
{
|
||||
production.sptIsComplete = false;
|
||||
production.Progress = 0;
|
||||
production.StartTimestamp = this.timeUtil.getTimestamp();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user