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
*/
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;
switch (type) {
case ServerType.All:
@ -43,9 +43,9 @@ export function ServerDropdown(props: IProps): React.ReactElement {
case ServerType.Foreign:
return s.hostname !== "home" && !purchased;
case ServerType.Owned:
return purchased || s instanceof HacknetServer || s.hostname === "home";
return purchased || s.hostname === "home";
case ServerType.Purchased:
return purchased || s instanceof HacknetServer;
return purchased;
default:
console.warn(`Invalid ServerType specified for ServerDropdown component: ${type}`);
return false;