Fix loading if no previous save is found

This commit is contained in:
Daniël van Noord
2021-07-25 10:33:03 +02:00
parent bedda0093d
commit 4fe07ba1d3
4 changed files with 16 additions and 3 deletions

View File

@@ -4,6 +4,7 @@ import CMDrawHook from '../Disp/DrawHook';
import CMClickHook from '../Main/ClickHook';
import InitializeCookieMonster from '../Main/Initialization';
import CMLoopHook from '../Main/LoopHook';
import load from './load';
/**
* This creates a init function for the CM object. Per Game code/comments:
@@ -30,5 +31,10 @@ export default function init() {
Game.registerHook('click', CMClickHook);
Game.registerHook('draw', CMDrawHook);
Game.registerHook('logic', CMLoopHook);
// Load default settings if no previous saveData is found
if (typeof Game.modSaveData.cookieMonsterMod === 'undefined') {
load('{}');
}
}
}