Closed GoldSloth closed 1 year ago
Looks good overall, nice to see a modernization of config handling. Only major concerns would be case sensitivity (which seemed to be hit or miss in the old implementation, but crucial for old packs to work the same way) and referencing model classes in server side contexts.
Iirc this is now equivelant to equalsIgnoreCase for config keywords which shouldn't cause any issues afaik
I think I've resolved all issues there, I also tested on a local server which I forgot to do before - could you give it a quick check @Unknown025 please?
Description of changes
Completely replace the config loading system with a reworked system. Instead of reading each line of a file with a long list of if/else statements, all lines are instead read into a ConfigMap, then each type file uses methods from ConfigUtils to parse int/float/bool, read a string or retrieve splits.
Each config read using logic that can throw exceptions should be individually wrapped by a try/catch, there are only a few errors which should cause parsing to fail. Furthermore, a standardized logging system has been introduced with FlansMod.logPackError which can print filename, packname, shortname, a message, the split that caused an error and the exception. This should help pack makers easily see issues in their packs.
There's also a small amount of validation introduced, which should be expanded in future to correct common issues such as missing wheels e.t.c.
Intended usage in Content Packs/Users of the mod
The underlying config reading systems should not be of interest, however improved logging should be of use to pack makers.
Compatibility
I do not anticipate this update will occur configs to be interpreted differently, however there are likely to be issues due to things we've missed. A long list of changed behavior will be amended when this is manually merged.
Where a config which is meant to be set once (like Driver -10 4 59) is specified multiple times, the FIRST usage will be used instead of the LAST.
Wheel positions will be read in a more "generous" manner if they're not properly specified.
Other
WillyJ started this project a few months ago to tidy up the code, implemented the bulk of ConfigMap and ConfigUtils and started to convert the existing type files. However, he soon disappeared and it was left to me to finish conversion and implement error handling and logging. Hence, this took up a lot more of my time than I anticipated.