mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2026-04-19 15:54:09 +02:00
sidebar is react, fix a few bugs
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
import { Programs } from "./Programs";
|
||||
import { Program } from "./Program";
|
||||
|
||||
import { IPlayer } from "../PersonObjects/IPlayer";
|
||||
import { createElement } from "../../utils/uiHelpers/createElement";
|
||||
|
||||
//Returns the programs this player can create.
|
||||
export function getAvailableCreatePrograms(player: IPlayer): Program[] {
|
||||
const programs: Program[] = [];
|
||||
for (const key in Programs) {
|
||||
// Non-creatable program
|
||||
const create = Programs[key].create;
|
||||
if (create == null) continue;
|
||||
|
||||
// Already has program
|
||||
if (player.hasProgram(Programs[key].name)) continue;
|
||||
|
||||
// Does not meet requirements
|
||||
if (!create.req(player)) continue;
|
||||
|
||||
programs.push(Programs[key]);
|
||||
}
|
||||
|
||||
return programs;
|
||||
}
|
||||
Reference in New Issue
Block a user