diff --git a/GeneralMods/HappyBirthday/manifest.json b/GeneralMods/HappyBirthday/manifest.json
index 8a984cae..54b399eb 100644
--- a/GeneralMods/HappyBirthday/manifest.json
+++ b/GeneralMods/HappyBirthday/manifest.json
@@ -1,7 +1,7 @@
{
"Name": "Happy Birthday",
"Author": "Alpha_Omegasis",
- "Version": "1.8.0",
+ "Version": "1.8.2",
"MinimumApiVersion": "1.15",
"Description": "Adds the farmer's birthday to the game.",
"UniqueID": "Omegasis.HappyBirthday",
diff --git a/GeneralMods/Revitalize/Framework/Objects/MultiTiledComponent.cs b/GeneralMods/Revitalize/Framework/Objects/MultiTiledComponent.cs
index 9ac9a47e..a59ee09a 100644
--- a/GeneralMods/Revitalize/Framework/Objects/MultiTiledComponent.cs
+++ b/GeneralMods/Revitalize/Framework/Objects/MultiTiledComponent.cs
@@ -53,6 +53,9 @@ namespace Revitalize.Framework.Objects
this.location = Game1.player.currentLocation;
}
this.info.lightManager.toggleLights(this.location, this);
+
+ Revitalize.ModCore.playerInfo.sittingInfo.sit(this, Vector2.Zero);
+
return true;
}
diff --git a/GeneralMods/Revitalize/Framework/Player/Managers/SittingInfo.cs b/GeneralMods/Revitalize/Framework/Player/Managers/SittingInfo.cs
new file mode 100644
index 00000000..ef668982
--- /dev/null
+++ b/GeneralMods/Revitalize/Framework/Player/Managers/SittingInfo.cs
@@ -0,0 +1,128 @@
+using Microsoft.Xna.Framework;
+using StardewValley;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Revitalize.Framework.Player.Managers
+{
+ ///
+ /// TODO:
+ /// Make chair
+ /// animate player better
+ /// have it where when player is sitting on chair it is passable so it can't be destoryed underneath
+ ///
+ public class SittingInfo
+ {
+ ///
+ /// If the player is currently sitting.
+ ///
+ public bool isSitting;
+
+ ///
+ /// How long a Farmer has sat (in milliseconds)
+ ///
+ private int elapsedTime;
+
+ ///
+ /// Gets how long the farmer has sat (in milliseconds).
+ ///
+ public int ElapsedTime
+ {
+ get
+ {
+ return elapsedTime;
+ }
+ }
+
+ ///
+ /// Keeps trck of time elapsed.
+ ///
+ GameTime timer;
+
+
+ ///
+ /// The default amount of time a player has to sit to recover some energy/health
+ ///
+ private int _sittingSpan;
+ ///
+ /// A modified version of how long a player has to sit to recover energy/health;
+ ///
+ public int SittingSpan
+ {
+ get
+ {
+ return _sittingSpan;
+ }
+ }
+
+
+
+ ///
+ /// Constructor.
+ ///
+ public SittingInfo()
+ {
+ timer = Game1.currentGameTime;
+ this._sittingSpan = 10000;
+ }
+
+ ///
+ /// Update the sitting info.
+ ///
+ public void update()
+ {
+ if (Game1.activeClickableMenu != null) return;
+
+ if (Game1.player.isMoving())
+ {
+ isSitting = false;
+ elapsedTime = 0;
+ }
+ if (isSitting && Game1.player.CanMove)
+ {
+ showSitting();
+ if (timer == null) timer = Game1.currentGameTime;
+ elapsedTime += timer.ElapsedGameTime.Milliseconds;
+ }
+
+ if (elapsedTime >= SittingSpan)
+ {
+ elapsedTime %= SittingSpan;
+ Game1.player.health++;
+ Game1.player.Stamina++;
+ }
+ Revitalize.ModCore.log(elapsedTime);
+
+ }
+
+ public void showSitting()
+ {
+ switch (Game1.player.FacingDirection)
+ {
+ case 0:
+ Game1.player.FarmerSprite.setCurrentSingleFrame(113, (short)32000, false, false);
+ break;
+ case 1:
+ Game1.player.FarmerSprite.setCurrentSingleFrame(106, (short)32000, false, false);
+ break;
+ case 2:
+ Game1.player.FarmerSprite.setCurrentSingleFrame(107, (short)32000, false, false);
+ break;
+ case 3:
+ Game1.player.FarmerSprite.setCurrentSingleFrame(106, (short)32000, false, true);
+ break;
+ }
+ }
+
+ public void sit(StardewValley.Object obj,Vector2 offset)
+ {
+ this.isSitting = true;
+ Game1.player.Position = (obj.TileLocation * Game1.tileSize + offset);
+ Game1.player.position.Y += Game1.tileSize/2;
+ }
+
+ }
+}
diff --git a/GeneralMods/Revitalize/Framework/Player/PlayerInfo.cs b/GeneralMods/Revitalize/Framework/Player/PlayerInfo.cs
new file mode 100644
index 00000000..efde5463
--- /dev/null
+++ b/GeneralMods/Revitalize/Framework/Player/PlayerInfo.cs
@@ -0,0 +1,27 @@
+using Microsoft.Xna.Framework;
+using Revitalize.Framework.Player.Managers;
+using StardewValley;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Revitalize.Framework.Player
+{
+ public class PlayerInfo
+ {
+ public SittingInfo sittingInfo;
+
+ public PlayerInfo()
+ {
+ sittingInfo = new SittingInfo();
+ }
+
+
+ public void update()
+ {
+ sittingInfo.update();
+ }
+ }
+}
diff --git a/GeneralMods/Revitalize/ModCore.cs b/GeneralMods/Revitalize/ModCore.cs
index 8c59dd2d..c1858c8b 100644
--- a/GeneralMods/Revitalize/ModCore.cs
+++ b/GeneralMods/Revitalize/ModCore.cs
@@ -16,6 +16,7 @@ using System.IO;
using Revitalize.Framework.Crafting;
using StardewValley.Objects;
using Revitalize.Framework.Illuminate;
+using Revitalize.Framework.Player;
namespace Revitalize
{
@@ -88,6 +89,7 @@ namespace Revitalize
public static Dictionary customObjects;
+ public static PlayerInfo playerInfo;
public override void Entry(IModHelper helper)
{
@@ -101,6 +103,7 @@ namespace Revitalize
ModHelper.Events.GameLoop.SaveLoaded += GameLoop_SaveLoaded;
ModHelper.Events.GameLoop.TimeChanged += GameLoop_TimeChanged;
ModHelper.Events.GameLoop.UpdateTicked += GameLoop_UpdateTicked;
+ playerInfo = new PlayerInfo();
}
@@ -118,6 +121,7 @@ namespace Revitalize
private void GameLoop_UpdateTicked(object sender, StardewModdingAPI.Events.UpdateTickedEventArgs e)
{
DarkerNight.SetDarkerColor();
+ playerInfo.update();
}
private void GameLoop_TimeChanged(object sender, StardewModdingAPI.Events.TimeChangedEventArgs e)
diff --git a/GeneralMods/Revitalize/Revitalize.csproj b/GeneralMods/Revitalize/Revitalize.csproj
index b08233ee..c117d27d 100644
--- a/GeneralMods/Revitalize/Revitalize.csproj
+++ b/GeneralMods/Revitalize/Revitalize.csproj
@@ -57,6 +57,8 @@
+
+