Compare commits

..

No commits in common. "master" and "v1.0.0" have entirely different histories.

3 changed files with 8 additions and 7 deletions

View File

@ -9,7 +9,7 @@ namespace Relativity
public class ModEntry : Mod public class ModEntry : Mod
{ {
// GTI = GameTickInterval, STP = ShouldTimePass // GTI = GameTickInterval, STP = ShouldTimePass
private static int LocalGTI => 7000 + (Game1.currentLocation?.ExtraMillisecondsPerInGameMinute ?? 0); private static int LocalGTI => 7000 + (Game1.currentLocation?.getExtraMillisecondsPerInGameMinuteForThisLocation() ?? 0);
private static bool LocalSTP => Game1.shouldTimePass(true); private static bool LocalSTP => Game1.shouldTimePass(true);
private readonly Dictionary<long, (bool STP, int GTI)> playerTimeData = new(); private readonly Dictionary<long, (bool STP, int GTI)> playerTimeData = new();
@ -62,9 +62,10 @@ namespace Relativity
if (float.IsNaN(totalElapsedGTI)) totalElapsedGTI = 0; if (float.IsNaN(totalElapsedGTI)) totalElapsedGTI = 0;
float players = playerTimeData.Count; float players = playerTimeData.Count;
float active = playerTimeData.Count(x => x.Value.STP); float paused = playerTimeData.Count(x => !x.Value.STP);
float timeSpeedFactor = 1f - paused / players;
totalElapsedGTI += Game1.gameTimeInterval * (active / players); totalElapsedGTI += Game1.gameTimeInterval * timeSpeedFactor;
Game1.gameTimeInterval = 0; Game1.gameTimeInterval = 0;
float averageGTI = playerTimeData.Sum(x => x.Value.GTI) / players; float averageGTI = playerTimeData.Sum(x => x.Value.GTI) / players;

View File

@ -1,11 +1,11 @@
<Project Sdk="Microsoft.NET.Sdk"> <Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup> <PropertyGroup>
<TargetFramework>net6.0</TargetFramework> <TargetFramework>net5.0</TargetFramework>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="Pathoschild.Stardew.ModBuildConfig" Version="4.1.1" /> <PackageReference Include="Pathoschild.Stardew.ModBuildConfig" Version="4.0.1" />
</ItemGroup> </ItemGroup>
</Project> </Project>

View File

@ -1,10 +1,10 @@
{ {
"Name": "Relativity", "Name": "Relativity",
"Author": "AdroSlice", "Author": "AdroSlice",
"Version": "1.0.2", "Version": "1.0.0",
"Description": "Slows down multiplayer time based on how many players would normally not have time pass in singleplayer.", "Description": "Slows down multiplayer time based on how many players would normally not have time pass in singleplayer.",
"UniqueID": "AdroSlice.Relativity", "UniqueID": "AdroSlice.Relativity",
"EntryDll": "Relativity.dll", "EntryDll": "Relativity.dll",
"MinimumApiVersion": "3.0.0", "MinimumApiVersion": "3.0.0",
"UpdateKeys": [ "Nexus:13028" ] "UpdateKeys": []
} }