This commit is contained in:
ducdat0507 2022-12-21 17:15:55 +07:00
parent ed16506ab2
commit 56fb26dcad

View file

@ -288,7 +288,6 @@ const factory = createLayer(id, () => {
} else { } else {
for (const id in components.value) { for (const id in components.value) {
const data = components.value[id]; const data = components.value[id];
console.log(id, data);
if (data?.type === undefined) { if (data?.type === undefined) {
delete components.value[id]; delete components.value[id];
continue; continue;
@ -305,9 +304,8 @@ const factory = createLayer(id, () => {
(window as any).blocks = movingBlocks; (window as any).blocks = movingBlocks;
let taskIsRunning = false; let taskIsRunning = false;
globalBus.on("update", async diff => { globalBus.on("update", diff => {
if (taskIsRunning || !loaded) return; if (taskIsRunning || !loaded) return;
taskIsRunning = true;
//debugger //debugger
// will change soon:tm: // will change soon:tm:
const tick = diff; const tick = diff;
@ -318,14 +316,13 @@ const factory = createLayer(id, () => {
const _compData = compInternalData[id]; const _compData = compInternalData[id];
if (_data === undefined || _compData === undefined) continue; if (_data === undefined || _compData === undefined) continue;
const factoryData = FACTORY_COMPONENTS[_data.type]; const factoryData = FACTORY_COMPONENTS[_data.type];
//debugger; // debugger;
if (_data.type === "conveyor") { if (_data.type === "conveyor") {
const data = _data as FactoryComponentConveyor; const data = _data as FactoryComponentConveyor;
const compData = _compData as FactoryInternalConveyor; const compData = _compData as FactoryInternalConveyor;
if (compData.type !== "conveyor") throw new TypeError("this should not happen"); if (compData.type !== "conveyor") throw new TypeError("this should not happen");
// conveyor part // conveyor part
// use a copy // use a copy
//console.log(compData);
compData.packages = compData.packages.concat(compData.nextPackages); compData.packages = compData.packages.concat(compData.nextPackages);
compData.nextPackages = []; compData.nextPackages = [];
for (const [key, block] of [...compData.packages].entries()) { for (const [key, block] of [...compData.packages].entries()) {
@ -439,8 +436,8 @@ const factory = createLayer(id, () => {
xInc = -1; xInc = -1;
} }
// no suitable location to dump stuff in // no suitable location to dump stuff in
console.log(x, y); // console.log(x, y);
debugger; // debugger;
if (xInc === 0 && yInc === 0) continue; if (xInc === 0 && yInc === 0) continue;
let itemToMove: [string, number] | undefined = undefined; let itemToMove: [string, number] | undefined = undefined;
for (const [name, amt] of Object.entries(data.productionStock)) { for (const [name, amt] of Object.entries(data.productionStock)) {