mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2026-04-26 19:14:32 +02:00
CONTRACTS: Generate test contracts on executing host by default. Add support for optional parameter to specify the server. (#2417)
This commit is contained in:
@@ -113,16 +113,15 @@ export function generateRandomContractOnHome(): void {
|
||||
serv.addContract(contract);
|
||||
}
|
||||
|
||||
export const generateDummyContract = (problemType: CodingContractName): string | null => {
|
||||
export const generateDummyContract = (problemType: CodingContractName, server: BaseServer): string | null => {
|
||||
if (!CodingContractTypes[problemType]) throw new Error(`Invalid problem type: '${problemType}'`);
|
||||
const serv = Player.getHomeComputer();
|
||||
|
||||
const contractFn = getRandomFilename(serv);
|
||||
const contractFn = getRandomFilename(server);
|
||||
if (contractFn == null) {
|
||||
return null;
|
||||
}
|
||||
const contract = new CodingContract(contractFn, problemType, null);
|
||||
serv.addContract(contract);
|
||||
server.addContract(contract);
|
||||
|
||||
return contractFn;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user