fix for buildinds

This commit is contained in:
2026-04-29 22:05:57 +03:00
parent d952e7ca56
commit 1db8d744c8
4 changed files with 71 additions and 10 deletions

View File

@@ -22,7 +22,8 @@ async function pollAndExecute() {
const farmOn = features.includes('farm');
const adminOn = features.includes('admin');
const buildCmd = adminOn ? cmdData.build : null;
// Build: one command per town (server returns an array)
const buildCmds = adminOn ? (cmdData.builds || []) : [];
const recruitCmd = adminOn ? cmdData.recruit : null;
const marketCmd = adminOn ? cmdData.market : null;
const researchCmd = adminOn ? cmdData.research : null;
@@ -60,8 +61,16 @@ async function pollAndExecute() {
reportResult(cmd.id, finalStatus, result.msg);
};
// Run sequentially — humans cannot perform 3 actions simultaneously!
await execute(buildCmd);
// Execute one build command per town (simultaneous queue draining across all villages)
for (let i = 0; i < buildCmds.length; i++) {
await execute(buildCmds[i]);
if (i < buildCmds.length - 1) {
// Random inter-town gap — avoids looking like a macro
const gap = randInt(1500, 3000);
log(`Build: town done. Waiting ${gap}ms before next town...`);
await sleep(gap);
}
}
await execute(recruitCmd);
await execute(marketCmd);
await execute(researchCmd);