Closed JiFish closed 10 years ago
Feedback would be most welcome for this one. There are a few important changes: Several files are now loaded during loading the config; LoadItems may be called twice; any empty or missing book dir is now treated the same way as paintings.
Looks good! I'll test on it.
Should there be a dir_items for NBT files?
Also, perhaps add a section to default.cfg explaining all this.
Oh, and also dir_spawners?
I considered these. I figured they were overkill because in both cases the files for various configurations can happily coexist. (Unlike paintings and books.) Some spawners are referenced directly in the code, so if an option was provided it would have to be in addition to the current spawners folder.
But I'd like to hear your thoughts on this. I think there is an argument to add them just for consistency.
A section for default.cfg is in progress. I'd also like to create a themed configuration to act as a sample. :)
Yeah, maybe. If the intent is to provide a sort of package for a theme, maybe a better approach would be to treat all of these like an overlay like you did items.txt. Otherwise you'd have to worry about copying/distributing all the stock content along with your extras.
Now I'm starting to think all of these things should live together in the configs directory and configs should be subdirectories. Maybe the contents of default always gets loaded, and others are overlays. Then you could just zip up that subdirectory, send it to someone, and they unzip it into the configs.
Something like:
configs
|-> default
|-> config.txt
items.txt
potions.txt
books
(etc)
|-> maze
|-> config.txt
items.txt
potions.txt
books
(etc)
By default the stuff in default gets loaded. If you specify "--config maze" then the contents of maze get overlaid. config.txt would be overidden, but other stuff is added.
The hard part would be excluding something from the default you didn't want.
Crazy?
I like this a lot for ease of distribution. As it stands, you'd have to provide a zip that you'd unzip on top of the mcdungeon folder. I admit, this isn't very good.
But I think there are problems.
With regard to inheriting everything from the default: I think books, paintings and fortunes really couldn't inherit. Since the contents of these are chosen randomly, I think In most cases I think you are want to have a clean slate to work from to create your theme. (Say you are creating a french language dungeon, you won't want any of those pesky English books!) So we'd either have to have different resources act differently (spawners inherit, book don't etc.,) which is confusing. Or inheritance would have to be optional somehow, which seems overcomplicated.
If I'm honest, the only reason items.txt inherits is because certain vanilla items are required. It was afterwards that I realized the advantage of not having to re-specify all the vanilla blocks.
With regard to subfolders: while this solves the problem distribution, it's not very friendly for sharing resources. Say you had an item.txt for a mod, you might want to share this between many configurations. I guess you could have multiple configs in each folder. But then the UI would have to be altered... Also, there's a problem if you wanted to share some resources but not others.
I think regardless of what happens, you should still be able to provide a simple configuration file without a subfolder. Just because your average user isn't going to need or want to deal with extra resources.
I'm torn.
The primary goal here is indeed to make it easier to distribute a package for a specific mod or language etc. But I also want flexibility AND not to complicate things. But maybe I can't have everything...
Maybe I can salvage my initial approach by allowing sub-paths in the configuration options? This may allow a zipped subdirectory approach as you mentioned, while not locking you in to it.
I'll give it some thought.
I've done to following to try to get what I have closer to your idea and hopefully solving the issue of ease of distribution:
This allows for a theme to be distributed in a zip file containing a config and directory with the files. It also maintains the flexibility to share these files between configs. Here's a sample setup:
configs
|-> french_vanilla.cfg
twilight_forest_mod.cfg
french_twilight_forest_mod.cfg
french
|-> fortunes.txt
books
|-> ...
twilight_forest
|-> items.txt
potions.txt
(french_vanilla.cfg)
[locations]
file_fortunes: french/fortunes.txt
dir_books: french/books
(twilight_forest_mod.cfg)
[locations]
file_extra_items: twilight_forest/items.txt
file_potions: twilight_forest/potions.txt
(french_twilight_forest_mod)
[locations]
file_fortunes: french/fortunes.txt
dir_books: french/books
file_extra_items: twilight_forest/items.txt
file_potions: twilight_forest/potions.txt
How do you feel about this for a compromise?
I am assuming that you are going to want to do a release to coincide with 1.6?
If you are not happy with the way this is currently working, feel free to revert this feature for the update.
yeah, I'll be making a release soon. Since this is such a large change, I don't want to rush it out the door. I'll probably try to branch earlier for the release.
How did you feel about the compromise offered in the other comment and commit 3187ba3302f9cbb6fd7e30e4b7c6141ae2b887e7?
If you're unconvinced, I'd suggest the next place to go is to a rewrite as you previously suggested. At the same time, it might be worth standardising all the text configuration files we use in to a single format. (Maybe even using something like http://www.voidspace.org.uk/python/configobj.html) That would be beyond my time and abilities, though.
I think this works. I don't have the cycles to write the config system, but this is a big step forward.
Seems like there is a bug where spawners in the customised folder do not work correctly. :/
The above note about a possible bug is more likely explained by #184
Keep this open for a while. There's probably some improvements that can be done.
Ability to specify various resources in the configuration file. This would include things like the items.txt, magic_items.txt, the book folder etc.
The idea will be to make it easier to provide a package of files to work with specific configurations. For example, to support a specific mod or to create a highly themed dungeon.