nornagon / cdda-guide

The Hitchhiker's Guide to the Cataclysm
https://cdda-guide.nornagon.net
GNU General Public License v3.0
116 stars 26 forks source link

Add more info to mutations from raw json #120

Closed Raikiri closed 1 year ago

Raikiri commented 1 year ago

Currently there's a bunch of fields in the raw json that are not in the UI:

There's many other niche effects that some mutations grant (like metabolism, swimming speed, etc), but the ones above are universal high-impact effects that every mutant cares about.

Alternatively I was thinking maybe just extract those additional fields procedurally, just show whatever fields the JSON has in human-readable form. But I've no idea how you process this information, so up to you.

nornagon commented 1 year ago

done all except what's covered by #119, since i'd like to give that a broader treatment for that includes non-mutagen consume_drug actions. interestingly, the PAWS line are the only mutations with a crafting skill modifier :)

nornagon commented 1 year ago

As for extracting additional fields procedurally, unfortunately that's either (a) not possible or (b) exactly what HHG is doing, depending on your perspective 😉 the JSON files alone aren't self-describing, i.e. a field called "craft_skill_bonus" doesn't obviously contain things that are of type skill, so there's no way to reliably display that information in a linked way. What HHG does is add that description to the data, so it can be displayed! Unfortunately this means I need to manually write code that does that describing. Fortunately, it means we can display stuff in a nice way!

Raikiri commented 1 year ago

done all except what's covered by #119

sweet!

i.e. a field called "craft_skill_bonus" doesn't obviously contain things that are of type skill

I'm thinking about a really dumb implementation that should still cover 99% of usecases: if there's any key named "lupine_mutagen" in the raw json that is of numerical type, dispay it as "Lupine Primer: %d". It does not even matter where this key is located exactly within that raw json, because it's most likely going to be within an action, and it's probably good enough to assume that it gives you this mutagen on consumption :P

If you want to be safer, then check that there's a "use_action" key, that has a "type" of "consume_drug", and if so, then show its "mutagen_lupine" as "Lupine Primer" in the UI.

Same deal with "craft_skill_bonus" -- it's not going to be self-describing, you'd have to check for it manually, and if present, output it nicely.

nornagon commented 1 year ago

the "safer" way you describe is just how the normal code works :) it would be straightforward to add, the only reason i haven't gotten to it yet is that I want to do a more thorough treatment of it along with other consume_drug properties, which will take some more thought about how I want to lay it out.

Raikiri commented 1 year ago

After playing with all the changes, I've got to say it's huge. The game does a really bad job at giving you guidance on your mutation path, so some sort of a tool to give you more information is pretty much obligatory right now. And I've got to say I got all the information that I wanted in a good way on my last playthrough from this resource. Thanks, nornagon!

I'll still request a bunch more QoL things, but it's already more than possible to use what's already implemented.

nornagon commented 1 year ago

Awesome, glad to hear it! I actually have never played a mutant, I should try it…

Still would like to expose a few more things, let me know if you find anything else important missing! --

j