diff --git a/GeneralMods/StardustCore/NetCode/NetCoreObject.cs b/GeneralMods/StardustCore/NetCode/NetCoreObject.cs
index 69a07b64..61ff4821 100644
--- a/GeneralMods/StardustCore/NetCode/NetCoreObject.cs
+++ b/GeneralMods/StardustCore/NetCode/NetCoreObject.cs
@@ -69,7 +69,7 @@ namespace StardustCore.NetCode
{
texture = new NetTexture2DExtended();
- texture.ReadFull(reader, version);
+ texture.ReadData(reader, version);
Value.setExtendedTexture(texture.Value);
which = new NetInt();
@@ -95,10 +95,11 @@ namespace StardustCore.NetCode
drawPosition = new NetVector2();
drawPosition.Read(reader, version);
Value.drawPosition = drawPosition.Value;
-
+ /*
animationManager = new NetAnimationManager();
animationManager.Read(reader, version);
Value.animationManager = animationManager.Value;
+ */
}
@@ -106,7 +107,7 @@ namespace StardustCore.NetCode
{
texture = new NetTexture2DExtended(Value.getExtendedTexture());
- texture.Write(writer);
+ texture.WriteData(writer);
which = new NetInt(Value.ParentSheetIndex);
which.Write(writer);
@@ -126,11 +127,13 @@ namespace StardustCore.NetCode
drawPosition = new NetVector2(Value.drawPosition);
drawPosition.Write(writer);
+ /*
if (Value.animationManager != null)
{
animationManager = new NetAnimationManager(Value.animationManager);
animationManager.Write(writer);
}
+ */
}
}
}
diff --git a/GeneralMods/TimeFreeze/Framework/ModConfig.cs b/GeneralMods/TimeFreeze/Framework/ModConfig.cs
index 4b3cdde3..a6b5be12 100644
--- a/GeneralMods/TimeFreeze/Framework/ModConfig.cs
+++ b/GeneralMods/TimeFreeze/Framework/ModConfig.cs
@@ -8,5 +8,30 @@
/// Whether time should be unfrozen while the player is swimming in the vanilla bathhouse.
public bool PassTimeWhileSwimmingInBathhouse { get; set; } = true;
+
+ ///
+ /// Whether time passes normally inside the mine.
+ ///
+ public bool PassTimeWhileInsideMine { get; set; } = true;
+
+ ///
+ /// Whether time passes normally inside the skull cavern.
+ ///
+ public bool PassTimeWhileInsideSkullCave { get; set; } = true;
+
+ ///
+ /// Checks if just one player meets the conditions to freeze time, and then freeze time.
+ ///
+ public bool freezeIfEvenOnePlayerMeetsTimeFreezeConditions { get; set; } = false;
+
+ ///
+ /// Checks if the majority of players can freeze time and then freeze time.
+ ///
+ public bool freezeIfMajorityPlayersMeetsTimeFreezeConditions { get; set; } = false;
+
+ ///
+ /// Checks if all players can freeze time and if so, do so.
+ ///
+ public bool freezeIfAllPlayersMeetTimeFreezeConditions { get; set; } = false;
}
}
diff --git a/GeneralMods/TimeFreeze/TimeFreeze.cs b/GeneralMods/TimeFreeze/TimeFreeze.cs
index 1d0a7964..0380fd0a 100644
--- a/GeneralMods/TimeFreeze/TimeFreeze.cs
+++ b/GeneralMods/TimeFreeze/TimeFreeze.cs
@@ -16,6 +16,8 @@ namespace Omegasis.TimeFreeze
/// The mod configuration.
private ModConfig Config;
+ public int oldInterval;
+
/*********
** Public methods
@@ -40,8 +42,92 @@ namespace Omegasis.TimeFreeze
if (!Context.IsWorldReady)
return;
- if (this.ShouldFreezeTime(Game1.player, Game1.player.currentLocation))
- Game1.gameTimeInterval = 0;
+ if (Game1.gameTimeInterval != 0)
+ {
+ oldInterval = Game1.gameTimeInterval;
+ }
+
+ if (Game1.IsMultiplayer)
+ {
+ if (Config.freezeIfEvenOnePlayerMeetsTimeFreezeConditions)
+ {
+ bool isAnyFarmerSuitable = false;
+ foreach (Farmer farmer in Game1.getAllFarmers())
+ {
+ if (this.ShouldFreezeTime(farmer, farmer.currentLocation))
+ {
+ Game1.gameTimeInterval = 0;
+ isAnyFarmerSuitable = true;
+ }
+ }
+ if (isAnyFarmerSuitable == false)
+ {
+ Game1.gameTimeInterval = oldInterval;
+ }
+ }
+
+ else if (Config.freezeIfMajorityPlayersMeetsTimeFreezeConditions)
+ {
+ int freezeCount = 0;
+ int playerCount = 0;
+ foreach (Farmer farmer in Game1.getAllFarmers())
+ {
+ playerCount++;
+ if (this.ShouldFreezeTime(farmer, farmer.currentLocation))
+ {
+ //Game1.gameTimeInterval = 0;
+ freezeCount++;
+ }
+ }
+ if (freezeCount >= (playerCount / 2))
+ {
+ Game1.gameTimeInterval = 0;
+
+ }
+ else
+ {
+ Game1.gameTimeInterval = oldInterval;
+ }
+ }
+
+ else if (Config.freezeIfAllPlayersMeetTimeFreezeConditions)
+ {
+ int freezeCount = 0;
+ int playerCount = 0;
+ foreach (Farmer farmer in Game1.getAllFarmers())
+ {
+ playerCount++;
+ if (this.ShouldFreezeTime(farmer, farmer.currentLocation))
+ {
+ //Game1.gameTimeInterval = 0;
+ freezeCount++;
+ }
+ }
+ if (freezeCount >= playerCount)
+ {
+ Game1.gameTimeInterval = 0;
+
+ }
+ else
+ {
+ Game1.gameTimeInterval = oldInterval;
+ }
+ }
+
+
+ }
+ else
+ {
+ Farmer player = Game1.player;
+ if (this.ShouldFreezeTime(player, player.currentLocation))
+ {
+ Game1.gameTimeInterval = 0;
+ }
+ else
+ {
+ Game1.gameTimeInterval = oldInterval;
+ }
+ }
}
/// Get whether time should be frozen for the player at the given location.
@@ -49,8 +135,26 @@ namespace Omegasis.TimeFreeze
/// The location to check.
private bool ShouldFreezeTime(StardewValley.Farmer player, GameLocation location)
{
- if (location.Name == "Mine" || location.Name == "SkullCave"|| location.Name.StartsWith("SkullCave") || location.Name.StartsWith("UndergroundMine") || location.IsOutdoors)
+
+ if (Config.PassTimeWhileInsideMine==false)
+ {
+ if(location.Name == "Mine" || location.Name.StartsWith("UndergroundMine"))
+ {
+ return true;
+ }
+ }
+
+ if (Config.PassTimeWhileInsideSkullCave==false)
+ {
+ if (location.Name == "SkullCave" || location.Name.StartsWith("SkullCave"))
+ {
+ return true;
+ }
+ }
+
+ if (location.IsOutdoors)
return false;
+
if (player.swimming.Value)
{
if (this.Config.PassTimeWhileSwimmingInBathhouse && location is BathHousePool)
diff --git a/GeneralMods/TimeFreeze/manifest.json b/GeneralMods/TimeFreeze/manifest.json
index d79ba422..e905b074 100644
--- a/GeneralMods/TimeFreeze/manifest.json
+++ b/GeneralMods/TimeFreeze/manifest.json
@@ -1,7 +1,7 @@
{
"Name": "Time Freeze",
"Author": "Alpha_Omegasis",
- "Version": "1.4.0",
+ "Version": "1.5.0",
"Description": "Emulates old Harvest Moon-style games where time is frozen inside.",
"UniqueID": "Omegasis.TimeFreeze",
"EntryDll": "TimeFreeze.dll",