Add research queue: queue multiple projects, auto-promote on completion, RP refund on dequeue
Balance Check / multi-run-balance (push) Has been cancelled
Balance Check / balance-simulation (push) Has been cancelled
CI / build-and-push (push) Successful in 28s

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-04-26 08:16:16 -04:00
parent 626ca51041
commit 5885e33531
5 changed files with 164 additions and 20 deletions
@@ -2,14 +2,19 @@ import type { GameState, ActiveResearch } from '@ai-tycoon/shared';
import { TECH_TREE } from '@ai-tycoon/game-engine';
export function startResearch(state: GameState, research: ActiveResearch): boolean {
if (state.research.activeResearch) return false;
const node = TECH_TREE.find(n => n.id === research.researchId);
if (!node) return false;
const rpCost = node.cost.researchPoints ?? 0;
if (rpCost > state.research.researchPoints) return false;
if (state.research.activeResearch) {
if (state.research.researchQueue.includes(research.researchId)) return false;
state.research.researchQueue.push(research.researchId);
state.research.researchPoints -= rpCost;
return true;
}
state.research.activeResearch = research;
state.research.researchPoints -= rpCost;
return true;