mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2024-11-30 03:23:48 +01:00
add singularity function for exporting game save
This commit is contained in:
parent
2592c6ccd8
commit
ca2f1a62a5
@ -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";
|
||||
|
||||
export function NetscriptSingularity(): InternalAPI<ISingularity> {
|
||||
const getAugmentation = function (ctx: NetscriptContext, name: string): Augmentation {
|
||||
@ -1304,5 +1306,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