Skip to content

Commit

Permalink
Release v1.3.12
Browse files Browse the repository at this point in the history
  • Loading branch information
IAmBatby committed Nov 30, 2024
1 parent 87c2556 commit 30b4da4
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 2 deletions.
21 changes: 21 additions & 0 deletions LethalLevelLoader/Patches/LethalLevelLoaderNetworkManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,26 @@ public static void RegisterNetworkPrefab(GameObject prefab)
DebugHelper.LogWarning("Attempted To Register NetworkPrefab: " + prefab + " After GameNetworkManager Has Started!", DebugType.User);
}

public static T SetupNetworkManagerObject<T>() where T : NetworkBehaviour
{
GameObject newPrefab = new GameObject(nameof(T));
newPrefab.hideFlags = HideFlags.HideAndDontSave;

T instancedBehaviour = newPrefab.AddComponent<T>();

NetworkObject networkObject = newPrefab.AddComponent<NetworkObject>();
byte[] hash = MD5.Create().ComputeHash(Encoding.UTF8.GetBytes(Assembly.GetCallingAssembly().GetName().Name + nameof(T)));
networkObject.GlobalObjectIdHash = BitConverter.ToUInt32(hash, 0);
networkObject.DontDestroyWithOwner = true;
networkObject.SceneMigrationSynchronization = true;
networkObject.DestroyWithScene = true;
GameObject.DontDestroyOnLoad(newPrefab);

NetworkManager.Singleton.AddNetworkPrefab(newPrefab);

return (instancedBehaviour);
}

internal static void RegisterPrefabs(NetworkManager networkManager)
{
//DebugHelper.Log("Game NetworkManager Start");
Expand Down Expand Up @@ -205,6 +225,7 @@ internal static void RegisterPrefabs(NetworkManager networkManager)

}


public class StringContainer : INetworkSerializable
{
public string SomeText;
Expand Down
2 changes: 1 addition & 1 deletion LethalLevelLoader/Patches/SaveManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ internal static void SaveGameValues()

internal static void SaveAllLevels()
{
currentSaveFile.extendedLevelSaveData.Clear();
currentSaveFile.extendedLevelSaveData = new List<ExtendedLevelData>();
foreach (ExtendedLevel extendedLevel in PatchedContent.ExtendedLevels)
currentSaveFile.extendedLevelSaveData.Add(new ExtendedLevelData(extendedLevel));
}
Expand Down
2 changes: 1 addition & 1 deletion LethalLevelLoader/Plugin.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public class Plugin : BaseUnityPlugin
{
public const string ModGUID = "imabatby.lethallevelloader";
public const string ModName = "LethalLevelLoader";
public const string ModVersion = "1.3.11";
public const string ModVersion = "1.3.12";

internal static Plugin Instance;

Expand Down

0 comments on commit 30b4da4

Please sign in to comment.