cff29546 / pzmap2dzi

A command-line tool to convert Project Zomboid map data into Deep Zoom format
MIT License
47 stars 15 forks source link

[enhancement] Fully add support for creating map_data.yaml with depend_textures #16

Open ethano8225 opened 1 month ago

ethano8225 commented 1 month ago

I created a file check_fake_and_real_deps.py that essentially allows pzmap to properly identify mods that are required for the maps to work. The way this works, is by checking a couple of things:

After categorizing these mods, it adds the real dependencies' steamIDs and mod folder names (ie /steamid/mods/{name}) to realDependencies.txt, and adds all of the fake dependencies steamID's to fakeDependency.txt (technically unnecessary, but could be nice to have)

This realDependency file is now used by collect_map_mod_data.py to add the correct mod names to depend_textures, although, there are some other changes to collect_map_mod_data.py. I added the ability to save all required mod id's to \scripts\dependsave\{mod_id}.txt (a file is only created if there are required mods for that mod). This list is checked against the realDependencies file to ensure "unnecessary mods" aren't added to the depend_textures.

Some mods still slip through that technically aren't needed, but unless you'd prefer to hardcode these ID's into the file, there is no way around it. They have a texturepacks folder and texture.pack present, so there is no way to simply detect a lack of textures or anything, An example of this is Arsenal26 GunFighter Mod 2.0 if you're curious.

Another addition is, for the mods that have a map, texture AND are required by other mods, they can instead simply call themself in depend_textures. Otr is a good example of this.

But, with these changes, you can get a seemingly fully working version of map_data.py, and so I figured I would recommend to add this to the project for others to use. An example of the output map_data.py

Also, if you don't want a ton of print()'s when running check_fake_and_real_deps.py, you can simply change the top variable "extraDebugPrint" to false, but for debugging it can be nice to have.

link to /scripts/ in my fork if you'df like to test this yourself note: run check... .py first, then collect... .py also, i know the code I added in collect... .py is a bit repetitive, it can certainly be optimized, but it's working well as-is, so I'm not too worried about it

cff29546 commented 1 month ago

I have recently refactored the configuration format and added an improved script for automatically collecting dependencies. This work is currently on the refactor branch. You can find the new mod map configuration manual here.

The configuration format will be updated soon. I apologize for any inconvenience. I recommend postponing the creation of configuration-related scripts until after the refactor is complete.

ethano8225 commented 1 month ago

Good to know, good work. I really only made this script as a passion project / to see if I could figure it out, im relatively new to coding in python so the code I provided is certainly not the cleanest code, but it works so I'd figure id provide it. If you'd like to take bits and pieces of it, feel free, all of the code I added to collect_mod_map_data.py is separated like so:

 your code

############
my code
############

your code

Regardless, if you want any help with edge-cases for depend_textures (specifically fake dependencies), or anything like that, I'd be happy to help out. Let me know 👍