Fix GH Issue #632: 'Create Program' link visibility should now be properly dynamically evaluated

This commit is contained in:
danielyxie 2019-07-01 21:15:11 -07:00 committed by danielyxie
parent b2772bbfc1
commit 571ddb109a
3 changed files with 4 additions and 2 deletions

@ -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;

@ -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();
}

@ -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];