Files
deepgrain-foundry/src/sim/tick.js
T

30 lines
909 B
JavaScript

// simTick: one simulation step, in order.
// ---------- Main tick ----------
function simTick() {
tick++;
tickStamp = (tickStamp % 255) + 1;
if (loadWakeOrder) loadWakeTick();
if (tick % 20 === 1) updateDirtyRoof();
weatherTick();
machinesTick();
pipesTick();
pulseTick();
entTick();
if (flyers.length) flyTick();
if (tick % 8 === 0) wakeBotPowder();
simMove();
heatPass();
if (flowOn) flowTick();
for (let c = 0; c < NCH; c++) if (awake[c]) awake[c]--;
if (tick % 15 === 0) checkMolds();
if (tick % 30 === 0) checkLedger();
if (tick % 60 === 7) plantTick();
if (tick % 120 === 13) coldTick();
if (tick % 20 === 9 && treeBases.length) treeSupportTick();
dockTick();
if (tick % 60 === 17) { marketTick(); ordersTick(); }
if (tick % 30 === 11 && saplings.length) saplingTick();
ghostTick();
if (tick % 4 === 0) fogLook(bot.x + bot.w / 2, bot.y + bot.h / 2);
}