Stardew Valley
0 of 0

File information

Last updated

Original upload

Created by

Goldenrevolver

Uploaded by

Goldenrevolver

Virus scan

Safe to use

About this mod

Regenerate health and stamina while in bed in singleplayer (just like in multiplayer in the base game) and always while sitting (with the speed of being in bed in multiplayer from the base game)

Permissions and credits
Compatible with Stardew Valley 1.6.1 and SMAPI 4.0.1. Source available on Github:
https://github.com/Goldenrevolver/Stardew-Valley-Mods


Regenerate health and stamina while in bed in singleplayer (just like in multiplayer in the base game) and always while sitting (with the speed of being in bed in multiplayer from the base game).

Yes, I know, the sitting regen feature has already been done by at least two mods that got popular when 1.5 launched:

But at the time I made this mod as a personal mod, the former was regening in menus and was regening every player in multiplayer leading to stacking effects when multiple people used the mod, while the latter got really "advanced", as the author said themselves, which was not in my interest.

From playing so much multiplayer, I also got annoyed in singleplayer that I couldn't regen while I'm in my bed without ending the day (by not fully moving in or declining the popup). While there was the mod Singleplayer sleep by MindMeltMax, idea by Draylon, it was not updated and I only found it after getting the idea.


So long story short, I made this mod as short and as simple as I could; so simple that I bet quite a few non programmers can understand the source code:


// if we are in bed and in singleplayer (because multiplayer already has healing) or we are sitting
if ((Game1.player.isInBed && !Game1.IsMultiplayer) || Game1.player.isSitting)
{
// 'pause when inactive' only works when you are in singleplayer, not when you are alone in multiplayer (unlike menu pause)
bool outOfFocusPaused = Game1.multiplayerMode == Game1.singlePlayer && !Game1.game1.IsActive && Game1.options.pauseWhenOutOfFocus;

// if the game is not paused in singleplayer and half a second passed (same regen rate as bed in multiplayer)
if (!(Game1.player.hasMenuOpen && !Game1.IsMultiplayer) && !outOfFocusPaused && !Game1.paused && args.Ticks % 30 == 0)
{
       // add one stamina
if (Game1.player.Stamina < Game1.player.maxStamina)
{
Game1.player.Stamina++;
}

       // add one health
if (Game1.player.health < Game1.player.maxHealth)
{
Game1.player.health++;
}
}
}



All source code is my own creation or belongs to the base game. If you think I am violating copyright please send me a personal message and we can sort it out.

There is no config file. Enjoy!


Requirements:
SMAPI: I built version 1.1 of this mod based on version 4.0.1. It should be compatible with a few future versions and a few prior version. You can get the latest version of SMAPI here.


Installation:
Install SMAPI. Then extract the content of the downloaded zip file into the SMAPI mods folder and start the game via the SMAPI launcher or Steam if you have set the launch option for SMAPI in Steam.


Updating: 
Simply delete the prior version and install the new one.


Uninstallation:
You can delete this mod from your mods folder at any time to remove the features.