I-Knight-I / Rimworld-MedicalOverhaul

MIT License
0 stars 1 forks source link

Diabetes - trait #46

Closed I-Knight-I closed 6 years ago

I-Knight-I commented 6 years ago

A trait that requires constant insulin injections every day or two (for balance). Could be quite simple to make insulin injections for simplicity sake e.g growing sugar cane and crushing it to make injectable insulin.

ghost commented 6 years ago

Heads up: sugar would be the opposite of what you want in an insulin injection. Diabetes occurs when your body cannot handle the amount of sugar in the blood. This typically occurs if the pancreas does not make enough insulin or the body is unable to make use of insulin (insulin resistance). By injecting yourself with sugar (i.e. glucose), you would be making things worse!

Historically, insulin was first popularly used after extracting it from cows. This was referenced to as bovine insulin. Porcine (from pigs) insulin was also used eventually. These days, insulin can be produced biosynthetically from e. coli bacteria using recombinant DNA technology.

In order to produce insulin, you could perhaps extract it from animals (interestingly, many animals besides pigs and cows produce insulin - even fish make it! Perhaps cows and pigs were used mainly because we already raise them in large quantities as livestock). I am not sure how exactly insulin is made from e. coli, so I can't recommend an implementation if it at the moment.

Important Diabetes Factors

I-Knight-I commented 6 years ago

Of course. I got confused - been a long time since I did biology lol.

Currently I'm having issues with the more technical stuff behind this trait. I'm not sure how I'd go about giving a pawn a hediff depending on the trait they've got. I'll have to post a question on the forums.

I-Knight-I commented 6 years ago

Currently diabetes works like this in-game:

A pawn has the trait "Diabetic" and, with that, a hediff called "Diabetes" with 5 stages. Severity increases by 0.15 per day.

Stage 1 (Severity 0.0 - 0.14) - Default. No drawback from the hediff and blood sugar levels are under control.

Stage 2 (Severity 0.15 - 0.29) - No label but consciousness at 75%. This is 1 entire day without an insulin injection.

Stage 3 (Severity 0.30 - 0.44) - "Mild Hyperglycemia", consciousness at 50%. This is 2 days without an insulin injection.

Stage 4 (Severity 0.45 - 0.59) - "Severe Hyperglycemia", consciousness at 25% and thus the pawn is "downed". 3 days without insulin.

Stage 5 (Severity 0.60+) - "Hyperglycemia", consciousness is at 10% and the hediff "Coma" is added (from Death Rattle). After a few minutes the pawn will die without treatment.

Currently Stage 5 doesn't work properly. The coma hediff isn't added as there is nothing that'd sustain it and cause it to tick up. There is another issue that might arise where, if a pawn gets treatment, there wouldn't be a way to remove the coma and it'd continue to tick up. This will need to be edited with custom scripting...

I-Knight-I commented 6 years ago

Fixed Stage 5. Pushing commit now.

Reducing severity of diabetes hediff (insulin) removes coma and no errors are presented because consciousness is now set to 0% at stage 5. This induces a coma naturally.

Commit - f6b45d9

I-Knight-I commented 6 years ago

This'll need rigorous testing, especially since it's something more long-term and affects gameplay from beginning to end.

I-Knight-I commented 6 years ago

Commit with insulin injections - 2601671

Insulin Injections:

Each injection lowers the diabetes hediff by a severity of 0.15 (a whole day's worth of hediff build-up). This means that, after 4 days without inulin and a coma, taking only 1 insulin injection will NOT reset the hediff completely to 0.00. Whilst this isn't realistic, it's better for gameplay and Rimworld because otherwise players might just starve their diabetic colonists and then give them an injection only once they begin to fall unconscious or are in a coma essentially making it only 1/4 as resource intensive. This way, a player letting their colonists fall severely ill will need to spend more resources as a sort of 'punishment'.

I-Knight-I commented 6 years ago

To add: Polyphagia / Polydipsia and fatigue - maybe poorer wound healing.