dwonderley / mookAI

If you encounter problems, please leave an issue or message me on the FVTT discord with the handle @Daveofwonders
MIT License
9 stars 13 forks source link

Deprecated bug fix #17

Open yahavatar opened 3 years ago

yahavatar commented 3 years ago

I'm using FoundryVTT version 0.7.9 and MookAI just wouldn't work. I found that there was an Actor parameter, isPC, that had been deprecated since 0.7.2. This was causing the sense() function in mook.js to never find player tokens in a scene. The Mooks would just wander around if allowed to creep.

I fixed the issue by changing line 85 from:

    if (! this.isPC (token)) return false;

to:

    if (combatant.actor.data.type == "npc") return false;

I'm not sure if this is 100% compatible with every module, but I've got a bunch of them installed and this seems to have fixed the issue for me.

Cheers.

NuptupTDOW commented 3 years ago

In which file did you make this change?

yahavatar commented 3 years ago

mook.js

NuptupTDOW commented 3 years ago

So, i'm relatively new to coding. I saw someone else mention a fix that makes it so that midi-QOL works, so i created a fork of his code, then I added your line 85 change so that MIDI-QOL and post 7.9 foundry will hopefully accept it, but i can't seem to get it to import to foundry. I can't get the manifest to work properly. (I'm using Molten Hosting) Any ideas?

yahavatar commented 3 years ago

I'm not that familiar with Molten, but I expect you can just locate the modules folder and edit the mook.js file directly. Since it is not being updated, I expect your change will persist. That's what I did for my self-hosted game. I was considering taking over the module so we can make updates, but have not been able to get in contact with the current owner. It may take a fork and a re-submission to foundry to get it accepted, but that's probably not a quick solution.

NuptupTDOW commented 3 years ago

yeah, i believe this would fall under the deprecated module classification since there's been no update or notice since months ago. So, if you're feeling ambitious, that'd be awesome. As for my issue, I went in and got the mook.js file modified, but i have to repack the module and change the web addresses so that when i try to manifest it it doesn't just hunt back to the original and import his stuff again.

yahavatar commented 3 years ago

As long as there are no changes in the version, it won't re-import the old code. At least it hasn't for me and I do an almost nightly upgrade for all modules. I've found that doing updates like that makes the game more stable and you can track down errors quicker. Waiting for a few weeks between global updates is highly dangerous in my opinion.

NuptupTDOW commented 3 years ago

well no so like, when importing a module, it looks for a manifest url that it will use to hunt down the code. the default url for that is still

"url": "https://github.com/nuptuptdow/mookAI", "manifest": "https://raw.githubusercontent.com/nuptuptdow/mookAI/master/module.json", "download": "https://github.com/nuptuptdow/mookAI/releases/latest/download/mookAI-master.zip"

except replace my name with dwonderley. I have tried to just change my name so it looks through my directories instead of his, but it doesn't work. It just states that the file failed to locate.

NuptupTDOW commented 3 years ago

Edit: Nevermind, it won't work still.... fml

Nevermind, figured it out. If anyone needs this update (The Midi-QOL+7.9 and onward foundry fix), here's the manifest URL's to use.

https://raw.githubusercontent.com/nuptuptdow/mookAI/master/module.json

Do that one first and when it asks if you want to install the dependency, say no. Make sure you've deleted the lib dependency manually as well.

https://raw.githubusercontent.com/nuptuptdow/lib-find-the-path/master/module.json

Then install this one and it will add the needed dependency.

NuptupTDOW commented 3 years ago

So, I'm still trying to get this to work for people that have to import modules due to having their games hosted. So, if anyone would like to help, please reach out to me on discord Nuptup#5402 and we can get a working option available to online hosted people. I feel like I'm just missing something obvious...

Literally the only thing that needs to be done is take this mook.js file https://github.com/NuptupTDOW/mookAI/blob/master/scripts/mook.js and make it replace the original in a hostable/manifestable fork of the original repository. The linked mook.js file simply makes the file not drop targeting so that midi-QOL works, and also fixes the line of code that causes the issue mentioned in the very first post of this issue.