diff --git a/PulsarModLoader/MPModChecks/MPModCheckManager.cs b/PulsarModLoader/MPModChecks/MPModCheckManager.cs index 59d563b..44916ac 100644 --- a/PulsarModLoader/MPModChecks/MPModCheckManager.cs +++ b/PulsarModLoader/MPModChecks/MPModCheckManager.cs @@ -61,6 +61,38 @@ public MPUserDataBlock GetNetworkedPeerMods(PhotonPlayer Photonplayer) return null; } } + + public bool NetworkedPeerHasMod(PhotonPlayer player, string HarmonyIdentifier) + { + MPUserDataBlock userData = GetNetworkedPeerMods(player); + if(userData != null) + { + foreach(MPModDataBlock modData in userData.ModData) + { + if(modData.HarmonyIdentifier == HarmonyIdentifier) + { + return true; + } + } + } + return false; + } + + public List NetworkedPeersWithMod(string HarmonyIdentifier) + { + List playerList = new List(); + foreach(KeyValuePair userEntry in NetworkedPeersModLists) + { + foreach(MPModDataBlock modData in userEntry.Value.ModData) + { + if(modData.HarmonyIdentifier == HarmonyIdentifier) + { + playerList.Add(userEntry.Key); + } + } + } + return playerList; + } public void AddNetworkedPeerMods(PhotonPlayer Photonplayer, MPUserDataBlock modList) { @@ -487,18 +519,6 @@ public bool HostOnClientJoined(PhotonPlayer Player) return true; } - /*public IEnumerator ServerSendModsToClient(PhotonPlayer client) - { - foreach (PhotonPlayer player in NetworkedPeersModLists.Keys) - { - ModMessageHelper.Instance.photonView.RPC("ClientRecieveModList", client, new object[] - { - Instance.SerializeHashlessUserData() - }); - yield return null; - } - }*/ - [HarmonyPatch(typeof(PLUIPlayMenu), "ActuallyJoinRoom")] //allow/disallow local client to join server. class JoinRoomPatch { @@ -508,14 +528,17 @@ static bool Prefix(RoomInfo room) } } - /*[HarmonyPatch(typeof(PLServer), "ServerOnClientVerified")] //Starts host mod verification coroutine + [HarmonyPatch(typeof(PLServer), "ServerOnClientVerified")] //Starts host mod verification coroutine class ServerOnClientVerifiedPatch { static void Postfix(PhotonPlayer client) { - PLServer.Instance.StartCoroutine(Instance.ServerSendModsToClient(client)); + ModMessageHelper.Instance.photonView.RPC("ClientRecieveModList", client, new object[] + { + Instance.SerializeHashlessUserData() + }); } - }*/ + } [HarmonyPatch(typeof(PLServer), "AttemptGetVerified")] class AttemptGetVerifiedRecievePatch {