Closed RandomGuyJCI closed 3 years ago
DashNet Forum user Justicetom found that delaying Cookie Monster loading by a couple seconds to wait for the base game to load prevent that issue.
@AFKoncore Do we know if there is something to distinguish the version being played? Something like Game.version
? We could then do an if-statement and a delay with loading for the Steam version!
@DanielNoord Currently the web version is 2.031 and the Steam one 2.04. There do not seems to be a specific flag named Steam, the code seems to use the variable App as such but I'm not sure it's specific to Steam, could be for mobile as well. Have a look for yourself: https://www.mediafire.com/file/ziwec3xynu97lfh/Cookie_Clicker_Steam_Version_v2.04_-_main.js/file (it was too heavy for pastebin)
I tried waiting for Game.ready to be true but it wasn't enough of a delay.
EDIT: There is an object stored in the variable Steam
Can we use instancof to see if App
is an instance of the class SteamApp
or whatever the class currently is?
Sorry to rely on you so much, not being able to troubleshoot myself is quite annoying.
There is no SteamApp. Steam
will return an object in the Steam version and undefined
on browser.
Steam={};
App=Steam;
So we could do:
if (typeof Steam !=='undefined') {
setTimeout(function() {
// Init function here
}, 1000);
}
This delays whatever init function by 1000 milliseconds if Steam is an object.
I just tried editing the main.js file to
if (typeof Steam !=='undefined') {
setTimeout(function() {
Game.registerMod("cookie monster",{ init:function(){ Game.LoadMod('https://cookiemonsterteam.github.io/CookieMonster/dist/CookieMonster.js'); }, });
}, 1000);
}
and it seems to function properly now!
Could I bother you and ask you to test some other timings? I would like to keep the delay as low as possible!
Would you mind opening a PR? If you can't I'll try to do this myself this afternoon!
I managed to get the mod to consistently load properly with a 200ms delay, although the timings might be dependent on the computer's loading speed.
As for the PR, I'm not sure what files I'm supposed to create/edit, or where.
I have added a commit that should implement the fix. Can you see if it works via the normal way of loading the mod?
EDIT: Wait.. I broke the mod, oops.
EDIT2: Please test if current version of the mod fixes this!
It does not for me, the mod loads too soon. How can I check if this isn't a caching issue on my end and that it's when using the lastest update?
Can you access the CM file after loading? There should be a setTimeout
at the end.
"undefined" != typeof Steam && setTimeout((function() {}), 300), Game.registerMod("CookieMonster", fa), window.cookieMonsterFrameworkData.isInitializing = !1
So this is with the lastest version. 1s delay works on my end, I didn't try to lower it, but I think we should go for a safe timing. 2 and a half second is barely noticeable when first starting the game.
Are you able to create a PR with 2000ms instead of 300? I'm not behind a pc right now.
The delay is now 2000ms. Please let me know if this is enough for everybody!
Closing this as it seems to have been fixed!
Describe the bug When the mod is enabled, all functionality that uses sugar lumps (harvesting and upgrade buttons) are gone. Disabling the mod shows the buttons.
Screenshots With Cookie Monster:
Without Cookie Monster:
Save file