Beispiel #1
0
 public ModMedicine(MedicalCareCategory c, float p, Texture2D t)
 {
     care     = c;
     potency  = p;
     thingDef = null;
     tex      = t;
 }
        public static bool AllowsMedicine(this MedicalCareCategory cat, ThingDef meds)
        {
            bool result;

            switch (cat)
            {
            case MedicalCareCategory.NoCare:
                result = false;
                break;

            case MedicalCareCategory.NoMeds:
                result = false;
                break;

            case MedicalCareCategory.HerbalOrWorse:
                result = (meds.GetStatValueAbstract(StatDefOf.MedicalPotency, null) <= ThingDefOf.MedicineHerbal.GetStatValueAbstract(StatDefOf.MedicalPotency, null));
                break;

            case MedicalCareCategory.NormalOrWorse:
                result = (meds.GetStatValueAbstract(StatDefOf.MedicalPotency, null) <= ThingDefOf.MedicineIndustrial.GetStatValueAbstract(StatDefOf.MedicalPotency, null));
                break;

            case MedicalCareCategory.Best:
                result = true;
                break;

            default:
                throw new InvalidOperationException();
            }
            return(result);
        }
        //private static void AddEveryMedicineToRelevantThings(Pawn pawn, Thing billGiver, List<Thing> relevantThings, Predicate<Thing> baseValidator, Map map)
        public static void Postfix(Pawn pawn, Thing billGiver, List <Thing> relevantThings, Map map)
        {
            if (HackityGetBill.bill == null)
            {
                Verse.Log.Warning($"Smart Medicine Inventory Surgery not going to work for {pawn}; mod conflict in AddEveryMedicineToRelevantThings or TryFindBestBillIngredients?");
                return;
            }
            Predicate <Thing> baseValidator = (Thing t) => HackityGetBill.bill.IsFixedOrAllowedIngredient(t) && HackityGetBill.bill.recipe.ingredients.Any((IngredientCount ingNeed) => ingNeed.filter.Allows(t));

            Log.Message($"AddEveryMedicineToRelevantThings ({pawn}, {billGiver}, {HackityGetBill.bill})");
            MedicalCareCategory medicalCareCategory = (MedicalCareCategory)AccessTools.Method(typeof(WorkGiver_DoBill), "GetMedicalCareCategory").Invoke(null, new object[] { billGiver });

            bool added = false;

            Log.Message($"inventory: ({pawn.inventory.GetDirectlyHeldThings().ToStringSafeEnumerable()})");
            foreach (Thing t in pawn.inventory.GetDirectlyHeldThings())
            {
                if (medicalCareCategory.AllowsMedicine(t.def) && baseValidator(t))
                {
                    Log.Message($"{pawn} considering {t} for surgery on {billGiver}");
                    added = true;
                    relevantThings.Add(t);
                }
            }
            if (added)
            {
                relevantThings.SortBy((Thing x) => - x.GetStatValue(StatDefOf.MedicalPotency, true), (Thing x) => x.Spawned ? x.Position.DistanceToSquared(billGiver.Position) : 0);
            }

            HackityGetBill.bill = null;
        }
Beispiel #4
0
 //private static MedicalCareCategory GetMedicalCareCategory(Thing billGiver)
 public static void Postfix(ref MedicalCareCategory __result, Thing billGiver)
 {
     if (billGiver is Pawn p && SurgeryUnlimitedGameComponent.Get().surgeryUnlimited.Contains(p))
     {
         __result = MedicalCareCategory.Best;
     }
 }
Beispiel #5
0
        public override void DoHeader(Rect rect, PawnTable table)
        {
            // decrease height of rect (base does this already, but MedCareSetter does not.
            rect.yMin = rect.yMax - Constants.DesiredHeaderHeight;

            if ((Input.GetKey(KeyCode.LeftShift) || Input.GetKey(KeyCode.RightShift)) && Mouse.IsOver(rect) && table.PawnsListForReading.Any())
            {
                var current = table.PawnsListForReading.Max(p => p.playerSettings.medCare);
                MedicalCareUtility.MedicalCareSetter(rect, ref current);
                if (OverallCare != current)
                {
                    OverallCare = current;
                }

                TooltipHandler.TipRegion(rect, GetHeaderTip(table));
            }
            else if ((Input.GetKey(KeyCode.LeftControl) || Input.GetKey(KeyCode.RightControl) || Input.GetKey(KeyCode.LeftCommand) || Input.GetKey(KeyCode.RightCommand)) && Mouse.IsOver(rect))
            {
                // defaults
                DoDefaultMedCareHeader(rect);
                TooltipHandler.TipRegion(rect, GetHeaderTip(table));
            }
            else
            {
                // text
                base.DoHeader(rect, table);
            }
        }
Beispiel #6
0
        public static void AddEveryMedicineToRelevantThings2(
            Pawn pawn,
            Thing billGiver,
            List <Thing> relevantThings,
            Predicate <Thing> baseValidator,
            Map map)
        {
            MedicalCareCategory medicalCareCategory = GetMedicalCareCategory(billGiver);

            WorkGiver_DoBill_RegionProcessor.thingList = map.listerThings.ThingsInGroup(ThingRequestGroup.Medicine);
            //WorkGiver_DoBill.tmpMedicine.Clear();
            List <Thing> tmpMedicine = new List <Thing>();

            for (int index = 0; index < WorkGiver_DoBill_RegionProcessor.thingList.Count; ++index)
            {
                Thing thing = WorkGiver_DoBill_RegionProcessor.thingList[index];
                if (medicalCareCategory.AllowsMedicine(thing.def) && baseValidator(thing) && pawn.CanReach(thing, PathEndMode.OnCell, Danger.Deadly, false, TraverseMode.ByPawn))
                {
                    tmpMedicine.Add(thing);
                }
            }
            tmpMedicine.SortBy(x => - x.GetStatValue(StatDefOf.MedicalPotency, true), x => x.Position.DistanceToSquared(billGiver.Position));
            relevantThings.AddRange(tmpMedicine);
            //WorkGiver_DoBill.tmpMedicine.Clear();
        }
        public static void MedicalCareSetter(Rect rect, ref MedicalCareCategory medCare)
        {
            Rect rect2 = new Rect(rect.x, rect.y, MedicalCareUtility.ButtonSize.x, MedicalCareUtility.ButtonSize.y);

            for (int i = 0; i < 5; i++)
            {
                MedicalCareCategory mc = (MedicalCareCategory)i;
                if (medCare == mc)
                {
                    GUI.DrawTexture(rect2, MedicalCareUtility.HealthOptionActive);
                }
                else
                {
                    GUI.DrawTexture(rect2, MedicalCareUtility.HealthOptionInactive);
                }
                if (Mouse.IsOver(rect))
                {
                }
                Rect position = rect2.ContractedBy(2f);
                GUI.DrawTexture(position, MedicalCareUtility.careTextures[i]);
                if (Widgets.InvisibleButton(rect2))
                {
                    medCare = mc;
                    SoundDefOf.TickHigh.PlayOneShotOnCamera();
                }
                TooltipHandler.TipRegion(rect2, () => mc.GetLabel(), 632165 + i * 17);
                rect2.x += MedicalCareUtility.ButtonSize.x + MedicalCareUtility.ButtonPadding;
            }
        }
Beispiel #8
0
        public override void DoHeader(Rect rect, PawnTable table)
        {
            // decrease height of rect (base does this already, but MedCareSetter does not.
            rect.yMin = rect.yMax - Constants.DesiredHeaderHeight;

            if (Event.current.shift && Mouse.IsOver(rect) && table.PawnsListForReading.Any())
            {
                // mass assign
                // note; weird as f**k sentinel/token approach, because somehow an intercepted click event and the medCareSetter do not fire in the same GUI phase?
                var sentinel = OverallCare;
                var token    = table.PawnsListForReading.Max(p => p.playerSettings.medCare);
                MedicalCareUtility.MedicalCareSetter(rect, ref token);
                if (sentinel != token)
                {
                    OverallCare = token;
                }

                TooltipHandler.TipRegion(rect, GetHeaderTip(table));
            }
            else if (Event.current.control && Mouse.IsOver(rect))
            {
                // defaults
                DoDefaultMedCareHeader(rect);
                TooltipHandler.TipRegion(rect, GetHeaderTip(table));
            }
            else
            {
                // text
                base.DoHeader(rect, table);
            }
        }
 public static void _Postfix(this MedicalCareCategory cat, ThingDef meds, ref bool __result, bool __state)
 {
     if (!__state)
     {
         __result = ModMedicinePatch.GetDynamicAllowsMedicine(cat, meds);
     }
 }
Beispiel #10
0
        public static void MedicalCareSetter(Rect rect, ref MedicalCareCategory medCare)
        {
            Rect rect2 = new Rect(rect.x, rect.y, rect.width / 5f, rect.height);

            for (int i = 0; i < 5; i++)
            {
                MedicalCareCategory mc = (MedicalCareCategory)i;
                Widgets.DrawHighlightIfMouseover(rect2);
                MouseoverSounds.DoRegion(rect2);
                GUI.DrawTexture(rect2, careTextures[i]);
                Widgets.DraggableResult draggableResult = Widgets.ButtonInvisibleDraggable(rect2);
                if (draggableResult == Widgets.DraggableResult.Dragged)
                {
                    medicalCarePainting = true;
                }
                if ((medicalCarePainting && Mouse.IsOver(rect2) && medCare != mc) || draggableResult.AnyPressed())
                {
                    medCare = mc;
                    SoundDefOf.Tick_High.PlayOneShotOnCamera();
                }
                if (medCare == mc)
                {
                    Widgets.DrawBox(rect2, 3);
                }
                if (Mouse.IsOver(rect2))
                {
                    TooltipHandler.TipRegion(rect2, () => mc.GetLabel(), 632165 + i * 17);
                }
                rect2.x += rect2.width;
            }
            if (!Input.GetMouseButton(0))
            {
                medicalCarePainting = false;
            }
        }
        public static void MedicalCareSetter(Rect rect, ref MedicalCareCategory medCare)
        {
            Rect rect2 = new Rect(rect.x, rect.y, rect.width / 5f, rect.height);

            for (int i = 0; i < 5; i++)
            {
                MedicalCareCategory mc = (MedicalCareCategory)i;
                Widgets.DrawHighlightIfMouseover(rect2);
                GUI.DrawTexture(rect2, typeof(MedicalCareUtility).GetStaticFieldViaReflection <Texture2D[]>("careTextures")[i]);
                if (Widgets.ButtonInvisible(rect2, false))
                {
                    medCare = mc;
                    SoundDefOf.TickHigh.PlayOneShotOnCamera();
                }
                if (medCare == mc)
                {
                    Widgets.DrawBox(rect2, 3);
                }
                TooltipHandler.TipRegion(rect2, () => mc.GetLabel(), 632165 + i * 17);
                rect2.x += rect2.width;
            }

            if (!HorribleHackWithinDefaultDialog)
            {
                rect2.x    += 15;
                rect2.width = 60;
                if (Widgets.ButtonText(rect2, "Defaults"))
                {
                    Find.WindowStack.Add(new Dialog_MedicalDefaults());
                }
            }
        }
Beispiel #12
0
            public static void Postfix(MedicalCareCategory cat, ThingDef meds, ref bool __result)
            {
                //Log.Message("HERE1");
                if (Utils.FindBestMedicinePatient == null || !Utils.SMARTMEDICINE_LOADED)
                {
                    return;
                }

                //Log.Message("HERE2 "+ Utils.FindBestMedicinePatient.LabelShortCap);
                //Si androide slection que des nanokits
                if (Utils.FindBestMedicinePatient.IsAndroidTier() || Utils.FindBestMedicinePatient.IsCyberAnimal())
                {
                    if (!Utils.ExceptionNanoKits.Contains(meds.defName))
                    {
                        __result = false;
                    }
                }
                else
                {
                    //Log.Message("BLOP");
                    //Humain pas de nanokits
                    if (Utils.ExceptionNanoKits.Contains(meds.defName))
                    {
                        __result = false;
                    }
                }

                //Utils.FindBestMedicinePatient = null;
            }
Beispiel #13
0
        //private static void AddEveryMedicineToRelevantThings(Pawn pawn, Thing billGiver, List<Thing> relevantThings, Predicate<Thing> baseValidator, Map map)
        public static void Postfix(Pawn pawn, Thing billGiver, List <Thing> relevantThings, Map map)
        {
            if (HackityGetBill.bill == null)
            {
                Verse.Log.Warning($"Smart Medicine Inventory Surgery not going to work for {pawn}; mod conflict in AddEveryMedicineToRelevantThings or TryFindBestBillIngredients?");
                return;
            }
            Predicate <Thing> baseValidator = (Thing t) => HackityGetBill.bill.IsFixedOrAllowedIngredient(t) && HackityGetBill.bill.recipe.ingredients.Any((IngredientCount ingNeed) => ingNeed.filter.Allows(t));

            Log.Message($"AddEveryMedicineToRelevantThings ({pawn}, {billGiver}, {HackityGetBill.bill})");
            MedicalCareCategory medicalCareCategory = (MedicalCareCategory)AccessTools.Method(typeof(WorkGiver_DoBill), "GetMedicalCareCategory").Invoke(null, new object[] { billGiver });

            Log.Message($"inventory: ({pawn.inventory.GetDirectlyHeldThings().ToStringSafeEnumerable()})");
            foreach (Thing t in pawn.inventory.GetDirectlyHeldThings())
            {
                if (medicalCareCategory.AllowsMedicine(t.def) && baseValidator(t))
                {
                    Log.Message($"{pawn} considering {t} for surgery on {billGiver}");
                    relevantThings.Add(t);
                }
            }

            //Tiny addition to use minimal medicine for Anesthetize bill. TODO: Make this a def extension so any recipe could use it, though no one will so why really
            int statAdjust = (Settings.Get().minimalMedicineForNonUrgent&& HackityGetBill.bill.recipe == Anesthetize ? 1 : -1);

            relevantThings.SortBy(
                (Thing x) => statAdjust * x.GetStatValue(StatDefOf.MedicalPotency),
                //Check if item is in inventory or spawned in map: inventory "distance" is 0
                (Thing x) => x.Spawned ? x.Position.DistanceToSquared(billGiver.Position) : 0);

            HackityGetBill.bill = null;
        }
 public static void _Postfix(this MedicalCareCategory cat, ref string __result, bool __state)
 {
     if (!__state)
     {
         __result = ModMedicinePatch.GetDynamicLabel(cat);
     }
 }
 public PopulationCare(MedicalCareCategory minor, MedicalCareCategory major,
                       MedicalCareCategory lifethreatening, MedicalCareCategory operation)
 {
     _populationCare = new Dictionary <InjurySeverity, MedicalCareCategory>();
     _populationCare.Add(InjurySeverity.Minor, minor);
     _populationCare.Add(InjurySeverity.Major, major);
     _populationCare.Add(InjurySeverity.LifeThreathening, lifethreatening);
     _populationCare.Add(InjurySeverity.Operation, operation);
 }
Beispiel #16
0
        public static void DynamicMedicalCareSetter(Rect rect, ref MedicalCareCategory medCare)
        {
            //modified CareSetter/UI panel
            float scaleFacV = 0.5f;
            float scaleFacH = 5.0f / (medList.Count);
            int   nFirstRow = (int)Mathf.Ceil(0.5f * medList.Count);
            bool  row       = (scaleFacV > scaleFacH);

            if (row)
            {
                scaleFacH = 5.0f / nFirstRow;
            }
            float scaleFac = Mathf.Max(scaleFacV, scaleFacH);



            Rect rect2 = new Rect(rect.x, rect.y + (row ? scaleFac * -0.5f * rect.height : (1f - scaleFac) * rect.height * 0.5f), rect.width * scaleFac / 5, rect.height * scaleFac);

            for (int i = 0; i < medList.Count; i++)
            {
                ModMedicine med = medList[i];

                Widgets.DrawHighlightIfMouseover(rect2);
                GUI.DrawTexture(rect2, med.tex);

                Widgets.DraggableResult draggableResult = Widgets.ButtonInvisibleDraggable(rect2, false);
                if (draggableResult == Widgets.DraggableResult.Dragged)
                {
                    medicalCarePainting = true;
                }
                if ((medicalCarePainting && Mouse.IsOver(rect2) && medCare != med.care) || (draggableResult == Widgets.DraggableResult.Pressed || draggableResult == Widgets.DraggableResult.DraggedThenPressed))
                {
                    medCare = med.care;
                    SoundDefOf.Tick_High.PlayOneShotOnCamera(null);
                }
                if (medCare == med.care)
                {
                    Widgets.DrawBox(rect2, 1);
                }
                TooltipHandler.TipRegion(rect2, () => med.care.GetLabel(), 632165 + (int)med.care * 17);

                rect2.x += rect2.width;
                if (row)
                {
                    if (i == nFirstRow - 1)
                    {
                        rect2.y += rect2.height;
                        rect2.x  = rect.x;
                    }
                }
            }
            if (!Input.GetMouseButton(0))
            {
                medicalCarePainting = false;
            }
        }
 public static bool _Prefix(this MedicalCareCategory cat, ref bool __state)
 {
     //if MedicalCareCategory is within base game range, use original method.
     __state = false;
     if ((int)cat <= 4)
     {
         __state = true;
     }
     return(__state);
 }
 public static bool AllowsMedicine(this MedicalCareCategory cat, ThingDef meds)
 {
     return(cat switch
     {
         MedicalCareCategory.NoCare => false,
         MedicalCareCategory.NoMeds => false,
         MedicalCareCategory.HerbalOrWorse => meds.GetStatValueAbstract(StatDefOf.MedicalPotency) <= ThingDefOf.MedicineHerbal.GetStatValueAbstract(StatDefOf.MedicalPotency),
         MedicalCareCategory.NormalOrWorse => meds.GetStatValueAbstract(StatDefOf.MedicalPotency) <= ThingDefOf.MedicineIndustrial.GetStatValueAbstract(StatDefOf.MedicalPotency),
         MedicalCareCategory.Best => true,
         _ => throw new InvalidOperationException(),
     });
Beispiel #19
0
        public void CopyFromOtherStack(CorticalStack otherStack)
        {
            this.name                  = otherStack.name;
            this.origPawn              = otherStack.origPawn;
            this.hostilityMode         = otherStack.hostilityMode;
            this.areaRestriction       = otherStack.areaRestriction;
            this.ageChronologicalTicks = otherStack.ageChronologicalTicks;
            this.medicalCareCategory   = otherStack.medicalCareCategory;
            this.selfTend              = otherStack.selfTend;
            this.foodRestriction       = otherStack.foodRestriction;

            this.outfit          = otherStack.outfit;
            this.drugPolicy      = otherStack.drugPolicy;
            this.times           = otherStack.times;
            this.thoughts        = otherStack.thoughts;
            this.faction         = otherStack.faction;
            this.isFactionLeader = otherStack.isFactionLeader;
            this.traits          = otherStack.traits;
            this.relations       = otherStack.relations;
            this.relatedPawns    = otherStack.relatedPawns;

            this.skills     = otherStack.skills;
            this.childhood  = otherStack.childhood;
            this.adulthood  = otherStack.adulthood;
            this.priorities = otherStack.priorities;
            this.hasPawn    = true;
            if (this.gender == Gender.None)
            {
                this.gender = otherStack.gender;
            }
            if (this.race == null)
            {
                this.race = otherStack.race;
            }

            this.pawnID = otherStack.pawnID;

            if (ModLister.RoyaltyInstalled)
            {
                this.royalTitles    = otherStack.royalTitles;
                this.favor          = otherStack.favor;
                this.heirs          = otherStack.heirs;
                this.bondedThings   = otherStack.bondedThings;
                this.factionPermits = otherStack.factionPermits;
                this.permitPoints   = otherStack.permitPoints;
            }
            this.isCopied     = true;
            this.stackGroupID = otherStack.stackGroupID;

            this.sexuality     = otherStack.sexuality;
            this.romanceFactor = otherStack.romanceFactor;

            this.psychologyData = otherStack.psychologyData;
        }
Beispiel #20
0
 public static bool GetDynamicAllowsMedicine(MedicalCareCategory cat, ThingDef meds)
 {
     if ((int)cat < medList.Count)
     {
         //compare medical potencies
         return(meds.GetStatValueAbstract(StatDefOf.MedicalPotency, null) <= indexedMedList[(int)cat].potency);
     }
     else
     {
         throw new InvalidOperationException();
     }
 }
Beispiel #21
0
        public static bool Prefix(Hediff __instance, ref float __result)
        {
            if (PriorityCareComp.Get().TryGetValue(__instance, out MedicalCareCategory hediffCare))
            {
                MedicalCareCategory defaultCare = __instance.pawn.GetCare();

                int diff = ((int)hediffCare) - ((int)defaultCare);
                __result += diff * 5;              //Raise priority for higher meds, lower for lower meds.
                return(false);
            }
            return(true);
        }
Beispiel #22
0
 private static IEnumerable <Widgets.DropdownMenuElement <MedicalCareCategory> > MedicalCareSelectButton_GenerateMenu(Pawn p)
 {
     for (int i = 0; i < 5; i++)
     {
         MedicalCareCategory mc = (MedicalCareCategory)i;
         yield return(new Widgets.DropdownMenuElement <MedicalCareCategory> {
             option = new FloatMenuOption(mc.GetLabel(), delegate {
                 p.playerSettings.medCare = mc;
             }, MenuOptionPriority.Default, null, null, 0f, null, null),
             payload = mc
         });
     }
 }
Beispiel #23
0
        internal void TryStoreMedicalCare()
        {
            if (!Settings.MedicalCare)
            {
                return;
            }

            if (Parent.playerSettings == null)
            {
                return;
            }

            _lastMedCareCategory = Parent.playerSettings.medCare;
        }
 public static void setMedicalCare(MedicalCareCategory mcc)
 {
     foreach (object obj in Find.Selector.SelectedObjects)
     {
         if (obj is Pawn)
         {
             Pawn p = (Pawn)obj;
             if (p?.playerSettings != null)
             {
                 p.playerSettings.medCare = mcc;
             }
         }
     }
 }
        public static bool _Prefix(this MedicalCareCategory cat, ThingDef meds, ref bool __state, ref bool __result)
        {
            //if MedicalCareCategory is within base game range, use original method - EXCEPT glitterworld.
            __state = false;
            if ((int)cat <= 3)
            {
                __state = true;
            }

            if (!__state)
            {
                __result = ModMedicinePatch.GetDynamicAllowsMedicine(cat, meds);
            }
            return(__state);
        }
Beispiel #26
0
        public static bool MaxPriorityCare(List <Hediff> hediffs, out MedicalCareCategory care)
        {
            care = MedicalCareCategory.NoCare;
            bool found      = false;
            var  hediffCare = Get();

            foreach (Hediff h in hediffs)
            {
                if (h.TendableNow() && hediffCare.TryGetValue(h, out MedicalCareCategory heCare))
                {
                    care  = heCare > care ? heCare : care;
                    found = true;
                }
            }
            return(found);
        }
Beispiel #27
0
        public static bool AllowsMedicineForHediff(Pawn deliveree, ThingDef med)
        {
            if (PriorityCareComp.MaxPriorityCare(deliveree, out MedicalCareCategory heCare))
            {
                //This is uses to allow higher medicine above normal limit below.
                //this is NOT used to stop the job is PriorityCare is lowered
                if (heCare.AllowsMedicine(med))
                {
                    return(true);
                }
            }

            //Not required but hey why dont I patch this in for Pharmacist
            MedicalCareCategory care = deliveree.GetCare();

            return(care.AllowsMedicine(med));
        }
Beispiel #28
0
        private static void AddEveryMedicineToRelevantThings(Pawn pawn, Thing billGiver, List <Thing> relevantThings, Predicate <Thing> baseValidator, Map map)
        {
            MedicalCareCategory medicalCareCategory = GetMedicalCareCategory(billGiver);
            List <Thing>        list = map.listerThings.ThingsInGroup(ThingRequestGroup.Medicine);

            tmpMedicine.Clear();
            for (int i = 0; i < list.Count; i++)
            {
                Thing thing = list[i];
                if (medicalCareCategory.AllowsMedicine(thing.def) && baseValidator(thing) && pawn.CanReach(thing, PathEndMode.OnCell, Danger.Deadly))
                {
                    tmpMedicine.Add(thing);
                }
            }
            tmpMedicine.SortBy((Thing x) => 0f - x.GetStatValue(StatDefOf.MedicalPotency), (Thing x) => x.Position.DistanceToSquared(billGiver.Position));
            relevantThings.AddRange(tmpMedicine);
            tmpMedicine.Clear();
        }
Beispiel #29
0
        public static bool Prefix(Thing billGiver, ref MedicalCareCategory __result)
        {
            Pawn pawn = billGiver as Pawn;

            if (pawn == null)
            {
                // because this is the fallback vanilla uses...
                __result = MedicalCareCategory.Best;
            }
            else
            {
                // assumption: bills on people === operations
                __result = PharmacistUtility.TendAdvice(pawn, InjurySeverity.Operation);
            }

            // always cancel execution of vanilla method.
            return(false);
        }
Beispiel #30
0
 private static IEnumerable <Widgets.DropdownMenuElement <MedicalCareCategory> > MedicalCareSelectButton_GenerateMenu(ColonistGroup group)
 {
     for (int i = 0; i < 5; i++)
     {
         MedicalCareCategory mc = (MedicalCareCategory)i;
         yield return(new Widgets.DropdownMenuElement <MedicalCareCategory>
         {
             option = new FloatMenuOption(mc.GetLabel(), delegate
             {
                 foreach (var p in group.pawns)
                 {
                     p.playerSettings.medCare = mc;
                 }
             }),
             payload = mc
         });
     }
 }
Beispiel #31
0
 //from MedicalInfo
 public static void MedicalCareSetter(Rect rect, ref MedicalCareCategory medCare)
 {
     float iconSize = rect.width / 5f;
     float iconHeightOffset = (rect.height - iconSize) / 2;
     Rect rect2 = new Rect(rect.x, rect.y + iconHeightOffset, iconSize, iconSize);
     for (int i = 0; i < 5; i++)
     {
         MedicalCareCategory mc = (MedicalCareCategory)i;
         Widgets.DrawHighlightIfMouseover(rect2);
         GUI.DrawTexture(rect2, careTextures[i]);
         if (Widgets.ButtonInvisible(rect2))
         {
             medCare = mc;
         }
         if (medCare == mc)
         {
             GUI.DrawTexture(rect2, Widgets.CheckboxOnTex);
         }
         TooltipHandler.TipRegion(rect2, () => mc.GetLabel(), 632165 + i * 17);
         rect2.x += rect2.width;
     }
 }