Skip to content

Commit

Permalink
feat: Require version field in engine state
Browse files Browse the repository at this point in the history
  • Loading branch information
oliversalzburg committed Nov 16, 2022
1 parent 14b8040 commit 325d98a
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 0 deletions.
2 changes: 2 additions & 0 deletions packages/userscript/source/Engine.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ export type Automation = {
tick(context: TickContext): void | Promise<void>;
};
export type EngineState = {
v: string;
engine: EngineSettings;
bonfire: BonfireSettings;
religion: ReligionSettings;
Expand Down Expand Up @@ -116,6 +117,7 @@ export class Engine {

stateSerialize(): EngineState {
return {
v: KS_VERSION ?? "latest",
engine: this.settings,
bonfire: this.bonfireManager.settings,
religion: this.religionManager.settings,
Expand Down
1 change: 1 addition & 0 deletions packages/userscript/source/UserScript.ts
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@ export class UserScript {

loadLegacyOptions(source: LegacyStorage) {
this.engine.stateLoad({
v: KS_VERSION ?? "latest",
bonfire: BonfireSettings.fromLegacyOptions(source),
engine: EngineSettings.fromLegacyOptions(source),
religion: ReligionSettings.fromLegacyOptions(source),
Expand Down

0 comments on commit 325d98a

Please sign in to comment.