Added prettier (#661)
* Added prettier * Added prettier * Added prettier
This commit is contained in:
@@ -6,21 +6,23 @@ import CMLoop from '../Main/Loop';
|
||||
import { isInitializing } from './Variables';
|
||||
|
||||
/**
|
||||
* This creates a init function for the CM object. Per Game code/comments:
|
||||
* "this function is called as soon as the mod is registered
|
||||
* declare hooks here"
|
||||
* It starts the further initialization of CookieMonster and registers hooks
|
||||
*/
|
||||
* This creates a init function for the CM object. Per Game code/comments:
|
||||
* "this function is called as soon as the mod is registered
|
||||
* declare hooks here"
|
||||
* It starts the further initialization of CookieMonster and registers hooks
|
||||
*/
|
||||
export default function init() {
|
||||
isInitializing = true;
|
||||
let proceed = true;
|
||||
if (Game.version !== Number(VersionMajor)) {
|
||||
proceed = confirm(`Cookie Monster version ${VersionMajor}.${VersionMinor} is meant for Game version ${VersionMajor}. Loading a different version may cause errors. Do you still want to load Cookie Monster?`);
|
||||
}
|
||||
if (proceed) {
|
||||
InitializeCookieMonster();
|
||||
Game.registerHook('draw', Draw);
|
||||
Game.registerHook('logic', CMLoop);
|
||||
isInitializing = false;
|
||||
}
|
||||
isInitializing = true;
|
||||
let proceed = true;
|
||||
if (Game.version !== Number(VersionMajor)) {
|
||||
proceed = confirm(
|
||||
`Cookie Monster version ${VersionMajor}.${VersionMinor} is meant for Game version ${VersionMajor}. Loading a different version may cause errors. Do you still want to load Cookie Monster?`,
|
||||
);
|
||||
}
|
||||
if (proceed) {
|
||||
InitializeCookieMonster();
|
||||
Game.registerHook('draw', Draw);
|
||||
Game.registerHook('logic', CMLoop);
|
||||
isInitializing = false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,11 +7,21 @@ import InitData from '../Sim/InitializeData/InitData';
|
||||
* "do stuff with the string data you saved previously"
|
||||
*/
|
||||
export default function load(str) {
|
||||
const save = JSON.parse(str);
|
||||
InitData();
|
||||
LoadConfig(save.settings);
|
||||
if (save.version !== `${VersionMajor}.${VersionMinor}`) {
|
||||
if (Game.prefs.popups) Game.Popup('A new version of Cookie Monster has been loaded, check out the release notes in the info tab!');
|
||||
else Game.Notify('A new version of Cookie Monster has been loaded, check out the release notes in the info tab!', '', '', 0, 1);
|
||||
}
|
||||
const save = JSON.parse(str);
|
||||
InitData();
|
||||
LoadConfig(save.settings);
|
||||
if (save.version !== `${VersionMajor}.${VersionMinor}`) {
|
||||
if (Game.prefs.popups)
|
||||
Game.Popup(
|
||||
'A new version of Cookie Monster has been loaded, check out the release notes in the info tab!',
|
||||
);
|
||||
else
|
||||
Game.Notify(
|
||||
'A new version of Cookie Monster has been loaded, check out the release notes in the info tab!',
|
||||
'',
|
||||
'',
|
||||
0,
|
||||
1,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,8 +7,8 @@ import { VersionMajor, VersionMinor } from '../Data/Moddata';
|
||||
* return 'a string to be saved';"
|
||||
*/
|
||||
export default function save() {
|
||||
return JSON.stringify({
|
||||
settings: CMOptions,
|
||||
version: `${VersionMajor}.${VersionMinor}`,
|
||||
});
|
||||
return JSON.stringify({
|
||||
settings: CMOptions,
|
||||
version: `${VersionMajor}.${VersionMinor}`,
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user