states.push({ id: "buy-ion-engine", button: "Buy Ion Engine (₩2000)", action: "Purchasing", show: () => !isFlagEnabled('ion-engine-purchased'), duration: 300, requires: () => { let enoughMoney = userData.money >= 2000; if (!enoughMoney) { errorMessage = "Not enough money to buy ion engine"; return false; } let confirmPurchase = confirm(`Are you sure you want to purchase an ion engine for ₩2000?`); return confirmPurchase; }, run: () => { userData.money -= 2000; setFlag('ion-engine-purchased'); }, });