CookieMonsterTeam / CookieMonster

Addon for Cookie Clicker that offers a wide range of tools and statistics to enhance the game
MIT License
495 stars 206 forks source link

[Steam Version] Sugar lumps are gone while Cookie Monster is enabled #959

Closed RandomGuyJCI closed 3 years ago

RandomGuyJCI commented 3 years ago

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: image

Without Cookie Monster: image

Save file

Mi4wNHx8MTYzMDU1MDQyMzQ5MzsxNjMwNTUwNDIzNDkzOzE2MzA2NDE2MjA5MjI7UmFuZG9tIEd1eSBKQ0k7YW9kaHV8MTExMTExMDExMDExMDExMDAwMDEwMTEwMXwyOTgwMzc1MDQ3MC41NDA1MjQ7NTE2NTYxNzQzNTkzLjkzNDI3OzEwODk1OzIzOzg0MjY2MjI3NjQ1LjI1Njk5OzEwODswOzA7MDswOzA7MDswOzA7MDsyMzswOzA7MDswOzA7MDs7MDswOzA7MDswOzA7MDstMTstMTstMTstMTstMTswOzA7MDswOzc1OzA7MDswOzA7MTYzMDU2MjY2NzY4MDswOzA7OzEwMDswOzA7MzMwNzYxMzUuNDk1MDc0MzQ7MDt8MTE0LDExNCw1MzI5NTc0Mjc1LDAsLDAsMTE0OzExNSwxMTUsNjQyNjA0MDk4MCwwLCwwLDExNTs3Nyw4MSwxMjQ1NDU2MTA5LDAsLDAsNzk7NjUsNjUsNDM0OTc4MjM1NCwwLCwwLDY1OzU3LDU3LDEzODM5NDc2OTA3LDAsLDAsNTc7NDYsNDYsMzMxNjY2MjI0MDQsMCwsMCw0NjszOSwzOSwxMDk2MzkxMjc4NzEsMCwsMCwzOTsyNiwyNiwxMjg4Njk3MDE1NjgsMCwsMCwyNjsxMiwxMiw5NDM0MTc0MjA5MiwwLCwwLDEyOzEsMSwyMDA5OTcxNjMzLDAsLDAsMTswLDAsMCwwLCwwLDA7MCwwLDAsMCwsMCwwOzAsMCwwLDAsLDAsMDswLDAsMCwwLCwwLDA7MCwwLD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Y2F0aW9uR2VuZXJhbCI6MSwiTm90aWZpY2F0aW9uR0MiOjAsIk5vdGlmaWNhdGlvbkZDIjoxLCJOb3RpZmljYXRpb25TZWEiOjEsIk5vdGlmaWNhdGlvbkdhcmQiOjEsIk5vdGlmaWNhdGlvbk1hZ2kiOjEsIk5vdGlmaWNhdGlvbldyaW5rIjoxLCJOb3RpZmljYXRpb25Xcmlua01heCI6MSwiTWlzY2VsbGFuZW91cyI6MCwiTHVja3kiOjEsIkNoYWluIjoxLCJTcGVsbHMiOjEsIkdhcmRlbiI6MSwiUHJlc3RpZ2UiOjEsIldyaW5rIjoxLCJTZWEiOjEsIkFjaGlldnMiOjEsIk1pc2MiOjEsImluZm9NZW51IjoxLCJvcHRpb25zTWVudSI6MX0sImZhdm91cml0ZVNldHRpbmdzIjpbIkZhdm91cml0ZVNldHRpbmdzIl0sImxvY2tlZE1pbmlnYW1lcyI6W10sInZlcnNpb24iOiIyLjAzMS4xMCJ9O2Nvb2tpZU1vbnN0ZXJGcmFtZXdvcms6eyJzZXR0aW5ncyI6e30sImhlYWRlcnMiOnsiaW5mb01lbnUiOjEsIm9wdGlvbnNNZW51IjoxfSwiZmF2b3VyaXRlU2V0dGluZ3MiOltdfTtNRVRBOmNvb2tpZSBtb25zdGVyLCpsYW5nIHNhbXBsZSBtb2QsKnNhbXBsZSBtb2Q7%21END%21
AFKoncore commented 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.

DanielNoord commented 3 years ago

@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!

AFKoncore commented 3 years ago

@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

DanielNoord commented 3 years ago

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.

AFKoncore commented 3 years ago

There is no SteamApp. Steam will return an object in the Steam version and undefined on browser.

Steam={};
App=Steam;

image

DanielNoord commented 3 years ago

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.

RandomGuyJCI commented 3 years ago

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! image

DanielNoord commented 3 years ago

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!

RandomGuyJCI commented 3 years ago

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.

DanielNoord commented 3 years ago

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!

AFKoncore commented 3 years ago

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?

image

DanielNoord commented 3 years ago

Can you access the CM file after loading? There should be a setTimeout at the end.

AFKoncore commented 3 years ago

"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.

DanielNoord commented 3 years ago

Are you able to create a PR with 2000ms instead of 300? I'm not behind a pc right now.

DanielNoord commented 3 years ago

The delay is now 2000ms. Please let me know if this is enough for everybody!

DanielNoord commented 3 years ago

Closing this as it seems to have been fixed!