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

Adding lua program to generate entries for Models.lua #52

Open macinsight opened 11 months ago

macinsight commented 11 months ago

I've built a little something that may be useful.

Takes Firearm Type, Components and Caliber, then generates an entry for coavinsModels and appends it to the file.

Expansion to also have it generate this based on the input is undergoing as I learn.

coavins commented 11 months ago

This looks cool, you just run it through the interpreter?

Do you think we could enhance this to accept a file as input? We could then define the models ahead of time in separate files (e.g. yaml? with some kind of custom format) and use this script to generate the necessary calls to AddOrReplaceModel. This could make it a lot easier to maintain the models.

From there, we could possibly even extend this script to generate the item and fixing txt files, the translation files, and the FirearmsHelper.lua parts details. That would be one way to make the models and parts a lot easier to maintain.

macinsight commented 11 months ago

This looks cool, you just run it through the interpreter?

That's the idea, yeah, and it auto-generates the model defs for ya. Although right now I'm using vim and a handful of black-magic vim-regex lines to cut down model addition time to mere minutes, as evidenced by my flurry of PRs against develop. ;)

If you want, you can extend it for your usecase, let's see where we can take this.