Implementations of hack, grow, weaken, and backdoor are inconsistent between CLI and API. In CLI, we check server.purchasedByPlayer, but we do not check it in API. This PR fixes it. As we discussed on Discord, this change is pretty harmless.
On Discord, I talked about this case: await ns.singularity.installBackdoor("hacknet-node-0") shows singularity.installBackdoor: Successfully installed backdoor on 'home'. Just ignore it. I forgot that installBackdoor is a no-parameter API, and we need to connect to the targeted server before using it. We cannot connect to a Hacknet Node (not Hacknet Server), so it won't be a problem.
Although the PR's title says "hacking-related actions", I don't touch nuke and port-opener APIs in this PR. It seems unnecessary to change them. If you think we should change them too, I'll do it.
Implementations of hack, grow, weaken, and backdoor are inconsistent between CLI and API. In CLI, we check
server.purchasedByPlayer
, but we do not check it in API. This PR fixes it. As we discussed on Discord, this change is pretty harmless.On Discord, I talked about this case:
await ns.singularity.installBackdoor("hacknet-node-0")
showssingularity.installBackdoor: Successfully installed backdoor on 'home'.
Just ignore it. I forgot thatinstallBackdoor
is a no-parameter API, and we need to connect to the targeted server before using it. We cannot connect to a Hacknet Node (not Hacknet Server), so it won't be a problem.Although the PR's title says "hacking-related actions", I don't touch nuke and port-opener APIs in this PR. It seems unnecessary to change them. If you think we should change them too, I'll do it.
Test code: