Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conflict when using with Cookie Monster #3

Open
katattacktime opened this issue May 8, 2021 · 4 comments
Open

Conflict when using with Cookie Monster #3

katattacktime opened this issue May 8, 2021 · 4 comments

Comments

@katattacktime
Copy link

First and foremost, this is a fantastic script and super helpful to get past the tedium. Thank you for taking the time to code it and keep it updated.

I noticed, with the latest version at least, if you try to use it with Cookie Monster, the cookie count freezes and will not update any more. I tested this in Firefox and Google Chrome, and they both seem to have the same issues. Both addons work fine seperate, but together, something seems to break. Please let me know if there's any relevant information I can give.

@Neutrovertido
Copy link

I can confirm the same issue occurs for me

@slaymaker1907
Copy link

slaymaker1907 commented Aug 19, 2021

The issue seems to happen regardless of load order. Here is the stack trace of what I think is causing the error:

SimHasGod.js:13 Uncaught TypeError: Cannot read properties of undefined (reading 'gods')
    at Jt (SimHasGod.js:13)
    at SimGetHeavenlyMultiplier.js:21
    at sn (CalculateGains.js:44)
    at gn (BuyBuildingBonusIncome.js:41)
    at IndividualAmountTillNextAchievement.js:9
    at AllAmountTillNextAchievement.js:30
    at Array.forEach (<anonymous>)
    at jn (AllAmountTillNextAchievement.js:12)
    at Hn (CacheInit.js:32)
    at ma (Initialization.js:37)

For those interested, I think that the issue is because of a bug with Crustulum rather than CookieMonster. It is replacing Game.hasGod with a custom function regardless if that minigame is present or not. I think it is missing an early return.

I'm not really interested in using that feature anyway, so I found that if you just replace said function of Crustulum as well as the function Game.hasGod, the two addons can be used together successfully.

Crustulum.Hijack.hasGod = () => {};
Game.hasGod = undefined;

However, you need to wait a bit before running the second line. Instead of that, you can clear the timeout in order to do it all simultaneously. Here is a self contained fragment:

(function () {
  Crustulum.Hijack.hasGod = () => {};
  setTimeout(() => {
    Game.hasGod = undefined;
  }, 2000);
}());

@chaapz
Copy link

chaapz commented Nov 16, 2022

The issue seems to happen regardless of load order. Here is the stack trace of what I think is causing the error:

SimHasGod.js:13 Uncaught TypeError: Cannot read properties of undefined (reading 'gods')
    at Jt (SimHasGod.js:13)
    at SimGetHeavenlyMultiplier.js:21
    at sn (CalculateGains.js:44)
    at gn (BuyBuildingBonusIncome.js:41)
    at IndividualAmountTillNextAchievement.js:9
    at AllAmountTillNextAchievement.js:30
    at Array.forEach (<anonymous>)
    at jn (AllAmountTillNextAchievement.js:12)
    at Hn (CacheInit.js:32)
    at ma (Initialization.js:37)

For those interested, I think that the issue is because of a bug with Crustulum rather than CookieMonster. It is replacing Game.hasGod with a custom function regardless if that minigame is present or not. I think it is missing an early return.

I'm not really interested in using that feature anyway, so I found that if you just replace said function of Crustulum as well as the function Game.hasGod, the two addons can be used together successfully.

Crustulum.Hijack.hasGod = () => {};
Game.hasGod = undefined;

However, you need to wait a bit before running the second line. Instead of that, you can clear the timeout in order to do it all simultaneously. Here is a self contained fragment:

(function () {
  Crustulum.Hijack.hasGod = () => {};
  setTimeout(() => {
    Game.hasGod = undefined;
  }, 2000);
}());

how exactly would i go about doing this? i have no coding experience, just want to run the mod without it freezing the game. is there a way?

@sarcasticastico
Copy link

  1. load crustulum as normal
  2. f12 to open dev console in browser
  3. paste this into the console (function () { Crustulum.Hijack.hasGod = () => {}; setTimeout(() => { Game.hasGod = undefined; }, 2000); }());
  4. now you can load cookie monster :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants