Skip to content

Commit

Permalink
Mechanic now properly save/load
Browse files Browse the repository at this point in the history
  • Loading branch information
Olivier Gagnon committed Jun 11, 2024
1 parent e83f91d commit 37c9dcf
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 4 deletions.
8 changes: 5 additions & 3 deletions src/Myrian/Myrian.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Device, DeviceType, Component, DeviceID, Glitch } from "@nsdefs";
import { glitchMult } from "./formulas/glitches";
import { pickOne } from "./utils";
import { isDeviceISocket, pickOne } from "./utils";
import { componentTiers } from "./formulas/components";
import { NewBattery, NewBus, NewCache, NewISocket, NewLock, NewOSocket, NewReducer } from "./NewDevices";
import { startRoaming } from "./glitches/roaming";
Expand Down Expand Up @@ -33,8 +33,10 @@ export const loadMyrian = (save: string) => {
startRust();
startSegmentation();
if (!save) return;
// const savedMyrian = JSON.parse(save);
// Object.assign(myrian, savedMyrian);
const savedMyrian = JSON.parse(save);
Object.assign(myrian, savedMyrian);
myrian.devices.forEach((d) => (d.isBusy = false));
myrian.devices.filter(isDeviceISocket).forEach((d) => (d.content = new Array(d.maxContent).fill(d.emitting)));
};

export const inMyrianBounds = (x: number, y: number) => x >= 0 && x < myrianSize && y >= 0 && y < myrianSize;
Expand Down
4 changes: 4 additions & 0 deletions src/Prestige.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ import { initCircadianModulator } from "./Augmentation/Augmentations";
import { Go } from "./Go/Go";
import { calculateExp } from "./PersonObjects/formulas/skill";
import { currentNodeMults } from "./BitNode/BitNodeMultipliers";
import { resetMyrian } from "./Myrian/Myrian";

const BitNode8StartingMoney = 250e6;
function delayedDialog(message: string) {
Expand Down Expand Up @@ -318,6 +319,9 @@ export function prestigeSourceFile(isFlume: boolean): void {
}
staneksGift.prestigeSourceFile();

Player.myrianConnection = false;
resetMyrian();

// Gain int exp
if (Player.sourceFileLvl(5) !== 0 && !isFlume) Player.gainIntelligenceExp(300);

Expand Down
2 changes: 1 addition & 1 deletion src/Sidebar/ui/SidebarRoot.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -355,7 +355,7 @@ export function SidebarRoot(props: { page: Page }): React.ReactElement {
canCorporation && { key_: Page.Corporation, icon: BusinessIcon },
canGang && { key_: Page.Gang, icon: SportsMmaIcon },
canIPvGO && { key_: Page.Go, icon: BorderInnerSharp },
(true || Player.myrianConnection) && { key_: Page.MyrianOS, icon: SettingsInputComponentIcon },
Player.myrianConnection && { key_: Page.MyrianOS, icon: SettingsInputComponentIcon },
]}
/>
<Divider />
Expand Down

0 comments on commit 37c9dcf

Please sign in to comment.