Skip to content

Commit

Permalink
fix(workshop): Excessive crafts
Browse files Browse the repository at this point in the history
If we didn't have enough of a craftable resource to reach the max yet, KS would craft as many as it can, draining all your resources. Now it will only craft as many items as specified up to the max.
  • Loading branch information
oliversalzburg committed Jul 15, 2024
1 parent 95fb41c commit cdd2879
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion packages/kitten-scientists/source/WorkshopManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,12 @@ export class WorkshopManager extends UpgradeManager implements Automation {
// There is no checking if there actually exists a different target that could get built.
amount = Math.min(amount, craftsPossible - craftsDone, material.consume / materialAmount);
}
request.countRequested = Math.max(0, amount);
request.countRequested = Math.max(
0,
craft.max === -1
? amount
: Math.min(amount, craft.max - this._host.game.resPool.get(craft.resource).value),
);
}

for (const [craft, request] of craftRequests) {
Expand Down

0 comments on commit cdd2879

Please sign in to comment.