players do not sit up in bed when afk. The code does sit all players up when afk, but before this is applied, if they are dead or in bed, the code applies a "Lay" animation. The trick was, that in the original code, it would
1)every afk check interval check if the timeout has expired for no movement
2) if it has, set animation to lay
3)if it has not, set animation to stand, and set player as "not attached"
this was sloppy coding... if a player was in bed and not afk, then
1)the bed mod would set the animation to lay
2) the afk mod would set the animation to stand
3)the afk mod would set the player attached boolean to false, causing the bed mod to set the player animation to stand
So after fixing #2 by moving the set animation to stand code into the conditional for returning from afk,
I then had to find and fix #3 by checking if the player s in bed, and only if he is not in bed, setting the player attached code to false. THIS COULD ALSO CAUSE PROBLEMS WITH RIDING HORSES, boats and other attached player vehicles. NO PROVISION HAS BEEN MADE FOR OTHER ATTACHED PLAYER MODS, just for the bed mod. we should look into that...
I don't know why the afk mod is messing with the set player attached boolean value... Ideally, it shouldn't, I think.
anyhow, as it stands, a player in bed will continue to lie down. after 5 min, they will produce zzz s. In bed, the zzs come from lower down than out of bed. If they die, they will produce flies after the afk timeout.
I looked into sounds for the flies and zzz s, but I coulnd't record quality audio, and couldnt find free sounds I liked that fit, so I gave up.
If you want to put sounds in, place the sound command after each particle spawnner command. That will make the sound play every afk check interval (5 or 10 sec i think)