public void TrySealWounds() { IEnumerable <Hediff> enumerable = from hd in this.pawn.health.hediffSet.hediffs where hd.Bleeding select hd; bool flag = enumerable != null; if (flag && canHeal) { foreach (Hediff hediff in enumerable) { HediffWithComps hediffWithComps = hediff as HediffWithComps; bool flag2 = hediffWithComps != null; Rand.PushState(); float chance = Rand.Value; Rand.PopState(); if (flag2 && canHeal && chance < Props.sealWoundsChance) { HediffComp_TendDuration hediffComp_TendDuration = HediffUtility.TryGetComp <HediffComp_TendDuration>(hediffWithComps); hediffComp_TendDuration.tendQuality = 0f; hediffComp_TendDuration.tendTicksLeft = Find.TickManager.TicksGame; this.pawn.health.Notify_HediffChanged(hediff); } } } }
public void TryHealWounds() { IEnumerable <Hediff> enumerable = from hd in pawn.health.hediffSet.hediffs where !hd.IsTended() select hd; if (enumerable != null) { foreach (Hediff item in enumerable) { HediffWithComps val = item as HediffWithComps; if (val != null && val.TendableNow()) { if (val.Bleeding) { //Log.Message("TrySealWounds " + xxx.get_pawnname(pawn) + ", Bleeding " + item.Label); HediffComp_TendDuration val2 = HediffUtility.TryGetComp <HediffComp_TendDuration>(val); val2.tendQuality = 2f; val2.tendTicksLeft = Find.TickManager.TicksGame; pawn.health.Notify_HediffChanged(item); } // infections etc else // if (val.def.lethalSeverity > 0f) { //Log.Message("TryHeal " + xxx.get_pawnname(pawn) + ", infection(?) " + item.Label); HediffComp_TendDuration val2 = HediffUtility.TryGetComp <HediffComp_TendDuration>(val); val2.tendQuality = 2f; val2.tendTicksLeft = Find.TickManager.TicksGame; pawn.health.Notify_HediffChanged(item); } } } } }
public void TrySealWounds() { IEnumerable <Hediff> enumerable = from hd in this.pawn.health.hediffSet.hediffs where hd.TendableNow(false) select hd; if (enumerable != null) { foreach (Hediff hediff in enumerable) { HediffWithComps hediffWithComps = hediff as HediffWithComps; if (hediffWithComps != null) { HediffComp_TendDuration hediffComp_TendDuration = HediffUtility.TryGetComp <HediffComp_TendDuration>(hediffWithComps); hediffComp_TendDuration.tendQuality = 2f; hediffComp_TendDuration.tendTicksLeft = Find.TickManager.TicksGame; this.pawn.health.Notify_HediffChanged(hediff); } } } }
public void TrySealWounds() { IEnumerable <Hediff> hediffs = ((IEnumerable <Hediff>)((HediffSet)((Pawn_HealthTracker)((Pawn)((Hediff)this).pawn).health).hediffSet).hediffs).Where <Hediff>((Func <Hediff, bool>)(hd => hd.get_Bleeding())); if (hediffs == null) { return; } using (IEnumerator <Hediff> enumerator = hediffs.GetEnumerator()) { while (((IEnumerator)enumerator).MoveNext()) { Hediff current = enumerator.Current; if (current is HediffWithComps hediffWithComps) { HediffComp_TendDuration comp = (HediffComp_TendDuration)HediffUtility.TryGetComp <HediffComp_TendDuration>((Hediff)hediffWithComps); comp.tendQuality = (__Null)2.0; comp.tendTicksLeft = (__Null)Find.get_TickManager().get_TicksGame(); ((Pawn_HealthTracker)((Pawn)((Hediff)this).pawn).health).Notify_HediffChanged(current); } } } }
public void HealWounds() { IEnumerable <Hediff> enumerable = from hd in pawn.health.hediffSet.hediffs where !hd.IsTended() && hd.TendableNow() select hd; if (enumerable != null) { foreach (Hediff item in enumerable) { HediffWithComps val = item as HediffWithComps; if (val != null) { if (val.Bleeding) { //Log.Message("TrySealWounds " + xxx.get_pawnname(pawn) + ", Bleeding " + item.Label); //HediffComp_TendDuration val2 = HediffUtility.TryGetComp<HediffComp_TendDuration>(val); val.Heal(0.25f); //val2.tendQuality = 1f; //val2.tendTicksLeft = 10000; //pawn.health.Notify_HediffChanged(item); } // tend infections // tend lifeThreatening chronic else if ((!val.def.chronic && val.def.lethalSeverity > 0f) || (val.CurStage?.lifeThreatening ?? false)) { //Log.Message("TryHeal " + xxx.get_pawnname(pawn) + ", infection(?) " + item.Label); HediffComp_TendDuration val2 = HediffUtility.TryGetComp <HediffComp_TendDuration>(val); val2.tendQuality = 1f; val2.tendTicksLeft = 10000; pawn.health.Notify_HediffChanged(item); } } } } }