-
Notifications
You must be signed in to change notification settings - Fork 4.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[WIP][CR] Adding vitamins and toxin levels monitor functions to Blood Analyser CBM #37582
[WIP][CR] Adding vitamins and toxin levels monitor functions to Blood Analyser CBM #37582
Conversation
Added initial implementation of analysing blood for vitamin and toxin levels
The "toxins" are byproducts of unchecked mutation by the Blob, exposing you to cellular structures and other cellular building blocks never seen before on the prime plane (the place where the game plays out). As such, there wouldn't be a way to predict what the contaminant is, and thus no way to determine what level it's at in blood. (Short of physically separating all components out of the blood somehow, which is infeasible for an implant.) |
src/bionics.cpp
Outdated
static const std::set<vitamin_id> trackable_vits = {vitamin_id( "iron" ), vitamin_id( "calcium" ), vitamin_id( "vitA" ), vitamin_id( "vitB" ), vitamin_id( "vitC" ), vitamin_id( "mutant_toxin" )}; | ||
for( const auto &v : vit_all ) { | ||
if( trackable_vits.count( v.first ) ) { | ||
vit.push_back( v.second.name() + _( " level is " ) + to_string( vitamin_get( v.first ) ) ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just printing the raw integer value here isn't helpful, because nobody knows what that means.
I'd suggest adding a vitamin::get_string_level()
or something of the sort that gives you a string based on how much of the vitamin you have, and how close you are to each stage of either excess/deficiency.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeap, that's why I asked for a comment how it should be finally represented. And what those numbers are really mean in reality.
But the game UI directly shows us the toxin percentage in the mutant meat... |
When there's no specific toxin to test for (say, Bob works in a batch chemical plant and has a laundry list of things that could be making him sick), what you look for are the easily detected effects of toxicity. Metabolic panels have been giving a general idea of overall organ health via automated testing machines since the 1950's. It can't tell you what the toxin is, but it can tell you that something is damaging the kidneys and liver or throwing electrolyte levels out of whack, and how bad it's gotten. There are also additional simple tests that the CMB could easily look for as a compliment to the general metabolic analysis, such as inflammatory chemicals like histamines and cytokines, and high levels of cellular debris in the blood (meaning cells are dying off at an unusually high rate somewhere). You could get super-detailed here if you wanted, but it makes sense to distill it down to a general "toxin buildup" rating for simplicity and clarity rather than trying to simulate all the individual values and require a course in hematology to read the results. |
May anyone point me where that vitamin levels came from and what exactly do they mean? They are just magic abstract numbers or they have some meaning behind them? |
Ok, to do a comprehensive metabolic panel we're probably gonna need some reagents which probably can't be re-used and will need to be sourced. We can use ion selective electrodes for some of the simple Ions. Sourcing some protons to do a bicarb titration probably won't be terribly difficult. The rest present challenges, necessitating compounds not found in the human body, or questions as to how to harvest them from the body.
How do you propose to do that, and justify an expensive implant with likely lower precision than a traditional test panel? And how would the implant know to report "toxins" just based on this panel? It would report the panel, not toxins. |
for the normal vitamins: they are literally the percentage of RDA (as per FDA) for the food item in question. for the mutant meat: same basic concept, except we have a much lower threshold for mutant meat toxicity than we would vitaminosis. nothing really magic here, just having an idea of how much of each you should (or can) have a day. |
Okay, that's about vitamin levels in the food. But what about vitamin levels in the character? Are they just a sum of food that was consumed? How can I align in-game levels with the IRL normal levels? That is what I can't understand. |
const int effect_spacing = ( good.empty() && bad.empty() ) ? 1 : good.size() + bad.size(); | ||
const size_t win_h = std::min( static_cast<size_t>( TERMY ), | ||
effect_spacing + vit.size() + tox.size() + drug.size() + cnt.size() + 2 ); | ||
//const int win_w = 46; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please remove any commented out code, it's no longer useful.
//const int win_w = 46; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will do when figure out how exactly I should optimize Analyzer window width.
} else if( id_ == "iron" ) { | ||
norm_level = 1.23f; | ||
} else if( id_ == "calcium" ) { | ||
norm_level = 1.1f; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This data (norm_level), should probably be in JSON, not hardcoded.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Or dynamically determined.
const int win_w = 46; | ||
const std::map<vitamin_id, vitamin> &vit_all = vitamin::all(); | ||
for( const auto &v : vit_all ) { | ||
if( !v.second.has_flag( "NO_DISPLAY" ) && !v.second.has_flag( "NOT_IN_BLOOD" ) ) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please document the new flag and the additional behavior of the old one.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe we shouldn't check NO_DISPLAY here at all. If vitamin is not showing in comestibles UI doesn't necessary mean it shouldn't be displayed by Blood Analyzer.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think there's definitely use for a flag that means that the vitamin is never displayed - perhaps the food one should have a separate flag?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wanted to use NOT_IN_BLOOD flag to tell Blood Analyzer to ignore that vitamin... Maybe should change it to BLOOD_ANALYZER to do the opposite - only show vitamins with this flag.
src/vitamin.cpp
Outdated
} else if( id_ == "calcium" ) { | ||
norm_level = 1.1f; | ||
} | ||
const float v_level = norm_level * qty / disease_[0].first; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some vitamins don't have anything in disease_
, this will be attempting to access a non-existing member of a vector.
Additionally, this means that vitamins that use disease_excess_
will always get the default message.
Also, this element is supposed to be loaded as 0 if it is not specified. I'm not sure if that would happen in practice, but there could be potential for a divide by zero here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fair point, thanks.
src/vitamin.cpp
Outdated
} | ||
} | ||
} | ||
return string_format( "%s level is %d.", name(), qty ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This appears to just give you the exact vitamin level if the vitamin is either a disease_excess
vitamin (addressed earlier), or quantity is 0.
I don't think the vitamin quantity should ever be directly displayed, because it's not information that makes much sense to the player, and they have no need to know it - I'd suggest changing this message to %s level is normal
, or something similar.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just changed it to output empty string. Unknown vitamins shouldn't be shown by Analyzer at all.
Co-Authored-By: anothersimulacrum <anothersimulacrum@gmail.com>
Co-Authored-By: anothersimulacrum <anothersimulacrum@gmail.com>
Co-Authored-By: anothersimulacrum <anothersimulacrum@gmail.com>
Co-Authored-By: anothersimulacrum <anothersimulacrum@gmail.com>
In response to the reagents thing on the metabolic panel: they aren't necessary. The reagents are just for color reactions- they react with the targeted molecules to form distinctive colors, which makes it easy to automatically analyze even with simple machinery. Best compact advanced option would be a spectrography-based scanner- lets you detect the component molecules of a sample based on how it fluoresces or absorbs various frequencies of light. Literally have handheld ones these days that you can point at a leaf and get a read on chlorophyll concentrations. The really cool ones can monitor chemical reactions in a living cell by analyzing how the spectrography signature changes over time. |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. Please do not 'bump' or comment on this issue unless you are actively working on it. Stale issues, and stale issues that are closed are still considered. |
Closing to clean up PR queue. Feel free to ping me to reopen after |
Summary
SUMMARY: Features "Add vitamins and toxin levels monitor functions to Blood Analyser CBM"
Purpose of change
#37508 - Vitamins level monitor implementation
Describe the solution
Adding vitamins and toxin levels monitor functions to Blood Analyser CBM
Describe alternatives you've considered
Not really. However, it's just the part of the work, i think, we could also add an item that can perform quick test without CBM
Testing
WIP
Created a character with Blood Analyser CBM and tryed to run it. Nothing awful happened.
Additional context
Comment required about how information should be presented to the player. And maybe what else should be added.