Skip to content
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

Operations That Cannot Fail Should Use Lowest Quality Medicine #36

Open
wants to merge 1 commit into
base: 1.3
Choose a base branch
from

Conversation

maarxx
Copy link

@maarxx maarxx commented Dec 8, 2020

Operations That Cannot Fail Should Use Lowest Quality Medicine

Addresses #35

But doing this was awkward. We're not enforcing a strict limitation here, like "Herbal Medicine", because if a colony literally doesn't have any "Herbal Medicine", they should use the next-cheapest thing. They should, however, work backwards through the available medicine, in the reverse preference order they would typically sort it.

To do this, we had to patch one method higher upstack: WorkGiver_DoBill.AddEveryMedicineToRelevantThings.

This actually obsoleted the existing patch on WorkGiver_DoBill.GetMedicalCareCategory (new patch was only caller), so we delete it.

We do a classic copy/paste of the original method into a return false prefix.

DO NOT MERGE

See #35 for updates which are not yet reflected in this PR.

}
float inverter = 1f;
if (patient.BillStack.FirstShouldDoNow.recipe.defName == "Anesthetize") { inverter = -1f; }
tmpMedicine.SortBy((Thing x) => 0f - (x.GetStatValue(StatDefOf.MedicalPotency) * inverter), (Thing x) => x.Position.DistanceToSquared(billGiver.Position));
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The inverter variable in the above 3 lines is the only place we intend to affect any change here.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

heya, I know it's been ages since you made this PR, but did you check if this affects op chances? Don't more advanced meds increase success chances? Because pawns will pick up stacks of meds at once, if this affects operations in that they pick up crappy meds for anestesis and whatever affects the op itself, that might be an issue.

{
Pawn patient = billGiver as Pawn;
//MedicalCareCategory medicalCareCategory = GetMedicalCareCategory(billGiver);
MedicalCareCategory medicalCareCategory = PharmacistUtility.TendAdvice(patient, InjurySeverity.Operation);
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

While we're here, this line obsoletes the other patch.

@Kosaro
Copy link

Kosaro commented Jul 19, 2021

This looks like a great change

@Karel-Kroeze Karel-Kroeze changed the base branch from 1.2 to 1.3 August 14, 2021 14:45
@maarxx
Copy link
Author

maarxx commented Apr 29, 2023

DO NOT MERGE

See #35 for updates which are not yet reflected in this PR.

@maarxx maarxx changed the title Use Worst Available Medicine for Anesthesia Operations That Cannot Fail Should Use Lowest Quality Medicine Apr 29, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants