Skip to content

Commit

Permalink
Fix RTV for Latest Game Version
Browse files Browse the repository at this point in the history
- A game update switched NetworkGameServer.Instance from private to public, which broke the QueueMapChange method and the rockthevote feature
- This re-compiles with the latest 0.8.57 build and accounts for the change in scope of the NetworkGameServer.Instance
  • Loading branch information
data-bomb committed Jun 14, 2024
1 parent e0490c3 commit 3f285de
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions Si_Mapcycle/Si_Mapcycle.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ You should have received a copy of the GNU General Public License
using System.Linq;
using UnityEngine;

[assembly: MelonInfo(typeof(MapCycleMod), "Mapcycle", "1.6.0", "databomb", "https://github.com/data-bomb/Silica")]
[assembly: MelonInfo(typeof(MapCycleMod), "Mapcycle", "1.6.1", "databomb", "https://github.com/data-bomb/Silica")]
[assembly: MelonGame("Bohemia Interactive", "Silica")]
[assembly: MelonOptionalDependencies("Admin Mod")]

Expand Down Expand Up @@ -525,14 +525,11 @@ public static void QueueChangeMap(string mapName)
NetworkGameServer.Instance.m_QueueGameMode = gameModeInfo;
NetworkGameServer.Instance.m_QueueMap = levelInfo.FileName;
#else
FieldInfo serverInstanceField = typeof(NetworkGameServer).GetField("Instance", BindingFlags.NonPublic | BindingFlags.Static);
NetworkGameServer serverInstance = (NetworkGameServer)serverInstanceField.GetValue(null);

FieldInfo queueMapField = typeof(NetworkGameServer).GetField("m_QueueMap", BindingFlags.NonPublic | BindingFlags.Instance);
FieldInfo queueGameModeInfoField = typeof(NetworkGameServer).GetField("m_QueueGameMode", BindingFlags.NonPublic | BindingFlags.Instance);

queueGameModeInfoField.SetValue(serverInstance, gameModeInfo);
queueMapField.SetValue(serverInstance, levelInfo.FileName);
queueGameModeInfoField.SetValue(NetworkGameServer.Instance, gameModeInfo);
queueMapField.SetValue(NetworkGameServer.Instance, levelInfo.FileName);
#endif

iMapLoadCount++;
Expand Down

0 comments on commit 3f285de

Please sign in to comment.