UI: Disable buttons when player cannot buy things in tech vendor (#1881)

* UI: Disable buttons when player cannot buy things in tech vendor

* Tweak reachMaxCore warning comment

---------

Co-authored-by: David Walker <d0sboots@gmail.com>
This commit is contained in:
catloversg
2025-01-05 07:34:48 +07:00
committed by GitHub
parent f2e014ba37
commit 68a436cb77
6 changed files with 52 additions and 33 deletions
+6 -1
View File
@@ -101,7 +101,12 @@ export function getPurchaseServerMaxRam(): number {
}
// Manually purchase a server (NOT through Netscript)
export function purchaseServer(hostname: string, ram: number, cost: number): void {
export function purchaseServer(hostname: string, ram: number): void {
const cost = getPurchaseServerCost(ram);
if (cost === Infinity) {
return;
}
//Check if player has enough money
if (!Player.canAfford(cost)) {
dialogBoxCreate("You don't have enough money to purchase this server!");