Compare commits
3 Commits
Author | SHA1 | Date | |
---|---|---|---|
9a02f8008c | |||
f4c9868f6a | |||
df7084b438 |
|
@ -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?.getExtraMillisecondsPerInGameMinuteForThisLocation() ?? 0);
|
private static int LocalGTI => 7000 + (Game1.currentLocation?.ExtraMillisecondsPerInGameMinute ?? 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,10 +62,9 @@ namespace Relativity
|
||||||
if (float.IsNaN(totalElapsedGTI)) totalElapsedGTI = 0;
|
if (float.IsNaN(totalElapsedGTI)) totalElapsedGTI = 0;
|
||||||
|
|
||||||
float players = playerTimeData.Count;
|
float players = playerTimeData.Count;
|
||||||
float paused = playerTimeData.Count(x => !x.Value.STP);
|
float active = playerTimeData.Count(x => x.Value.STP);
|
||||||
float timeSpeedFactor = 1f - paused / players;
|
|
||||||
|
|
||||||
totalElapsedGTI += Game1.gameTimeInterval * timeSpeedFactor;
|
totalElapsedGTI += Game1.gameTimeInterval * (active / players);
|
||||||
Game1.gameTimeInterval = 0;
|
Game1.gameTimeInterval = 0;
|
||||||
|
|
||||||
float averageGTI = playerTimeData.Sum(x => x.Value.GTI) / players;
|
float averageGTI = playerTimeData.Sum(x => x.Value.GTI) / players;
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
<Project Sdk="Microsoft.NET.Sdk">
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFramework>net5.0</TargetFramework>
|
<TargetFramework>net6.0</TargetFramework>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="Pathoschild.Stardew.ModBuildConfig" Version="4.0.1" />
|
<PackageReference Include="Pathoschild.Stardew.ModBuildConfig" Version="4.1.1" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
</Project>
|
</Project>
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
{
|
{
|
||||||
"Name": "Relativity",
|
"Name": "Relativity",
|
||||||
"Author": "AdroSlice",
|
"Author": "AdroSlice",
|
||||||
"Version": "1.0.0",
|
"Version": "1.0.2",
|
||||||
"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": []
|
"UpdateKeys": [ "Nexus:13028" ]
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user