protected virtual void RunMetabolism(BaseCombatEntity ownerEntity, float delta) { if (this.calories.@value > 200f) { ownerEntity.Heal(Mathf.InverseLerp(200f, 1000f, this.calories.@value) * delta * 0.0166666675f); } if (this.hydration.@value > 200f) { ownerEntity.Heal(Mathf.InverseLerp(200f, 1000f, this.hydration.@value) * delta * 0.0166666675f); } this.hydration.MoveTowards(0f, delta * 0.008333334f); this.calories.MoveTowards(0f, delta * 0.0166666675f); this.heartrate.MoveTowards(0.05f, delta * 0.0166666675f); }
protected virtual void RunMetabolism(BaseCombatEntity ownerEntity, float delta) { if ((double)this.calories.value > 200.0) { ownerEntity.Heal((float)((double)Mathf.InverseLerp(200f, 1000f, this.calories.value) * (double)delta * 0.0166666675359011)); } if ((double)this.hydration.value > 200.0) { ownerEntity.Heal((float)((double)Mathf.InverseLerp(200f, 1000f, this.hydration.value) * (double)delta * 0.0166666675359011)); } this.hydration.MoveTowards(0.0f, delta * 0.008333334f); this.calories.MoveTowards(0.0f, delta * 0.01666667f); this.heartrate.MoveTowards(0.05f, delta * 0.01666667f); }
protected override void RunMetabolism(BaseCombatEntity ownerEntity, float delta) { if (Interface.CallHook("OnRunPlayerMetabolism", (object)this, (object)ownerEntity, (object)delta) != null) { return; } float currentTemperature = this.owner.currentTemperature; float fTarget = this.owner.currentComfort; float currentCraftLevel = this.owner.currentCraftLevel; this.owner.SetPlayerFlag(BasePlayer.PlayerFlags.Workbench1, (double)currentCraftLevel == 1.0); this.owner.SetPlayerFlag(BasePlayer.PlayerFlags.Workbench2, (double)currentCraftLevel == 2.0); this.owner.SetPlayerFlag(BasePlayer.PlayerFlags.Workbench3, (double)currentCraftLevel == 3.0); this.owner.SetPlayerFlag(BasePlayer.PlayerFlags.SafeZone, this.owner.InSafeZone()); float num1 = currentTemperature - this.DeltaWet() * 34f; float num2 = Mathf.Clamp(this.owner.baseProtection.amounts[18] * 1.5f, -1f, 1f); float num3 = Mathf.InverseLerp(20f, -50f, currentTemperature); float num4 = Mathf.InverseLerp(20f, 30f, currentTemperature); this.temperature.MoveTowards(num1 + num3 * 70f * num2 + num4 * 10f * Mathf.Abs(num2) + this.heartrate.value * 5f, delta * 5f); if ((double)this.temperature.value >= 40.0) { fTarget = 0.0f; } this.comfort.MoveTowards(fTarget, delta / 5f); float num5 = (float)(0.600000023841858 + 0.400000005960464 * (double)this.comfort.value); if (((double)this.calories.value <= 100.0 || (double)this.owner.healthFraction >= (double)num5 || ((double)this.radiation_poison.Fraction() >= 0.25 || (double)this.owner.SecondsSinceAttacked <= 10.0) || (this.SignificantBleeding() || (double)this.temperature.value < 10.0) ? 0 : ((double)this.hydration.value > 40.0 ? 1 : 0)) != 0) { float num6 = Mathf.InverseLerp(this.calories.min, this.calories.max, this.calories.value); float num7 = 5f; float num8 = (float)((double)num7 * (double)this.owner.MaxHealth() * 0.800000011920929 / 600.0); float num9 = num8 + (float)((double)num8 * (double)num6 * 0.5); float num10 = num9 / num7; float num11 = num10 + (float)((double)num10 * (double)this.comfort.value * 6.0); ownerEntity.Heal(num11 * delta); this.calories.Subtract(num9 * delta); this.hydration.Subtract((float)((double)num9 * (double)delta * 0.200000002980232)); } this.heartrate.MoveTowards(Mathf.Clamp(0.05f + (float)((double)this.owner.estimatedSpeed2D / (double)this.owner.GetMaxSpeed() * 0.75), 0.0f, 1f), delta * 0.1f); float num12 = this.heartrate.Fraction() * 0.375f; this.calories.MoveTowards(0.0f, delta * num12); float num13 = 0.008333334f + Mathf.InverseLerp(40f, 60f, this.temperature.value) * 0.08333334f + this.heartrate.value * 0.06666667f; this.hydration.MoveTowards(0.0f, delta * num13); this.owner.SetPlayerFlag(BasePlayer.PlayerFlags.NoSprint, (double)this.hydration.Fraction() <= 0.0 || (double)this.radiation_poison.value >= 100.0); if ((double)this.temperature.value > 40.0) { this.hydration.Add((float)((double)Mathf.InverseLerp(40f, 200f, this.temperature.value) * (double)delta * -1.0)); } if ((double)this.temperature.value < 10.0) { float num6 = Mathf.InverseLerp(20f, -100f, this.temperature.value); this.heartrate.MoveTowards(Mathf.Lerp(0.2f, 1f, num6), delta * 2f * num6); } float num14 = this.owner.WaterFactor(); if ((double)num14 > 0.850000023841858) { this.oxygen.MoveTowards(0.0f, delta * 0.1f); } else { this.oxygen.MoveTowards(1f, delta * 1f); } float num15 = 0.0f; float num16 = 0.0f; if (this.owner.IsOutside(this.owner.eyes.position)) { num15 = Climate.GetRain(this.owner.eyes.position) * 0.6f; num16 = Climate.GetSnow(this.owner.eyes.position) * 0.2f; } bool flag = (double)this.owner.baseProtection.amounts[4] > 0.0; if (!flag) { this.wetness.value = Mathf.Max(this.wetness.value, num14); } float num17 = Mathx.Max(this.wetness.value, num15, num16); this.wetness.MoveTowards(Mathf.Min(num17, flag ? 0.0f : num17), delta * 0.05f); if ((double)num14 < (double)this.wetness.value) { this.wetness.MoveTowards(0.0f, delta * 0.2f * Mathf.InverseLerp(0.0f, 100f, currentTemperature)); } this.poison.MoveTowards(0.0f, delta * 0.5555556f); if ((double)this.wetness.Fraction() > 0.400000005960464 && (double)this.owner.estimatedSpeed > 0.25 && (double)this.radiation_level.Fraction() == 0.0) { this.radiation_poison.Subtract((float)((double)this.radiation_poison.value * 0.200000002980232 * (double)this.wetness.Fraction() * (double)delta * 0.200000002980232)); } if (ConVar.Server.radiation) { this.radiation_level.value = this.owner.radiationLevel; if ((double)this.radiation_level.value > 0.0) { this.radiation_poison.Add(this.radiation_level.value * delta); } } if ((double)this.pending_health.value <= 0.0) { return; } float num18 = Mathf.Min(1f * delta, this.pending_health.value); ownerEntity.Heal(num18); if ((double)ownerEntity.healthFraction == 1.0) { this.pending_health.value = 0.0f; } else { this.pending_health.Subtract(num18); } }
protected override void RunMetabolism(BaseCombatEntity ownerEntity, float delta) { if (Interface.CallHook("OnRunPlayerMetabolism", this, ownerEntity, delta) != null) { return; } float single = this.owner.currentTemperature; float single1 = this.owner.currentComfort; float single2 = this.owner.currentCraftLevel; this.owner.SetPlayerFlag(BasePlayer.PlayerFlags.Workbench1, single2 == 1f); this.owner.SetPlayerFlag(BasePlayer.PlayerFlags.Workbench2, single2 == 2f); this.owner.SetPlayerFlag(BasePlayer.PlayerFlags.Workbench3, single2 == 3f); this.owner.SetPlayerFlag(BasePlayer.PlayerFlags.SafeZone, this.owner.InSafeZone()); float single3 = single - this.DeltaWet() * 34f; float single4 = Mathf.Clamp(this.owner.baseProtection.amounts[18] * 1.5f, -1f, 1f); float single5 = Mathf.InverseLerp(20f, -50f, single); float single6 = Mathf.InverseLerp(20f, 30f, single); single3 = single3 + single5 * 70f * single4; single3 = single3 + single6 * 10f * Mathf.Abs(single4); single3 = single3 + this.heartrate.@value * 5f; this.temperature.MoveTowards(single3, delta * 5f); if (this.temperature.@value >= 40f) { single1 = 0f; } this.comfort.MoveTowards(single1, delta / 5f); float single7 = 0.6f + 0.4f * this.comfort.@value; if ((this.calories.@value <= 100f || this.owner.healthFraction >= single7 || this.radiation_poison.Fraction() >= 0.25f || this.owner.SecondsSinceAttacked <= 10f || this.SignificantBleeding() || this.temperature.@value <10f ? false : this.hydration.@value> 40f)) { float single8 = Mathf.InverseLerp(this.calories.min, this.calories.max, this.calories.@value); float single9 = 5f; float single10 = single9 * this.owner.MaxHealth() * 0.8f / 600f; single10 = single10 + single10 * single8 * 0.5f; float single11 = single10 / single9; single11 = single11 + single11 * this.comfort.@value * 6f; ownerEntity.Heal(single11 * delta); this.calories.Subtract(single10 * delta); this.hydration.Subtract(single10 * delta * 0.2f); } float maxSpeed = this.owner.estimatedSpeed2D / this.owner.GetMaxSpeed() * 0.75f; float single12 = Mathf.Clamp(0.05f + maxSpeed, 0f, 1f); this.heartrate.MoveTowards(single12, delta * 0.1f); float single13 = this.heartrate.Fraction() * 0.375f; this.calories.MoveTowards(0f, delta * single13); float single14 = 0.008333334f; single14 = single14 + Mathf.InverseLerp(40f, 60f, this.temperature.@value) * 0.0833333358f; single14 = single14 + this.heartrate.@value * 0.06666667f; this.hydration.MoveTowards(0f, delta * single14); this.owner.SetPlayerFlag(BasePlayer.PlayerFlags.NoSprint, (this.hydration.Fraction() <= 0f ? true : this.radiation_poison.@value >= 100f)); if (this.temperature.@value > 40f) { this.hydration.Add(Mathf.InverseLerp(40f, 200f, this.temperature.@value) * delta * -1f); } if (this.temperature.@value < 10f) { float single15 = Mathf.InverseLerp(20f, -100f, this.temperature.@value); this.heartrate.MoveTowards(Mathf.Lerp(0.2f, 1f, single15), delta * 2f * single15); } float single16 = this.owner.WaterFactor(); if (single16 <= 0.85f) { this.oxygen.MoveTowards(1f, delta * 1f); } else { this.oxygen.MoveTowards(0f, delta * 0.1f); } float rain = 0f; float snow = 0f; if (this.owner.IsOutside(this.owner.eyes.position)) { rain = Climate.GetRain(this.owner.eyes.position) * 0.6f; snow = Climate.GetSnow(this.owner.eyes.position) * 0.2f; } bool flag = this.owner.baseProtection.amounts[4] > 0f; if (!flag) { this.wetness.@value = Mathf.Max(this.wetness.@value, single16); } float single17 = Mathx.Max(this.wetness.@value, rain, snow); single17 = Mathf.Min(single17, (flag ? 0f : single17)); this.wetness.MoveTowards(single17, delta * 0.05f); if (single16 < this.wetness.@value) { this.wetness.MoveTowards(0f, delta * 0.2f * Mathf.InverseLerp(0f, 100f, single)); } this.poison.MoveTowards(0f, delta * 0.5555556f); if (this.wetness.Fraction() > 0.4f && this.owner.estimatedSpeed > 0.25f && this.radiation_level.Fraction() == 0f) { this.radiation_poison.Subtract(this.radiation_poison.@value * 0.2f * this.wetness.Fraction() * delta * 0.2f); } if (ConVar.Server.radiation) { this.radiation_level.@value = this.owner.radiationLevel; if (this.radiation_level.@value > 0f) { this.radiation_poison.Add(this.radiation_level.@value * delta); } } if (this.pending_health.@value > 0f) { float single18 = Mathf.Min(1f * delta, this.pending_health.@value); ownerEntity.Heal(single18); if (ownerEntity.healthFraction == 1f) { this.pending_health.@value = 0f; return; } this.pending_health.Subtract(single18); } }