Mods / Hunger Patcher

Tags: #Food #Other #Tweak #Utility
Author: traugdor
Side: Server
Created: 15 hours ago
Last modified: 14 hours ago
Downloads: 40
Follow Unfollow 2

Recommended download (for Vintage Story 1.21.1):
HungerPatcher.zip  1-click install


Patch for a long-standing issue that would cause your satiety meter to pause for an indefinite period of time. Inspired by Smooth Digestion mod, but designed to be compatible with other mods.

It's not a hard dependency, but this mod is required for Expanded Stomach to work properly.

 

Bug Walkthrough. And no, this is NOT the delay you get after eating a meal. But it is caused by it... Well it's not really but it's related to it a little bit.... just read if you're curious.

How to trigger the bug

  1. Take damage
  2. Eat a meal
  3. ???
  4. Profit

 

Why it does this:

  1. The game keeps track of time using an internal counter called hungerCounter. This counter gets increased every time the game ticks in the OnGameTick method of the EntityBehaviorHunger class. Because the game tick speed is not an exact number it just accumulates by about one second.
  2. Once the hungerCounter exceeds 10, it is assumed that 10s of real world time have passed.
  3. The OnGameTick method of the EntityBehaviorHunger class triggers a ReduceSaturation method.
  4. This method checks to see if there is any meal delay (because of the benefit of eating meals as you pointed out).
  5. If there is still a delay, the delay has a small number subtracted from it and a variable is set called isondelay and given a true/false value of true.
  6. If isondelay is set to true, the game will then subtract 10 from the hungerCounter and the method ends.
  7. IF the player is injured, the game will attempt to exchange satiety for health. It does this by calculating an amount of satiety to consume every game in the OnGameTick method of the EntityBehaviorHealth class. NOTE: This is different from the previous EntityBehaviorHunger class. It then sends this value to a method called ConsumeSaturation.
  8. ConsumeSaturation does not adhere to the 10s rule because it is outside of the OnGameTick method of the EntityBehaviorHunger class. Thus instead of being called once every 10s, it is being called once every 1s. It gets called 10x as often when the player is injured!
  9. ConsumeSaturation does some calculations and passes the value off to ReduceSaturation! Remember this is once every 1s instead of once every 10s!
  10. Because the player JUST ate, the meal delay values are quite high. Because you are only sacrificing a small amount of hunger to regenerate your health, the meal delay values take a long time to decrease. Every time this happens, the hungerCounter is lowered by 10.

 

So to summarize:

  1. The game increases hungerCounter by roughly 1s every game tick.
  2. If the player is injured and has a meal delay, hungerCounter is decreased by 10s every game tick. This has a net result of lowering hungerCounter by roughly 9s every game tick.
  3. If it takes a couple of minutes for the player to heal, hungerCounter will decrease to -1080 or so, meaning it's going to take another 1090 or so ticks for the hungerCounter to reach 10 again.
  4. 1090 ticks is 18 MINUTES of real world time. A day in Vintage Story takes 48 minutes of real world time. By doing some math, that's 9 in-game hours of the satiety meter not budging because hungerCounter never gets over 10 and thereby never triggers ReduceSaturation again.

 

This is a real problem, and that is what this mod is addressing.

Mod Version For Game version Downloads Released Changelog Download 1-click mod install*
1.0.1 34 14 hours ago HungerPatcher.zip 1-click install

removed debugging output

set to server-only

1.0.0 6 15 hours ago HungerPatcher.zip 1-click install

Initial release


5 Comments (oldest first | newest first)

💬 traugdor , 48 minutes ago

SeniLiX this mod is not for the saturation delay given by eating meals. It is for a BUG that causes your satiety meter to pause of an indefinitely period of time (like 5-6 in-game hours!) that is triggered by eating any food after taking damage. I can walk you through the bug and how it works if you want to read below, but there are at least 5 issue tickets on the issue tracker for Vintage Story and 1 pull request (authored by me) that is intended to fix those bugs.

Bug Walkthrough

How to trigger the bug

  1. Take damage
  2. Eat a meal
  3. ???
  4. Profit

 

Why it does this:

  1. The game keeps track of time using an internal counter called hungerCounter. This counter gets increased every time the game ticks in the OnGameTick method of the EntityBehaviorHunger class. Because the game tick speed is not an exact number it just accumulates by about one second.
  2. Once the hungerCounter exceeds 10, it is assumed that 10s of real world time have passed.
  3. The OnGameTick method of the EntityBehaviorHunger class triggers a ReduceSaturation method.
  4. This method checks to see if there is any meal delay (because of the benefit of eating meals as you pointed out).
  5. If there is still a delay, the delay has a small number subtracted from it and a variable is set called isondelay and given a true/false value of true.
  6. If isondelay is set to true, the game will then subtract 10 from the hungerCounter and the method ends.
  7. IF the player is injured, the game will attempt to exchange satiety for health. It does this by calculating an amount of satiety to consume every game in the OnGameTick method of the EntityBehaviorHealth class. NOTE: This is different from the previous EntityBehaviorHunger class. It then sends this value to a method called ConsumeSaturation.
  8. ConsumeSaturation does not adhere to the 10s rule because it is outside of the OnGameTick method of the EntityBehaviorHunger class. Thus instead of being called once every 10s, it is being called once every 1s. It gets called 10x as often when the player is injured!
  9. ConsumeSaturation does some calculations and passes the value off to ReduceSaturation! Remember this is once every 1s instead of once every 10s!
  10. Because the player JUST ate, the meal delay values are quite high. Because you are only sacrificing a small amount of hunger to regenerate your health, the meal delay values take a long time to decrease. Every time this happens, the hungerCounter is lowered by 10.

 

So to summarize:

  1. The game increases hungerCounter by roughly 1s every game tick.
  2. If the player is injured and has a meal delay, hungerCounter is decreased by 10s every game tick. This has a net result of lowering hungerCounter by roughly 9s every game tick.
  3. If it takes a couple of minutes for the player to heal, hungerCounter will decrease to -1080 or so, meaning it's going to take another 1090 or so ticks for the hungerCounter to reach 10 again.
  4. 1090 ticks is 18 MINUTES of real world time. A day in Vintage Story takes 48 minutes of real world time. By doing some math, that's 9 in-game hours of the satiety meter not budging because hungerCounter never gets over 10 and thereby never triggers ReduceSaturation again.

 

This is a real problem, and that is what this mod is addressing.

💬 SeniLiX, 9 hours ago

The pause after eating a meal is not a bug.

It is by design to reward the player into using the meal system.

💬 traugdor , 9 hours ago (modified 9 hours ago)

MrMutant is correct. This mod is a fix directly related to that bug. It is triggered by taking any damage and then immediately eating a meal afterwards.

 

If you don't find the bug annoying or game-breaking, then you don't have to use this mod, but I designed it specifically to be used with my other mod, Expanded Stomach, because this causes my other mod to think the player is just constantly overeating or not getting any exercise via running, walking, working in the mines or hammering ingots into tools, etc. As a result they start to experience the drawbacks of overeating a lot sooner than they should. This mod fixes that bug in a way that makes my other mod less likely to break.

💬 MrMutant, 10 hours ago

hopefully this isnt related to the meal pause, but for those that dont know there is a bug that makes hunger pause outside of meals, and even a pretty easy to do "trick" where you eat after taking starvation damage and your hunger wont drain for a couple mins. Possibly a fix for that

💬 MetalTYR, 10 hours ago

you do know your hunger bar is supposed to pause when you eat a cooked meal right?

its one of the benefits of eating cooked meals rather than chowing down on a dozen carrots.

i have never noticed any satiety meter pause that was not due to eating a meal, but i could have missed it.

 (edit comment delete)
Основной веб-сайт | Почтовый сервер | FTP сервер | Административная панель | API интерфейс | Content Delivery Network | Статические файлы | Ресурсы сайта | Изображения | Файловое хранилище | Блог | Интернет-магазин | Техническая поддержка | Справочная система | Документация | Форум | Новости | Загрузки | Демонстрация | Тестовая среда | Приложение | Медиа контент | Разработка | Промежуточная среда | Бета версия | Безопасная зона | Вход в систему | Панель управления | Портал | Система управления контентом