coavins / zomboid-coavins-firearms

A Project Zomboid mod that expands the firearm repair system
https://steamcommunity.com/sharedfiles/filedetails/?id=3101379739
MIT License
6 stars 5 forks source link

Refactor how models and parts are created and maintained #70

Open coavins opened 11 months ago

coavins commented 11 months ago

Adding new models, parts, and Zomboid items involves way too many steps in too many separate files. There should be a way to define models and parts in one place (e.g. yaml files) and use those to generate the actual source files used by the game (e.g. CoavinsModels.lua and the parts list in FirearmsHelper.lua)

I think this could be easier to maintain as the list of models and parts grows larger.

coavins commented 11 months ago

One notable issue is that for parts that hold or insert into another part, you have to define this relationship from both sides which leaves room for error. A refactor should fix this so you only have to define the relationship once.

macinsight commented 11 months ago

It could be a good idea (for a start) to, if possible, move out the parts relationship in FirearmsHelper.lua into different files per weapon type, to clean that up. Then we could build something to build the rest of the content from these files.