l33tmaan / EFRecipes

4 stars 11 forks source link

Simplify things, make recipes more maintainable #8

Open DoctorVanGogh opened 1 year ago

DoctorVanGogh commented 1 year ago

Okay... several things... first github is weird. No clue why it's showing the 'old' merges here...

Changes:

Moved all dependencies to environment variables

Noticable change from 28ff92f366aee7cadd51cff12c93103980254035: you need to define ACULINARY_ARTILLERY_IMPORTwith whatever directory you're pulling the dll from. No more polluting the project file with local paths 🥳 Everything else should just work out of the box.

Made the .csproj file simpler

It was 7800-ish lines. It is now 78-ish lines. 😁 194fd4a834bdfd94551226dffe273086f9ecd728: Simply declared any png or json from any subdirectory as part of the project. Also two other files types. More on those later.

Made recipes - for now just broths - easier to maintain

194fd4a834bdfd94551226dffe273086f9ecd728: Well.. this one is kinda a test baloon. Functional changes:

And since I've been grousing about missing edge cases here & there and general maintainability nightmares. I've decided to give something a try:

Auto-generating json fragments from text templates

Visual Studio comes with its own built-in text templating engine. So why not use that. Added .tt files to create the broths as well as some .ttinclude blocks which contain reusable fragments or helpers for those templates. You even get nice highlighting when using Visual Studio Code (or Visual Studio) with the right extensions: image

Don't know if you're already using some sort of templating engine. So much of the recipes is "this thingy mixed with that flour and that syrup" and there is just so much room for error when copy/pasting blocks or updating things between versions.

The tt files (T4s) are a bit finicky in that all <#, <#+ & <#= tags must be just right and you need to know what each of those does, but ultimately this can save so many lines of text.


I've added the templates in for broths for now since that was all that I was touching (the no soup from chopped things was annoying). I've also had to change the fish quantity for seafood broth down from 2 to 1 since otherwise the "partbaked to cooked simmer" recipe and the "fish broth" recipe both use the exact same ingredients & stacks.

DoctorVanGogh commented 1 year ago

Argh... even with tooling support I still miss things ☹️

It's working now 😀

image

l33tmaan commented 1 year ago

WTF is going on in your broth's JSON? :rofl:

DoctorVanGogh commented 1 year ago

Err? Um? Nothing?

I'm making tools write that json for me. 😀

Or are you referring to the Syntax error in json file 'expandedfoods:recipes/simmering/primitivesurvival/broth.tt': Failed deserializing broth.tt: Unexpected character encountered while parsing value: <... "errors" ? That's the game being dumb and trying to parse clearly non json files as json. Has no effect since the game barfs on the first character of the first line of those non-json files and subsequently does nothing with those files it should never have looked at.

Should only happen on dev machines. Because you're bundling releases from the output directory or a publish subdirectory, right? Riiiight? 😉

l33tmaan commented 1 year ago

I'm not gonna lie, not doing it manually makes me very nervous that something will get overlooked. But that happens anyway. :joy:

DoctorVanGogh commented 1 year ago

Hey, even if you dont like the T4 (or any other automated template) approach, did you merge the resulting jsons?

Aka: