mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2026-04-23 01:32:55 +02:00
8f4313b180
This reverts commit 92b8b58588.
Accidental merge on my part - the code is in decent shape, but isn't meant to go in for 3.0.
31 lines
910 B
TypeScript
31 lines
910 B
TypeScript
import type { CompletedProgramName } from "@enums";
|
|
import { ProgramFilePath, asProgramFilePath } from "../Paths/ProgramFilePath";
|
|
import { BaseServer } from "../Server/BaseServer";
|
|
|
|
export interface IProgramCreate {
|
|
level: number;
|
|
req(): boolean; // Function that indicates whether player meets requirements
|
|
time: number;
|
|
tooltip: string;
|
|
}
|
|
interface ProgramConstructorParams {
|
|
name: CompletedProgramName;
|
|
create: IProgramCreate | null;
|
|
run: (args: string[], server: BaseServer) => void;
|
|
nsMethod?: string;
|
|
}
|
|
|
|
export class Program {
|
|
name: ProgramFilePath & CompletedProgramName;
|
|
create: IProgramCreate | null;
|
|
run: (args: string[], server: BaseServer) => void;
|
|
nsMethod?: string;
|
|
|
|
constructor({ name, create, run, nsMethod }: ProgramConstructorParams) {
|
|
this.name = asProgramFilePath(name);
|
|
this.create = create;
|
|
this.run = run;
|
|
this.nsMethod = nsMethod ?? "";
|
|
}
|
|
}
|