Thanks doughphunghus; that is some great information! Much appreciated.
I've made surprisingly quick progress on this. Xpath is very powerful and very easy; if only there were a 7DTD reference somewhere that would help me look up attribute meanings and possible values easier this would be a breeze! So my current status is:
Create cvar variables
one for each nutrition category (protein, carbs, greens)
set to 50 on spawn
Decrement cvars over time
-15 per day
min value of 1
increase rate of loss above 75 to make powerful buffs possible but expensive to maintain
decrease rate of loss below 15 to make avoiding malnourishment easier at the beginning?
apply iron gut bonuses? (may unbalance the system)
Add effects to existing foods that increase these cvars
based on food/drink digestion
max value of 100
show nutrition info in item table
Add debuffs/buffs based on these cvars that update as the cvars do
Malnourished is minor debuff, currently slight stamina regen debuff
Healthy (50 of all metrics) gives minor boost, currently slight stamina regen buff
add buff for each nutrient when above 90
other buffs/debuffs
Add ability to track these nutrition values
Added to character stats screen
Prevent UI problems / overload
Show nutrition info as integers; not doubles (values currently sometimes showing as decimals with many sig digits)
Figure out if nutrition bars should be displayed on the HUD, or just leave in a subwindow
Figure out how to display buffs so that players don't constantly have too many cluttering their screen
I'll continue to work on it this week.
How do you know if a modlet will require a new game or work with an existing game? Are there any rules of thumb? Or do I just try it?
What's a good way to test, not just for errors but for balance?
I may want to rework things a bit eventually. For now I think this will address my original goals; to maintain a sustainable balanced diet, especially above 75, will require at least four different farmable mats plus meat, while avoiding the malnourished debuff really just requires you to not be starving all the time. I think there's room for improvement, though, to keep new food items being interesting as the game progresses even after you meet those basic five.
I'd love to add some sort of "variety" cvar that tracks the number of different foods you've eaten (or maybe just basic ingredients) in the past 5 days or something, but can't begin to conceptualize how that'd work yet.