BUGFIX: Block hacking-related actions on player-owned servers (#1585)

This commit is contained in:
catloversg
2024-08-16 16:05:22 +07:00
committed by GitHub
parent a9cb46606c
commit 4a1506cf7e
2 changed files with 8 additions and 8 deletions
+2 -2
View File
@@ -559,14 +559,14 @@ export function NetscriptSingularity(): InternalAPI<ISingularity> {
helpers.checkSingularityAccess(ctx);
const baseserver = Player.getCurrentServer();
if (!(baseserver instanceof Server)) {
helpers.log(ctx, () => "cannot backdoor this kind of server");
helpers.log(ctx, () => "Cannot backdoor this kind of server");
return Promise.resolve();
}
const server = baseserver;
const installTime = (calculateHackingTime(server, Player) / 4) * 1000;
// No root access or skill level too low
const canHack = netscriptCanHack(server);
const canHack = netscriptCanHack(server, "backdoor");
if (!canHack.res) {
throw helpers.errorMessage(ctx, canHack.msg || "");
}