mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2024-11-10 09:43:54 +01:00
Merge pull request #3403 from Chris380/bugfix/2486_auto_complete_connect_backdoored_server
Bugfix/2486 auto complete for connect and backdoored server
This commit is contained in:
commit
0513aed239
@ -191,8 +191,8 @@ export const HelpTexts: IMap<string[]> = {
|
||||
"Usage: connect [hostname]",
|
||||
" ",
|
||||
"Connect to a remote server. The hostname of the remote server must be given as the argument ",
|
||||
"to this command. Note that only servers that are immediately adjacent to the current server in the network can be connected to. To ",
|
||||
"see which servers can be connected to, use the 'scan' command.",
|
||||
"to this command. Note that only servers that are immediately adjacent to the current server in the network and the ones that have",
|
||||
"a backdoor installed can be connected to. To see which servers can be connected to, use the 'scan' command.",
|
||||
" ",
|
||||
],
|
||||
cp: ["Usage: cp [src] [dst]", " ", "Copy a file on this server. To copy a file to another server use scp.", " "],
|
||||
|
@ -4,7 +4,8 @@ import { getSubdirectories } from "./DirectoryServerHelpers";
|
||||
import { Aliases, GlobalAliases, substituteAliases } from "../Alias";
|
||||
import { DarkWebItems } from "../DarkWeb/DarkWebItems";
|
||||
import { IPlayer } from "../PersonObjects/IPlayer";
|
||||
import { GetServer, GetAllServers } from "../Server/AllServers";
|
||||
import { GetAllServers } from "../Server/AllServers";
|
||||
import { Server } from "../Server/Server";
|
||||
import { ParseCommand, ParseCommands } from "./Parser";
|
||||
import { HelpTexts } from "./HelpText";
|
||||
import { isScriptFilename } from "../Script/isScriptFilename";
|
||||
@ -238,16 +239,14 @@ export async function determineAllPossibilitiesForTabCompletion(
|
||||
}
|
||||
|
||||
if (isCommand("connect")) {
|
||||
// All network connections
|
||||
for (let i = 0; i < currServ.serversOnNetwork.length; ++i) {
|
||||
const serv = GetServer(currServ.serversOnNetwork[i]);
|
||||
if (serv == null) {
|
||||
continue;
|
||||
}
|
||||
allPos.push(serv.hostname);
|
||||
}
|
||||
// All directly connected and backdoored servers are reachable
|
||||
|
||||
return allPos;
|
||||
return GetAllServers()
|
||||
.filter(
|
||||
(server) =>
|
||||
currServ.serversOnNetwork.includes(server.hostname) || (server instanceof Server && server.backdoorInstalled),
|
||||
)
|
||||
.map((server) => server.hostname);
|
||||
}
|
||||
|
||||
if (isCommand("nano") || isCommand("vim")) {
|
||||
|
Loading…
Reference in New Issue
Block a user