forked from dymanoid/RealTime
-
Notifications
You must be signed in to change notification settings - Fork 7
/
git.diff
252 lines (236 loc) · 12.1 KB
/
git.diff
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
diff --git a/src/RealTime/Core/Compatibility.cs b/src/RealTime/Core/Compatibility.cs
index 79dece6..03e2309 100644
--- a/src/RealTime/Core/Compatibility.cs
+++ b/src/RealTime/Core/Compatibility.cs
@@ -26,7 +26,7 @@ namespace RealTime.Core
ExportElectricity,
DistrictServiceLimit,
DateChanger,
- RealTimeOffline,
+ RealTime,
};
private readonly ILocalizationProvider localizationProvider;
@@ -106,7 +107,19 @@ namespace RealTime.Core
activeMods.Clear();
foreach (var plugin in PluginManager.instance.GetPluginsInfo().Where(m => m.isEnabled))
{
- activeMods[plugin.publishedFileID.AsUInt64] = plugin;
+ ulong nameUInt64;
+ try
+ {
+ nameUInt64 = Convert.ToUInt64(plugin.name);
+ }
+ catch (FormatException)
+ {
+ DebugOutputPanel.AddMessage(PluginManager.MessageType.Message, $"Real Time Offline: {plugin?.name} was skipped from compatibility checking.\n" +
+ "Rename the containing directory to respective Workshop ID to include it in compatibility checking by Real Time Offline.");
+ break;
+ }
+
+ activeMods[nameUInt64] = plugin;
}
}
}
diff --git a/src/RealTime/Core/RealTimeCore.cs b/src/RealTime/Core/RealTimeCore.cs
index bd772c2..6c19ae2 100644
--- a/src/RealTime/Core/RealTimeCore.cs
+++ b/src/RealTime/Core/RealTimeCore.cs
@@ -7,6 +7,7 @@ namespace RealTime.Core
using System;
using System.Collections.Generic;
using System.Linq;
+ using ColossalFramework.Plugins;
using RealTime.Config;
using RealTime.CustomAI;
using RealTime.Events;
@@ -327,6 +328,7 @@ namespace RealTime.Core
if (compatibility.IsAnyModActive(WorkshopMods.CitizenLifecycleRebalance))
{
Log.Info("The 'Real Time' mod will not change the citizens aging because the 'Citizen Lifecycle Rebalance' mod is active.");
+ DebugOutputPanel.AddMessage(PluginManager.MessageType.Message, "Real Time Offline: Aging compatibility enabled.");
}
else
{
@@ -344,6 +346,7 @@ namespace RealTime.Core
WorkshopMods.PlopTheGrowables))
{
Log.Info("The 'Real Time' mod will not change the building construction and upgrading behavior because some building mod is active.");
+ DebugOutputPanel.AddMessage(PluginManager.MessageType.Message, "Real Time Offline: Construction compatibility enabled.");
}
else
{
@@ -384,9 +387,12 @@ namespace RealTime.Core
return false;
}
- float travelDistancePerCycle = compatibility.IsAnyModActive(WorkshopMods.RealisticWalkingSpeed)
- ? Constants.AverageTravelDistancePerCycle * 0.583f
- : Constants.AverageTravelDistancePerCycle;
+ float travelDistancePerCycle = Constants.AverageTravelDistancePerCycle;
+ if (compatibility.IsAnyModActive(WorkshopMods.RealisticWalkingSpeed))
+ {
+ DebugOutputPanel.AddMessage(PluginManager.MessageType.Message, "Real Time Offline: Walking compatibility enabled.");
+ travelDistancePerCycle *= 0.583f;
+ }
var spareTimeBehavior = new SpareTimeBehavior(config, timeInfo);
var travelBehavior = new TravelBehavior(gameConnections.BuildingManager, travelDistancePerCycle);
diff --git a/src/RealTime/Core/RealTimeMod.cs b/src/RealTime/Core/RealTimeMod.cs
index a9a683f..91b82c6 100644
--- a/src/RealTime/Core/RealTimeMod.cs
+++ b/src/RealTime/Core/RealTimeMod.cs
@@ -18,10 +18,10 @@ namespace RealTime.Core
/// <summary>The main class of the Real Time mod.</summary>
public sealed class RealTimeMod : LoadingExtensionBase, IUserMod
{
- private const long WorkshopId = 1420955187;
- private const string NoWorkshopMessage = "Real Time can only run when subscribed to in Steam Workshop";
+ private const long WorkshopId = 1749971558;
+ private const string NoWorkshopMessage = "Something went very wrong.";
- private readonly string modVersion = GitVersion.GetAssemblyVersion(typeof(RealTimeMod).Assembly);
+ private readonly string modVersion = "Offline " + GitVersion.GetAssemblyVersion(typeof(RealTimeMod).Assembly);
private readonly string modPath = GetModPath();
private ConfigurationProvider<RealTimeConfig> configProvider;
@@ -35,12 +35,12 @@ namespace RealTime.Core
/// </summary>
public RealTimeMod()
{
- RealTimeBenchmark.Setup();
+ RealTimeBenchmark.Setup();
}
#endif
/// <summary>Gets the name of this mod.</summary>
- public string Name => "Real Time";
+ public string Name => "Real Time Offline";
/// <summary>Gets the description string of this mod.</summary>
public string Description => "Adjusts the time flow and the Cims behavior to make them more real. Version: " + modVersion;
@@ -118,6 +118,11 @@ namespace RealTime.Core
/// <param name="mode">The <see cref="LoadMode"/> a game level is loaded in.</param>
public override void OnLevelLoaded(LoadMode mode)
{
+ /* foreach (var e in PluginManager.instance.GetPluginsInfo())
+ {
+ DebugOutputPanel.AddMessage(PluginManager.MessageType.Message, e.name);
+ }*/
+
if (string.IsNullOrEmpty(modPath))
{
MessageBox.Show("Sorry", NoWorkshopMessage);
@@ -179,9 +184,10 @@ namespace RealTime.Core
private static string GetModPath()
{
- PluginManager.PluginInfo pluginInfo = PluginManager.instance.GetPluginsInfo()
- .FirstOrDefault(pi => pi.publishedFileID.AsUInt64 == WorkshopId);
+ PluginManager.PluginInfo pluginInfo = PluginManager.instance.GetPluginsInfo().FirstOrDefault(pi =>
+ pi.name.Contains(WorkshopMods.RealTimeOffline.ToString()));
+ DebugOutputPanel.AddMessage(PluginManager.MessageType.Message, $"Real Time Offline: Path to mod directory detected as:\n{pluginInfo?.modPath ?? "Null"}");
return pluginInfo?.modPath;
}
diff --git a/src/RealTime/Core/WorkshopMods.cs b/src/RealTime/Core/WorkshopMods.cs
index bd0e1ae..e7e3221 100644
--- a/src/RealTime/Core/WorkshopMods.cs
+++ b/src/RealTime/Core/WorkshopMods.cs
@@ -45,7 +45,16 @@ namespace RealTime.Core
/// <summary>The Workshop ID of the 'Date Changer' mod.</summary>
public const ulong DateChanger = 1729576238ul;
- /// <summary>The Workshop ID of the 'Real Time Offline' mod.</summary>
+ /// <summary>The Workshop ID of the 'Real Time' mod.</summary>
public const ulong RealTimeOffline = 1749971558ul;
+
+ /// <summary>The Workshop ID of the 'Time Warp' mod.</summary>
+ public const ulong TimeWarpWorkshopId = 814698320ul;
+
+ /// <summary>The Workshop ID of the 'Ultimate Eyecandy' mod.</summary>
+ public const ulong UltimateEyecandyWorkshopId = 672248733ul;
+
+ /// <summary>The Workshop ID of the 'Real Time' mod.</summary>
+ public const ulong RealTime = 1420955187ul;
}
}
diff --git a/src/RealTime/RealTime.csproj b/src/RealTime/RealTime.csproj
index 6591a05..69c1508 100644
--- a/src/RealTime/RealTime.csproj
+++ b/src/RealTime/RealTime.csproj
@@ -9,7 +10,7 @@
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>RealTime</RootNamespace>
- <AssemblyName>RealTime</AssemblyName>
+ <AssemblyName>RealTimeOffline</AssemblyName>
<TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<TargetFrameworkProfile />
@@ -25,7 +26,7 @@
<LangVersion>7.3</LangVersion>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>..\BuildEnvironment\RealTime.ruleset</CodeAnalysisRuleSet>
- <DocumentationFile>..\bin\Debug\RealTime.xml</DocumentationFile>
+ <DocumentationFile>..\bin\Debug\RealTimeOffline.xml</DocumentationFile>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'">
<OutputPath>..\bin\Release\</OutputPath>
@@ -36,7 +37,7 @@
<LangVersion>7.3</LangVersion>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>..\BuildEnvironment\RealTime.ruleset</CodeAnalysisRuleSet>
- <DocumentationFile>..\bin\Release\RealTime.xml</DocumentationFile>
+ <DocumentationFile>..\bin\Release\RealTimeOffline.xml</DocumentationFile>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Benchmark|x64'">
<OutputPath>..\bin\Benchmark\</OutputPath>
@@ -235,19 +236,16 @@
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<PropertyGroup>
- <PostBuildEvent>xcopy /y /q /d "$(TargetPath)" "d:\Data\SteamLibrary\steamapps\workshop\content\255710\1420955187"
-xcopy /y /q /d "$(TargetDir)SkyTools.dll" "d:\Data\SteamLibrary\steamapps\workshop\content\255710\1420955187"
-xcopy /y /q /d "$(TargetDir)0Harmony.dll" "d:\Data\SteamLibrary\steamapps\workshop\content\255710\1420955187"
-
-xcopy /y /q /i "$(TargetDir)Localization\Translations" "d:\Data\SteamLibrary\steamapps\workshop\content\255710\1420955187\Localization"
-xcopy /y /q /i "$(ProjectDir)Events\Templates" "d:\Data\SteamLibrary\steamapps\workshop\content\255710\1420955187\Events"</PostBuildEvent>
+ <PostBuildEvent>
+ </PostBuildEvent>
</PropertyGroup>
diff --git a/src/RealTime/Simulation/TimeControlCompatibility.cs b/src/RealTime/Simulation/TimeControlCompatibility.cs
index e7e6970..b2315d9 100644
--- a/src/RealTime/Simulation/TimeControlCompatibility.cs
+++ b/src/RealTime/Simulation/TimeControlCompatibility.cs
@@ -9,6 +9,7 @@ namespace RealTime.Simulation
using System.Linq;
using System.Reflection;
using ColossalFramework.Plugins;
+ using RealTime.Core;
using SkyTools.Patching;
using SkyTools.Tools;
@@ -21,16 +22,14 @@ namespace RealTime.Simulation
private const string TimeOfDayPropertySetter = "set_TimeOfDay";
private const string TimeWarpManagerType = "TimeWarpMod.SunManager";
private const string UltimateEyecandyManagerType = "UltimateEyecandy.DayNightCycleManager";
- private const ulong TimeWarpWorkshopId = 814698320ul;
- private const ulong UltimateEyecandyWorkshopId = 672248733ul;
/// <summary>Gets a collection of method patches that need to be applied to ensure this mod's compatibility
/// with other time-changing mods.</summary>
/// <returns>A collection of <see cref="IPatch"/> objects.</returns>
public static IEnumerable<IPatch> GetCompatibilityPatches()
{
- Type timeWarpType = GetManagerType(TimeWarpWorkshopId, TimeWarpManagerType);
- Type ultimateEyecandyType = GetManagerType(UltimateEyecandyWorkshopId, UltimateEyecandyManagerType);
+ Type timeWarpType = GetManagerType(WorkshopMods.TimeWarpWorkshopId, TimeWarpManagerType);
+ Type ultimateEyecandyType = GetManagerType(WorkshopMods.UltimateEyecandyWorkshopId, UltimateEyecandyManagerType);
return GetPatches(timeWarpType).Concat(GetPatches(ultimateEyecandyType));
}
@@ -38,7 +37,7 @@ namespace RealTime.Simulation
private static Type GetManagerType(ulong modId, string typeName)
{
PluginManager.PluginInfo mod = PluginManager.instance.GetPluginsInfo()
- .FirstOrDefault(pi => pi.publishedFileID.AsUInt64 == modId);
+ .FirstOrDefault(pi => pi.name == modId.ToString());
if (mod?.isEnabled != true)
{
@@ -54,6 +53,7 @@ namespace RealTime.Simulation
try
{
+ DebugOutputPanel.AddMessage(PluginManager.MessageType.Message, "Real Time Offline: Time compatibility enabled.");
return assembly.GetType(typeName);
}
catch (Exception ex)
diff --git a/src/RealTime/packages.config b/src/RealTime/packages.config
index 3f4798c..e66b53f 100644