Mods / An AFK Story

Tags: #Utility
Authors: Syd, Ritzga
Side: Server
Created: Nov 28th 2024 at 7:42 PM
Last modified: Oct 26th at 6:05 PM
Downloads: 6161
Follow Unfollow 81

Latest release (for Vintage Story 1.21.0 - 1.21.4, potentially outdated):
AnAFKStory-v0.9.7-1.21.0.zip  1-click install
For testers (for Vintage Story 1.21.0 - 1.21.5):
AnAFKStory-v0.9.8-dev.1-1.21.0.zip  1-click install


✨ Intro

Players who stand still for 30 seconds automatically go AFK. While AFK, they receive:

  • Full saturation
  • Invulnerability

As soon as the player moves or clicks, they leave AFK status.

🔧 Configuration Options

  • Timeout: Change the 30 seconds in config.json by setting "MaxTimeOut" to your desired value.
  • Announcements: To make AFK announcements server-wide, set "SendMessageTo" to anything other than "self".
  • Manual AFK Command: Enable /afk by setting "EnableAfkCommand" to true (disabled by default).

💡 Why This Mod?

I often go AFK while working on other mods and end up dying of hunger. Since I can’t use creative mode for my setup, this mod was born!
I observed players, just hang out on the Server. They are in voice chat, but actually idle in game. These players don't have to eat that often any more.

🐞 Known Issues

  • If you don’t move while chopping wood, you might still go AFK (this uses vanilla mechanics).
  • Using a boat can trigger AFK — I may add a config option for this.
  • You can freeze to death → will be the next feature I'm working on.
  • If you log out while AFK, your saturation bar will still be full when you log back in. → Fixed in 0.9.7
  • My Mod had a big bug in the past, which basically made players always hungry. It is fixed now, and I'm still sorry for the frustration I caused in the past. → fixed in 0.9.0

Mod Version Mod IdentifierFor Game version Downloads Released Changelog Download 1-click mod install*
0.9.8-dev.1 anafkstory
1.21.0 - 1.21.5
970 Oct 26th at 6:05 PM AnAFKStory-v0.9.8-dev.1-1.21.0.zip 1-click install

* added better AFK logic based on a suggestion by @HaMeRoN

0.9.7 anafkstory
1.21.0 - 1.21.4
760 Oct 12th at 2:24 PM AnAFKStory-v0.9.7-1.21.0.zip 1-click install

Fixed:

* fixed the "you log out during AFK and keep your saturation" bug

* made it not show the "outdated mod" banner, I did not have to change anything from 1.20 to 1.21

0.9.5 anafkstory
1.20.0 - 1.20.4
1123 Mar 16th at 6:15 PM AnAFKStory-v0.9.5-1.20.0.zip 1-click install

tried to fix the 0 Saturation bug

0.9.5-rc.1 anafkstory
1.19.0 - 1.19.3 1.19.5 - 1.19.8
57 Mar 16th at 6:16 PM AnAFKStory-v0.9.5-rc.1-1.19.0.zip 1-click install

trying to fix the 0 Saturation Bug

0.9.4 anafkstory
1.20.0 - 1.20.3
147 Feb 23rd at 10:08 PM AnAFKStory-v0.9.4-1.20.0.zip 1-click install

updated for Version 1.20.0+

0.9.4-rc.1 anafkstory 47 Feb 23rd at 10:16 PM AnAFKStory-v0.9.4-rc.1-1.19.0.zip 1-click install

fixed saturation and movement detection hopefully.

0.9.3 anafkstory
1.19.5 - 1.19.8
2520 Dec 14th 2024 at 7:57 PM AnAFKStory-v0.9.3-1.19.0.zip 1-click install
  • hopefully fixes a bug where players would just never be hungry again
  • fixes that you might get AFK, when you use your mouse only.
0.9.2 anafkstory
1.19.5 - 1.19.8
Dec 8th 2024 at 1:29 PM 1-click install
  • Added /AFK command (can be enabled in config. is disabled on default)
  • Added Config Parameter to announce AFK / UnAFK server wide.
0.9.0 anafkstory Nov 28th 2024 at 7:43 PM 1-click install

Initial release


37 Comments (oldest first | newest first)

💬 ArmoredStone, Nov 7th at 5:40 PM (modified Nov 7th at 6:38 PM)

Hey Syd I have a feature request if you're interested. I really want a mod that pauses my single player game if I go AFK for a set amount of time. I've sometimes forgotten to pause when I walk away and it doesnt end well. But I don't want this mo because it rewards me for cheesing being AFK while waiting for stuff to process

💬 Syd , Nov 2nd at 5:43 PM

Ruina the "no message feature" I need to implement, but I will do that. for hydrate look at a couple of comments below Hameron made a compatibility mod.

💬 Ruina, Nov 2nd at 2:50 PM (modified Nov 2nd at 2:54 PM)

how to not send afk messages?

 

and, may you make it compatible with [Hydrate or Diedrate]?

💬 Syd , Oct 28th at 4:50 PM (modified Oct 30th at 6:10 PM)

HaMeRoN about the repeated log messages. You've seen the code. It is a simple "if not set then set bool" thing. I make a dev.2 where I introduce a timer, but I really don't like it. I removed that feature again. The mod does what it is supposed to do atm.

About the Defender. IDK I just build normally. Again you can see the code there is nothing malicious about it. I upload dev.2 later atm the Emojis in the post description are broken I wait for the moderators to react.

btw can you explain to me why you have verbose logs enabled on a productive server?

💬 HaMeRoN, Oct 28th at 10:53 AM (modified Oct 28th at 10:54 AM)

Hi! A few of our players are reporting that Windows Defender flags the mod’s archive as malware. As long as Defender quarantines it, they can’t connect to the server with this mod enabled unless they add an exclusion. Do you have any idea what might be triggering this false positive, or could you repackage the archive to avoid the heuristic hit?

 

💬 HaMeRoN, Oct 27th at 6:35 PM (modified Oct 27th at 6:36 PM)

So far, so good. The only thing that concerns me is that the checks sometimes run several times per second.

EntityBehaviorAutoAFKHandler
27.10.2025 16:53:53.214 [VerboseDebug] [EntityBehaviorAutoAFKHandler] setting hunger and invulnerability
27.10.2025 16:53:53.315 [VerboseDebug] [EntityBehaviorAutoAFKHandler] setting hunger and invulnerability
27.10.2025 16:53:54.425 [VerboseDebug] [EntityBehaviorAutoAFKHandler] setting hunger and invulnerability
27.10.2025 16:54:11.950 [VerboseDebug] [EntityBehaviorAutoAFKHandler] clearing hunger and invulnerability
💬 HaMeRoN, Oct 26th at 7:31 PM (modified Oct 26th at 7:32 PM)

@Syd I’ve installed it on the server. In theory, that should be enough. There’ll be a restart tonight, and I’ll report what changes. Thanks so much for the quick reply — I honestly didn’t expect it!

💬 Syd , Oct 26th at 6:20 PM

HaMeRoN I made a v0.9.8-dev.1 for you to test.

💬 HaMeRoN, Oct 26th at 4:58 PM (modified Oct 26th at 5:09 PM)

Hi! I dug into the AFK handler and found three core issues behind the log spam:

  1. Comparing floats to exact zero.
    GetBlended() returns a float; due to rounding and other modifiers it’s almost never exactly 0. That != 0 check fires every tick and spams the log.

  2. “Zeroing” via adding the negative of the current blended value.
    That’s an additive correction. Any other change to stats (gear/buffs/mods) instantly shifts the result again → loop of “check → remove → set → next tick it’s non-zero again”.

  3. Logging every tick.
    Even if (1) and (2) were fixed, writing VerboseDebug each tick guarantees spam.

    Suggested fix (simple & robust):

    On AFK enter, apply a multiplicative modifier of 0 with a stable key; on AFK exit, remove it. No per-tick adjustments or logs needed; zero times anything stays zero.

    Example:

    // On AFK enter:
    player.Stats.Set("hungerrate", nameof(EntityBehaviorAutoAFKHandler), 0f, true /* multiply */);

    // On AFK exit:
    player.Stats.Remove("hungerrate", nameof(EntityBehaviorAutoAFKHandler));

    If you still want a safety check while AFK, use an epsilon:

    var hr = player.Stats["hungerrate"].GetBlended();

    if (Math.Abs(hr) > 0.0005f) {

    player.Stats.Remove("hungerrate", nameof(EntityBehaviorAutoAFKHandler));

    player.Stats.Set("hungerrate", nameof(EntityBehaviorAutoAFKHandler), 0f, true /* multiply */);

    }

Please fix this bug. Otherwise, I’ll have to write my own alternative. I have 25+ players on my server, and the server’s ticks start dropping for no apparent reason.
Happy to test a patched build on my server and report back quickly.

💬 Syd , Oct 26th at 2:02 PM

HaMeRoN thank you for notifying me. I appreciate it.

Azraile it basically gives you "anti-hunger" or filling that is opposite to your hunger rate, so that they cancel each other out.

 

I don't plan to add a kick system. I want my players to be AFK and around, because that basically makes them NPCs and the world be a bit more lively. (I'm not opposed to people adding compatibility mods, adding those features)

💬 Azraile, Oct 24th at 2:47 AM

I was also going to ask for a hydrate or diedrate compatability..... lol   though don't realy need a kick system build into this, server mods have stuff like that don't they?

💬 HaMeRoN, Oct 24th at 2:38 AM

I do compatibility mod to HoD and kick system for your mod https://news.kalataka.ru/afkhod

💬 Azraile, Oct 24th at 2:31 AM

dose this stop your food bar from lowering or dose it fill it up?

💬 Pagan_Sunburn, Oct 19th at 12:58 PM

My Ubuntu 24.04 LTS server does not detect this mod and does not work on 1.21.5

💬 Krazyfan1, Oct 13th at 10:42 AM

I wonder if this could be used for the base of a sort of Hibernation mod?

where the player presses a key, they lie down/kneel, and lose barely any hunger?

💬 Syd , Mar 16th at 6:17 PM

I finally had the same bug as everyone. IDK, why I haven't encountered it. It should be fixed now. i continue to play on my own server to see if I run into other issues.

💬 ThomasJefferson, Mar 9th at 5:55 PM

Same issues as below. I had no problem with the previous version AND it worked in 1.20.x
However, the link to the old file is broken, so I can't even revert 🤦‍♂️

💬 GaymerMike, Feb 24th at 12:58 AM

this update is causing an issue for me on my server that my hunger is drained to 0 and eating wont help get it higher. so im dying slowly

💬 SalazarWindriver, Jan 31st at 12:58 AM

It seems to not work fully in 1.20 as intended.  It sets hunger to 0 but can still be attacked and die by drifters.

💬 YourLocalMedic, Jan 21st at 11:53 PM

I'm having an issue where being in a boat and rowing still counts as being AFK because you legally aren't moving

💬 ManaWei, Jan 20th at 11:19 AM

Game says it's asking for version 1.19.0.. 

💬 Desolae, Jan 17th at 7:09 AM

Mod seems to be not working in one of my worlds. Singleplayer world, it works fine. But in the world I used to open to LAN/internet, it doesn't work - even if I don't currently open it to LAN/internet. I see the afk message, my hunger rate goes to 0 in the character panel, but my satiety keeps dropping. Once I'm starving, I keep taking damage from starving too.

EDIT: This is in 1.19.8

💬 Syd , Jan 14th at 6:00 PM

MimiKitty invulnerable makes drifter and other monsters not able to hurt you. it is an internal status that is already in the game and might do much more.

yes you are able to look around. you are no longer AFK, when the character moves or interacts so left or right button click. So yes chatting and looking around should work intentionally (that is why I made the mod)

- I can add a way to disable the message no problem.

- I can make them vulnerable as per config. yes

💬 MimiKitty, Dec 30th 2024 at 11:13 PM

what does "invulnerable" do? can we totally disable the chat messages? can players look around without going afk? pretty much I would want it so once afk a player no longer loses hunger but can still chat and look around. mainly as a way to let players be on a server and "hang out" without being punished for not being active while playing. I still want them to be attackable/damagable and look around/chat!

💬 Syd , Dec 14th 2024 at 7:30 PM

okay I'm very sorry this didn't come up while testing. I removed all old versions of the mod, because that is unplayable and uploaded a version with a fix hopefully.

 

I also saw, that I have to unset AFK, whe you are crafting or building as that tend to set you AFK as well.

💬 Dubble, Dec 12th 2024 at 2:14 PM

Syd We are also having the same issue. We are getting stuck at 0% hungerrate due to seemingly the same reason Noa3 mentions.

💬 Noa3, Dec 12th 2024 at 3:53 AM

Hi, i put this mod on my server and AFK starts right after connecting on the server and the status doesnt get lost if moved around or even removed again from the server. Players are now stuck to 0% Hungerrate

💬 DejFidOFF, Dec 11th 2024 at 7:58 PM

Syd

Not working. player goes AFK right after connect to server and satiety did not go down..
config:

{
  "MaxTimeOut": 120,
  "SendMessageTo": "chat",
  "EnableAfkCommand": "false"
}
💬 Syd , Dec 11th 2024 at 7:07 PM

JosephOcala try to add it back in and walk around, it will try to reset itself, but looks like I have to add in a more solid reset.

💬 JosephOcala, Dec 11th 2024 at 12:31 PM

Not sure what happened but it has permanently set my hunger rate at 0, even after I removed it from my mod folder I'm still stuck at 0

💬 DejFidOFF, Dec 8th 2024 at 3:48 PM

Syd

Great! I will be testing that. Will be nice to add a kick system (configurable) so players can´t be AFK for eternity on the server

 

💬 Syd , Dec 8th 2024 at 1:48 PM

DejFidOFF I added it in. It is disabled on default, but can be enabled through server settings.

💬 Syd , Dec 8th 2024 at 12:30 PM

rayray good to know, thanks

💬 rayray, Dec 2nd 2024 at 10:01 PM

this works on 1.20 unstable as is 

💬 rayray, Dec 2nd 2024 at 10:00 PM
💬 Aricus, Dec 1st 2024 at 4:21 AM

Oh this looks amazing! I'm playing on 1.20 pre though, I can't wait until this is updated

💬 DejFidOFF, Nov 28th 2024 at 8:08 PM

Syd

Hey o/ Good job. I am looking for something like this a long ago. But will be possible implemented a msg to chat? Something like in MC? "Player XY is AFK" which everyone can see.

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