Made prelimenary switch to airbnb-base

This commit is contained in:
Daniël van Noord
2021-02-24 00:14:14 +01:00
parent 081a8317f9
commit 08faf9f198
12 changed files with 3310 additions and 1834 deletions

View File

@@ -1,8 +1,8 @@
/**********
/**
* Footer *
**********/
*/
/********
/**
* Section: Functions related to base game modding API */
/**
@@ -11,18 +11,18 @@
* declare hooks here"
* It starts the further initialization of CookieMonster and registers hooks
*/
CM.init = function() {
CM.Footer.isInitzializing = true
let proceed = true;
if (Game.version != CM.VersionMajor) {
proceed = confirm('Cookie Monster version ' + CM.VersionMajor + '.' + CM.VersionMinor + ' is meant for Game version ' + CM.VersionMajor + '. Loading a different version may cause errors. Do you still want to load Cookie Monster?');
}
if (proceed) {
CM.Main.DelayInit();
Game.registerHook('draw', CM.Disp.Draw);
Game.registerHook('logic', CM.Main.Loop);
CM.Footer.isInitzializing = false
}
CM.init = function () {
CM.Footer.isInitzializing = true;
let proceed = true;
if (Game.version !== Number(CM.VersionMajor)) {
proceed = confirm(`Cookie Monster version ${CM.VersionMajor}.${CM.VersionMinor} is meant for Game version ${CM.VersionMajor}. Loading a different version may cause errors. Do you still want to load Cookie Monster?`);
}
if (proceed) {
CM.Main.DelayInit();
Game.registerHook('draw', CM.Disp.Draw);
Game.registerHook('logic', CM.Main.Loop);
CM.Footer.isInitzializing = false;
}
};
/**
@@ -30,39 +30,39 @@ CM.init = function() {
* "use this to store persistent data associated with your mod
* return 'a string to be saved';"
*/
CM.save = function() {
return JSON.stringify({
settings: CM.Options,
version: CM.VersionMajor + '.' + CM.VersionMinor,
});
CM.save = function () {
return JSON.stringify({
settings: CM.Options,
version: `${CM.VersionMajor}.${CM.VersionMinor}`,
});
};
/**
* This registers a load function to the CM object. Per Game code/comments:
* "do stuff with the string data you saved previously"
*/
CM.load = function(str) {
let save = JSON.parse(str);
CM.Config.LoadConfig(save.settings);
if (save.version !== CM.VersionMajor + '.' + CM.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);
}
CM.load = function (str) {
const save = JSON.parse(str);
CM.Config.LoadConfig(save.settings);
if (save.version !== `${CM.VersionMajor}.${CM.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);
}
};
/********
/**
* Section: Functions related to the initialization of CookieMonster */
/**
* This functions loads an external script (on the same repository) that creates the
* This functions loads an external script (on the same repository) that creates the
* functionality needed to dynamiccaly change colours
* It is called by the last function in the footer
*/
CM.Footer.AddJscolor = function() {
CM.Footer.AddJscolor = function () {
CM.Footer.Jscolor = document.createElement('script');
CM.Footer.Jscolor.type = 'text/javascript';
CM.Footer.Jscolor.setAttribute('src', 'https://aktanusa.github.io/CookieMonster/jscolor/jscolor.js');
document.head.appendChild(CM.Footer.Jscolor);
document.head.appendChild(CM.Footer.Jscolor);
};
/**
@@ -70,12 +70,12 @@ CM.Footer.AddJscolor = function() {
* It is called as the last function in this script's execution
*/
if (typeof CM.Footer.isInitzializing === 'undefined') {
CM.Footer.AddJscolor();
let delay = setInterval(function() {
if (typeof jscolor !== 'undefined') {
jscolor.init();
Game.registerMod('CookieMonster', CM);
clearInterval(delay);
}
}, 500);
}
CM.Footer.AddJscolor();
const delay = setInterval(function () {
if (typeof jscolor !== 'undefined') {
jscolor.init();
Game.registerMod('CookieMonster', CM);
clearInterval(delay);
}
}, 500);
}