bitburner-src/src/Netscript/ScriptDeath.ts

38 lines
935 B
TypeScript
Raw Normal View History

import { WorkerScript } from "./WorkerScript";
/**
* Script death marker.
*
* IMPORTANT: the game engine should not base any of it's decisions on the data
* carried in a ScriptDeath instance.
*
* This is because ScriptDeath instances are thrown through player code when a
* script is killed. Which grants the player access to the class and the ability
* to construct new instances with arbitrary data.
*/
2022-03-19 18:55:25 +01:00
export class ScriptDeath {
/** Process ID number. */
pid: number;
2022-03-19 18:55:25 +01:00
/** Filename of the script. */
name: string;
2022-03-19 18:55:25 +01:00
/** IP Address on which the script was running */
hostname: string;
2022-03-19 18:55:25 +01:00
/** Status message in case of script error. */
errorMessage = "";
constructor(ws: WorkerScript) {
this.pid = ws.pid;
this.name = ws.name;
this.hostname = ws.hostname;
this.errorMessage = ws.errorMessage;
Object.freeze(this);
}
}
Object.freeze(ScriptDeath);
Object.freeze(ScriptDeath.prototype);