From 571ddb109a25f5b42ba8a3c95b125f15a59b25eb Mon Sep 17 00:00:00 2001 From: danielyxie Date: Mon, 1 Jul 2019 21:15:11 -0700 Subject: [PATCH] Fix GH Issue #632: 'Create Program' link visibility should now be properly dynamically evaluated --- src/PersonObjects/IPlayer.ts | 1 + src/Programs/ProgramHelpers.js | 1 - src/ui/MainMenu/Headers.ts | 4 +++- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/PersonObjects/IPlayer.ts b/src/PersonObjects/IPlayer.ts index 86da75d01..eb1a853ca 100644 --- a/src/PersonObjects/IPlayer.ts +++ b/src/PersonObjects/IPlayer.ts @@ -30,6 +30,7 @@ export interface IPlayer { corporation: any; currentServer: string; factions: string[]; + firstProgramAvailable: boolean; firstTimeTraveled: boolean; hacknetNodes: (HacknetNode | string)[]; // HacknetNode object or IP of Hacknet Server has4SData: boolean; diff --git a/src/Programs/ProgramHelpers.js b/src/Programs/ProgramHelpers.js index 8f3848494..9a0875de3 100644 --- a/src/Programs/ProgramHelpers.js +++ b/src/Programs/ProgramHelpers.js @@ -41,7 +41,6 @@ function getNumAvailableCreateProgram() { if (Player.firstProgramAvailable === false && count > 0) { Player.firstProgramAvailable = true; - document.getElementById("create-program-tab").style.display = "list-item"; document.getElementById("hacking-menu-header").click(); document.getElementById("hacking-menu-header").click(); } diff --git a/src/ui/MainMenu/Headers.ts b/src/ui/MainMenu/Headers.ts index 485a64610..5987a7593 100644 --- a/src/ui/MainMenu/Headers.ts +++ b/src/ui/MainMenu/Headers.ts @@ -66,6 +66,8 @@ export function initializeMainMenuHeaders(p: IPlayer, dev: boolean=false): boole const createProgram: HTMLElement = safeGetElement("create-program-tab"); const createProgramNot: HTMLElement = safeGetElement("create-program-notification"); + createProgram.style.display = p.firstProgramAvailable ? "list-item" : "none"; + this.classList.toggle("opened"); const elems: HTMLElement[] = [terminal, createScript, activeScripts, createProgram]; @@ -87,7 +89,7 @@ export function initializeMainMenuHeaders(p: IPlayer, dev: boolean=false): boole const sleeves: HTMLElement = safeGetElement("sleeves-tab"); sleeves.style.display = p.sleeves.length > 0 ? "list-item" : "none"; - + this.classList.toggle("opened"); const elems: HTMLElement[] = [stats, factions, augmentations, hacknetnodes, sleeves];