GRAFTING: Add new api for checking ongoing grafting (#1435)

This commit is contained in:
catloversg
2024-06-29 09:59:18 +07:00
committed by GitHub
parent 32eb6324fd
commit b1c1fc24a9
10 changed files with 97 additions and 10 deletions

View File

@@ -97,5 +97,18 @@ export function NetscriptGrafting(): InternalAPI<IGrafting> {
helpers.log(ctx, () => `Began grafting Augmentation ${augName}.`);
return true;
},
waitForOngoingGrafting: (ctx) => () => {
checkGraftingAPIAccess(ctx);
if (!Player.currentWork) {
return Promise.resolve();
}
if (!(Player.currentWork instanceof GraftingWork)) {
return Promise.reject(
`The current work is not a grafting work. Type of current work: ${Player.currentWork.type}.`,
);
}
return Player.currentWork.completion;
},
};
}