/** * Class representing a script file. * * This does NOT represent a script that is actively running and * being evaluated. See RunningScript for that */ import { calculateRamUsage, RamUsageEntry } from "./RamCalculations"; import { LoadedModule, ScriptURL } from "./LoadedModule"; import { Generic_fromJSON, Generic_toJSON, IReviverValue, constructorsForReviver } from "../utils/JSONReviver"; import { roundToTwo } from "../utils/helpers/roundToTwo"; import { RamCostConstants } from "../Netscript/RamCostGenerator"; export class Script { code: string; filename: string; server: string; // Ram calculation, only exists after first poll of ram cost after updating ramUsage: number | null = null; ramUsageEntries: RamUsageEntry[] = []; // Runtime data that only exists when the script has been initiated. Cleared when script or a dependency script is updated. mod: LoadedModule | null = null; /** Scripts that directly import this one. Stored so we can invalidate these dependent scripts when this one is invalidated. */ dependents: Set