Mods / An AFK Story
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.jsonby setting"MaxTimeOut"to your desired value. - Announcements: To make AFK announcements server-wide, set
"SendMessageTo"to anything other than"self". - Manual AFK Command: Enable
/afkby setting"EnableAfkCommand"totrue(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 Identifier | For Game version | Downloads | Released | Changelog | Download | 1-click mod install* |
|---|---|---|---|---|---|---|---|
| 0.9.8-dev.1 | anafkstory | 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 | 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 | 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 | 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 | 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 | 2520 | Dec 14th 2024 at 7:57 PM | AnAFKStory-v0.9.3-1.19.0.zip | 1-click install | ||
| |||||||
| 0.9.2 | anafkstory | Dec 8th 2024 at 1:29 PM | 1-click install | ||||
| |||||||
| 0.9.0 | anafkstory | Nov 28th 2024 at 7:43 PM | 1-click install | ||||
|
Initial release | |||||||
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
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.
how to not send afk messages?
and, may you make it compatible with [Hydrate or Diedrate]?
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?
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?
So far, so good. The only thing that concerns me is that the checks sometimes run several times per second.
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
@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!
HaMeRoN I made a v0.9.8-dev.1 for you to test.
Hi! I dug into the AFK handler and found three core issues behind the log spam:
Comparing floats to exact zero.
GetBlended()returns a float; due to rounding and other modifiers it’s almost never exactly0. That!= 0check fires every tick and spams the log.“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”.
Logging every tick.
Even if (1) and (2) were fixed, writing
VerboseDebugeach tick guarantees spam.On AFK enter, apply a multiplicative modifier of
0with 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));
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.
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)
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?
I do compatibility mod to HoD and kick system for your mod https://news.kalataka.ru/afkhod
dose this stop your food bar from lowering or dose it fill it up?
My Ubuntu 24.04 LTS server does not detect this mod and does not work on 1.21.5
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?
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.
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 🤦♂️
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
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.
I'm having an issue where being in a boat and rowing still counts as being AFK because you legally aren't moving
Game says it's asking for version 1.19.0..
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
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
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!
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.
Syd We are also having the same issue. We are getting stuck at 0% hungerrate due to seemingly the same reason Noa3 mentions.
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
Syd
Not working. player goes AFK right after connect to server and satiety did not go down..
config:
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.
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
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
DejFidOFF I added it in. It is disabled on default, but can be enabled through server settings.
rayray good to know, thanks
this works on 1.20 unstable as is
Oh this looks amazing! I'm playing on 1.20 pre though, I can't wait until this is updated
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.