diff --git a/Si_DefaultUnits/Si_DefaultUnits.cs b/Si_DefaultUnits/Si_DefaultUnits.cs
index 2d4ba6a..2607dde 100644
--- a/Si_DefaultUnits/Si_DefaultUnits.cs
+++ b/Si_DefaultUnits/Si_DefaultUnits.cs
@@ -21,16 +21,22 @@ You should have received a copy of the GNU General Public License
along with this program. If not, see .
*/
-using HarmonyLib;
+#if NET6_0
using Il2Cpp;
+#else
+using System.Reflection;
+#endif
+
+using HarmonyLib;
using MelonLoader;
using Si_DefaultUnits;
-using AdminExtension;
using UnityEngine;
-using Il2CppSystem.IO;
+using System;
+using SilicaAdminMod;
-[assembly: MelonInfo(typeof(DefaultUnits), "[Si] Default Spawn Units", "0.9.5", "databomb", "https://github.com/data-bomb/Silica")]
+[assembly: MelonInfo(typeof(DefaultUnits), "Default Spawn Units", "1.0.0", "databomb", "https://github.com/data-bomb/Silica")]
[assembly: MelonGame("Bohemia Interactive", "Silica")]
+[assembly: MelonOptionalDependencies("Admin Mod")]
namespace Si_DefaultUnits
{
@@ -76,10 +82,10 @@ public override void OnInitializeMelon()
}
// patch as close to where it's used
- [HarmonyPatch(typeof(Il2Cpp.MP_Strategy), nameof(Il2Cpp.MP_Strategy.GetUnitPrefabForPlayer))]
+ [HarmonyPatch(typeof(MP_Strategy), nameof(MP_Strategy.GetUnitPrefabForPlayer))]
private static class ApplyPatch_MP_Strategy_GetUnitPrefabForPlayer
{
- public static void Prefix(Il2Cpp.MP_Strategy __instance, UnityEngine.GameObject __result, Il2Cpp.Player __0)
+ public static void Prefix(MP_Strategy __instance, UnityEngine.GameObject __result, Player __0)
{
try
{
@@ -88,7 +94,7 @@ public static void Prefix(Il2Cpp.MP_Strategy __instance, UnityEngine.GameObject
return;
}
- Team playerTeam = __0.m_Team;
+ Team playerTeam = __0.Team;
// was there a change in tech tier or is it the first spawn of the round for this team?
if (!TechTierUpdated(playerTeam) && !teamFirstSpawn[playerTeam.Index])
@@ -137,10 +143,10 @@ public static void Prefix(Il2Cpp.MP_Strategy __instance, UnityEngine.GameObject
// reset tech tiers back to 0
// note: players join and spawn *before* OnGameStarted fires, so it's important to reset back to 0 as soon as the game ends
- [HarmonyPatch(typeof(Il2Cpp.MusicJukeboxHandler), nameof(Il2Cpp.MusicJukeboxHandler.OnGameStarted))]
+ [HarmonyPatch(typeof(MusicJukeboxHandler), nameof(MusicJukeboxHandler.OnGameStarted))]
private static class ApplyPatch_MusicJukeboxHandler_OnGameStarted
{
- public static void Postfix(Il2Cpp.MusicJukeboxHandler __instance, Il2Cpp.GameMode __0)
+ public static void Postfix(MusicJukeboxHandler __instance, GameMode __0)
{
try
{
@@ -156,7 +162,14 @@ public static void Postfix(Il2Cpp.MusicJukeboxHandler __instance, Il2Cpp.GameMod
if (Team.Teams[i].CurrentTechnologyTier != 0)
{
MelonLogger.Warning("Manually resetting tech tier level to 0 for team: " + Team.Teams[i].TeamName);
+
+ #if NET6_0
Team.Teams[i].CurrentTechnologyTier = 0;
+ #else
+ Type teamType = typeof(Team);
+ PropertyInfo currentTechTierProperty = teamType.GetProperty("CurrentTechnologyTier");
+ currentTechTierProperty.SetValue(Team.Teams[i], 0);
+ #endif
}
}
diff --git a/Si_DefaultUnits/Si_DefaultUnits.csproj b/Si_DefaultUnits/Si_DefaultUnits.csproj
index 704eac7..d64f0a0 100644
--- a/Si_DefaultUnits/Si_DefaultUnits.csproj
+++ b/Si_DefaultUnits/Si_DefaultUnits.csproj
@@ -1,42 +1,13 @@
- net6.0
- enable
+ net6.0;netstandard2.1
enable
-
- ..\..\..\..\..\Program Files (x86)\Steam\steamapps\common\Silica\MelonLoader\net6\0Harmony.dll
-
-
- ..\..\..\..\..\Program Files (x86)\Steam\steamapps\common\Silica\MelonLoader\Il2CppAssemblies\Assembly-CSharp.dll
-
-
- ..\..\..\..\..\Program Files (x86)\Steam\steamapps\common\Silica\MelonLoader\net6\Il2CppInterop.Runtime.dll
-
-
- ..\..\..\..\..\Program Files (x86)\Steam\steamapps\common\Silica\MelonLoader\Il2CppAssemblies\Il2Cppmscorlib.dll
-
-
- ..\..\..\..\..\Program Files (x86)\Steam\steamapps\common\Silica\MelonLoader\net6\MelonLoader.dll
-
-
- ..\..\..\..\..\Program Files (x86)\Steam\steamapps\common\Silica\MelonLoader\net6\Si_AdminExtension.dll
-
-
- ..\..\..\..\..\Program Files (x86)\Steam\steamapps\common\Silica\MelonLoader\Il2CppAssemblies\UnityEngine.dll
-
-
- ..\..\..\..\..\Program Files (x86)\Steam\steamapps\common\Silica\MelonLoader\Il2CppAssemblies\UnityEngine.CoreModule.dll
-
-
- ..\..\..\..\..\Program Files (x86)\Steam\steamapps\common\Silica\MelonLoader\Il2CppAssemblies\UnityEngine.InputLegacyModule.dll
-
-
- ..\..\..\..\..\Program Files (x86)\Steam\steamapps\common\Silica\MelonLoader\Il2CppAssemblies\UnityEngine.PhysicsModule.dll
-
+
+
diff --git a/Si_DefaultUnits/Si_DefaultUnits.sln b/Si_DefaultUnits/Si_DefaultUnits.sln
new file mode 100644
index 0000000..cfc903f
--- /dev/null
+++ b/Si_DefaultUnits/Si_DefaultUnits.sln
@@ -0,0 +1,25 @@
+
+Microsoft Visual Studio Solution File, Format Version 12.00
+# Visual Studio Version 17
+VisualStudioVersion = 17.6.33723.286
+MinimumVisualStudioVersion = 10.0.40219.1
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Si_DefaultUnits", "Si_DefaultUnits.csproj", "{30CCA1CE-4745-4664-993F-FC072FF2429E}"
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|Any CPU = Debug|Any CPU
+ Release|Any CPU = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {30CCA1CE-4745-4664-993F-FC072FF2429E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {30CCA1CE-4745-4664-993F-FC072FF2429E}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {30CCA1CE-4745-4664-993F-FC072FF2429E}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {30CCA1CE-4745-4664-993F-FC072FF2429E}.Release|Any CPU.Build.0 = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+ GlobalSection(ExtensibilityGlobals) = postSolution
+ SolutionGuid = {4E9A46B4-E6A1-451A-9077-9719A67BF79C}
+ EndGlobalSection
+EndGlobal