HACKNET: Remove hacknet servers from ServerType.Foreign (#1665)

This commit is contained in:
Yichi Zhang 2024-09-25 16:19:25 -07:00 committed by GitHub
parent 6c81e1ac67
commit 2b4410739d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -35,7 +35,7 @@ export function ServerDropdown(props: IProps): React.ReactElement {
* 'serverType' property * 'serverType' property
*/ */
function isValidServer(s: BaseServer): boolean { function isValidServer(s: BaseServer): boolean {
const purchased = s instanceof Server && s.purchasedByPlayer; const purchased = (s instanceof Server && s.purchasedByPlayer) || s instanceof HacknetServer;
const type = props.serverType; const type = props.serverType;
switch (type) { switch (type) {
case ServerType.All: case ServerType.All:
@ -43,9 +43,9 @@ export function ServerDropdown(props: IProps): React.ReactElement {
case ServerType.Foreign: case ServerType.Foreign:
return s.hostname !== "home" && !purchased; return s.hostname !== "home" && !purchased;
case ServerType.Owned: case ServerType.Owned:
return purchased || s instanceof HacknetServer || s.hostname === "home"; return purchased || s.hostname === "home";
case ServerType.Purchased: case ServerType.Purchased:
return purchased || s instanceof HacknetServer; return purchased;
default: default:
console.warn(`Invalid ServerType specified for ServerDropdown component: ${type}`); console.warn(`Invalid ServerType specified for ServerDropdown component: ${type}`);
return false; return false;