mirror of
https://github.com/thepaperpilot/Advent-Incremental.git
synced 2024-11-24 01:11:49 +00:00
Fix factory not working at full spped at high tick rate
This commit is contained in:
parent
53e8669061
commit
97774bc319
1 changed files with 1 additions and 5 deletions
|
@ -101,9 +101,6 @@ const toyGoal = 750;
|
||||||
const advancedToyGoal = 1500;
|
const advancedToyGoal = 1500;
|
||||||
const presentsGoal = 8e9;
|
const presentsGoal = 8e9;
|
||||||
|
|
||||||
// 20x20 block size
|
|
||||||
// TODO: unhardcode stuff
|
|
||||||
|
|
||||||
function roundDownTo(num: number, multiple: number) {
|
function roundDownTo(num: number, multiple: number) {
|
||||||
return Math.floor((num + multiple / 2) / multiple) * multiple;
|
return Math.floor((num + multiple / 2) / multiple) * multiple;
|
||||||
}
|
}
|
||||||
|
@ -1641,6 +1638,7 @@ const factory = createLayer(id, () => {
|
||||||
const compData = _compData as FactoryInternalProcessor;
|
const compData = _compData as FactoryInternalProcessor;
|
||||||
// factory part
|
// factory part
|
||||||
// PRODUCTION
|
// PRODUCTION
|
||||||
|
data.ticksDone += factoryTicks;
|
||||||
if (data.ticksDone >= factoryData.tick) {
|
if (data.ticksDone >= factoryData.tick) {
|
||||||
if (compData.canProduce.value) {
|
if (compData.canProduce.value) {
|
||||||
const cyclesDone = Math.floor(data.ticksDone / factoryData.tick);
|
const cyclesDone = Math.floor(data.ticksDone / factoryData.tick);
|
||||||
|
@ -1678,8 +1676,6 @@ const factory = createLayer(id, () => {
|
||||||
if (compData.lastProdTimes.length > 10) compData.lastProdTimes.shift();
|
if (compData.lastProdTimes.length > 10) compData.lastProdTimes.shift();
|
||||||
compData.lastFactoryProd = now;
|
compData.lastFactoryProd = now;
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
data.ticksDone += factoryTicks;
|
|
||||||
}
|
}
|
||||||
// now look at each component direction and see if it accepts items coming in
|
// now look at each component direction and see if it accepts items coming in
|
||||||
// components are 1x1 so simple math for now
|
// components are 1x1 so simple math for now
|
||||||
|
|
Loading…
Reference in a new issue