106 public virtual bool Eat(
int value) {
107 bool skipVanilla =
false;
108 bool eatSuccess =
false;
109 int modifiedValue = value;
114 loader.OnVitalStatsEat(
this, ref modifiedValue, ref skipVanilla, out eatSuccess);
130 && sicknessProbability > 0f) {
139 "Audio/Creatures/HumanEat",
152 value2 += MathF.Max(num2, 0.5f);
157 else if (sicknessProbability >= 0.5f) {
160 else if (sicknessProbability > 0f) {
163 else if (value2 > 2.5f) {
166 else if (value2 > 2f) {
169 else if (
Food > 0.85f) {
175 if (
m_random.Bool(sicknessProbability)
210 m_pantingSound.IsLooped =
true;
211 Food = valuesDictionary.GetValue<
float>(
"Food");
212 Stamina = valuesDictionary.GetValue<
float>(
"Stamina");
213 Sleep = valuesDictionary.GetValue<
float>(
"Sleep");
214 Temperature = valuesDictionary.GetValue<
float>(
"Temperature");
215 Wetness = valuesDictionary.GetValue<
float>(
"Wetness");
224 foreach (KeyValuePair<string, object> item
in valuesDictionary.GetValue<
ValuesDictionary>(
"Satiation")) {
225 m_satiation[
int.Parse(item.Key, CultureInfo.InvariantCulture)] = (float)item.Value;
230 valuesDictionary.SetValue(
"Food",
Food);
231 valuesDictionary.SetValue(
"Stamina",
Stamina);
232 valuesDictionary.SetValue(
"Sleep",
Sleep);
233 valuesDictionary.SetValue(
"Temperature",
Temperature);
234 valuesDictionary.SetValue(
"Wetness",
Wetness);
236 valuesDictionary.SetValue(
"Satiation", valuesDictionary2);
237 foreach (KeyValuePair<int, float> item
in m_satiation) {
238 if (item.Value > 0f) {
239 valuesDictionary2.SetValue(item.Key.ToString(CultureInfo.InvariantCulture), item.Value);
249 bool skipVanilla =
false;
250 float modifiedFood =
Food;
254 "OnVitalStatsUpdateFood",
256 loader.OnVitalStatsUpdateFood(
this, ref modifiedFood, ref gameTimeDelta, ref skipVanilla);
261 if (skipVanilla)
return;
265 float num2 = m_componentPlayer.ComponentCreatureModel.EyePosition.Y -
m_componentPlayer.ComponentBody.Position.Y;
266 bool flag = m_componentPlayer.ComponentBody.ImmersionDepth > num2;
267 bool flag2 = m_componentPlayer.ComponentBody.ImmersionFactor > 0.33f && !
m_componentPlayer.ComponentBody.StandingOnValue.HasValue;
272 Food -= hungerFactor * gameTimeDelta / 2880f;
274 Food -= hungerFactor * gameTimeDelta * num / 1440f;
277 Food -= hungerFactor * gameTimeDelta * num / 2880f;
279 Food -= hungerFactor * lastJumpOrder / 1200f;
281 Food -= hungerFactor * gameTimeDelta / 2880f;
295 else if (
Food < 0.25f
313 float num3 = MathF.Max(satiation.Value - 0.000416666677f, 0f);
320 m_componentPlayer.ComponentGui.FoodBarWidget.Value =
Food;
324 bool skipVanilla =
false;
325 float modifiedStamina =
Stamina;
329 "OnVitalStatsUpdateStamina",
331 loader.OnVitalStatsUpdateStamina(
this, ref modifiedStamina, ref gameTimeDelta, ref skipVanilla);
336 if (skipVanilla)
return;
338 float lastWalkOrder =
m_componentPlayer.ComponentLocomotion.LastWalkOrder?.Length() ?? 0f;
340 float playerHeight = m_componentPlayer.ComponentCreatureModel.EyePosition.Y -
m_componentPlayer.ComponentBody.Position.Y;
341 bool IsImmersedCompletely = m_componentPlayer.ComponentBody.ImmersionDepth > playerHeight;
342 bool IsImmersed = m_componentPlayer.ComponentBody.ImmersionFactor > 0.33f && !
m_componentPlayer.ComponentBody.StandingOnValue.HasValue;
345 float num3 = 1f / MathF.Max(
m_componentPlayer.ComponentLevel.SpeedFactor, 0.75f);
350 Stamina += gameTimeDelta * 0.07f;
351 Stamina -= 0.025f * lastJumpOrder * num3;
352 if (IsImmersed | IsImmersedCompletely) {
353 Stamina -= gameTimeDelta * (0.07f + 0.006f * num3 + 0.008f * lastWalkOrder);
356 Stamina -= gameTimeDelta * (0.07f + 0.006f * num3) * lastWalkOrder;
359 && !IsImmersedCompletely
364 if (IsImmersed | IsImmersedCompletely
370 if (IsImmersed | IsImmersedCompletely) {
375 if (
m_random.Float(0f, 1f) < 1f * gameTimeDelta) {
376 m_componentPlayer.ComponentLocomotion.JumpOrder = 1f;
385 if (!IsImmersedCompletely
387 float num5 = m_componentPlayer.PlayerData.PlayerClass ==
PlayerClass.Female ? 0.2f : 0f;
388 m_pantingSound.Volume = 1f
418 bool skipVanilla =
false;
419 float modifiedSleep =
Sleep;
423 "OnVitalStatsUpdateSleep",
425 loader.OnVitalStatsUpdateSleep(
this, ref modifiedSleep, ref gameTimeDelta, ref skipVanilla);
430 if (skipVanilla)
return;
432 bool flag = m_componentPlayer.ComponentBody.ImmersionFactor > 0.05f;
437 Sleep += 0.05f * gameTimeDelta;
441 Sleep -= gameTimeDelta / 1800f;
447 else if (
Sleep < 0.2f
452 else if (
Sleep < 0.33f
456 else if (
Sleep < 0.5f
460 if (
Sleep < 0.075f) {
463 if (
m_random.Float(0f, 1f) < num * gameTimeDelta) {
484 m_componentPlayer.ComponentScreenOverlays.BlackoutFactor = MathF.Max(
496 bool skipVanilla =
false;
501 "OnVitalStatsUpdateTemperature",
503 loader.OnVitalStatsUpdateTemperature(
this, ref modifiedTemperature, ref gameTimeDelta, ref skipVanilla);
508 if (skipVanilla)
return;
513 num = num * 1.5f + 1f;
518 if (
m_subsystemTime.PeriodicGameTimeEvent(1.0, 1.0 * (GetHashCode() % 1000 / 1000.0))) {
588 m_componentPlayer.ComponentScreenOverlays.BlackoutFactor = MathF.Max(
612 m_componentPlayer.ComponentGui.TemperatureBarWidget.BarSubtexture =
m_targetTemperature > 2f
619 bool skipVanilla =
false;
620 float modifiedWetness =
Wetness;
624 "OnVitalStatsUpdateWetness",
626 loader.OnVitalStatsUpdateWetness(
this, ref modifiedWetness, ref gameTimeDelta, ref skipVanilla);
631 if (skipVanilla)
return;
641 if (Wetness > 0.8f) {
642 m_componentPlayer.ComponentGui.DisplaySmallMessage(LanguageControl.Get(fName, 38), Color.White, true, true);
654 && Wetness > m_lastWetness) {
655 m_componentPlayer.ComponentGui.DisplaySmallMessage(LanguageControl.Get(fName, 39), Color.White, true, true);
666 m_componentPlayer.ComponentGui.DisplaySmallMessage(LanguageControl.Get(fName, 40), Color.White, true, true);
672 m_lastWetness = Wetness;