mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2024-11-22 23:53:48 +01:00
Merge pull request #4087 from phyzical/feature/add-back-api-export
API BACKUP: add singularity function for exporting game save back
This commit is contained in:
commit
ac1a057d35
@ -205,6 +205,8 @@ const singularity = {
|
||||
installAugmentations: SF4Cost(RamCostConstants.ScriptSingularityFn3RamCost),
|
||||
isFocused: SF4Cost(0.1),
|
||||
setFocus: SF4Cost(0.1),
|
||||
exportGame: SF4Cost(RamCostConstants.ScriptSingularityFn1RamCost / 2),
|
||||
exportGameBonus: SF4Cost(RamCostConstants.ScriptSingularityFn1RamCost / 4),
|
||||
b1tflum3: SF4Cost(16),
|
||||
destroyW0r1dD43m0n: SF4Cost(32),
|
||||
getCurrentWork: SF4Cost(0.5),
|
||||
|
@ -53,6 +53,8 @@ import { CreateProgramWork, isCreateProgramWork } from "../Work/CreateProgramWor
|
||||
import { FactionWork } from "../Work/FactionWork";
|
||||
import { FactionWorkType } from "../Work/data/FactionWorkType";
|
||||
import { CompanyWork } from "../Work/CompanyWork";
|
||||
import { canGetBonus, onExport } from "../ExportBonus";
|
||||
import { saveObject } from "../SaveObject";
|
||||
import { calculateCrimeWorkStats } from "../Work/formulas/Crime";
|
||||
|
||||
export function NetscriptSingularity(): InternalAPI<ISingularity> {
|
||||
@ -1317,5 +1319,14 @@ export function NetscriptSingularity(): InternalAPI<ISingularity> {
|
||||
if (!player.currentWork) return null;
|
||||
return player.currentWork.APICopy();
|
||||
},
|
||||
exportGame: (ctx: NetscriptContext) => (): void => {
|
||||
helpers.checkSingularityAccess(ctx);
|
||||
onExport(player);
|
||||
return saveObject.exportGame();
|
||||
},
|
||||
exportGameBonus: (ctx: NetscriptContext) => (): boolean => {
|
||||
helpers.checkSingularityAccess(ctx);
|
||||
return canGetBonus();
|
||||
},
|
||||
};
|
||||
}
|
||||
|
22
src/ScriptEditor/NetscriptDefinitions.d.ts
vendored
22
src/ScriptEditor/NetscriptDefinitions.d.ts
vendored
@ -1496,6 +1496,28 @@ export interface TIX {
|
||||
* @public
|
||||
*/
|
||||
export interface Singularity {
|
||||
/**
|
||||
* Backup game save.
|
||||
* @remarks
|
||||
* RAM cost: 1 GB * 16/4/1
|
||||
*
|
||||
*
|
||||
* This function will automatically opens the backup save prompt and claim the free faction favour if available.
|
||||
*
|
||||
*/
|
||||
exportGame(): void;
|
||||
|
||||
/**
|
||||
* Returns Backup save bonus availability.
|
||||
* @remarks
|
||||
* RAM cost: 0.5 GB * 16/4/1
|
||||
*
|
||||
*
|
||||
* This function will check if there is a bonus for backing up your save.
|
||||
*
|
||||
*/
|
||||
exportGameBonus(): boolean;
|
||||
|
||||
/**
|
||||
* Take university class.
|
||||
*
|
||||
|
Loading…
Reference in New Issue
Block a user