Skip to content

Commit

Permalink
CurrentLobby now cleared properly
Browse files Browse the repository at this point in the history
Hook SteamLobbyHandler.LeaveLobby to clear CurrentLobby
  • Loading branch information
Xerren09 authored Jan 23, 2025
2 parents 9561341 + 338d5a6 commit 8a9a9b0
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
17 changes: 17 additions & 0 deletions Patches/SteamLobbyHandlerPatch.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
using ContentWarningShop;
using HarmonyLib;
using Steamworks;

namespace ShopAPI.Patches
{
[HarmonyPatch(typeof(SteamLobbyHandler))]
internal class SteamLobbyHandlerPatch
{
[HarmonyPatch(nameof(SteamLobbyHandler.LeaveLobby))]
[HarmonyPostfix]
static void LeaveLobby()
{
SteamLobbyMetadataHandler.CurrentLobby = CSteamID.Nil;
}
}
}
1 change: 0 additions & 1 deletion SteamLobbyMetadataHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ private static void Steam_LobbyCreated(LobbyCreated_t e)

private static void Steam_LobbyEntered(LobbyEnter_t e)
{
// If we created the lobby, don't call the event again. Otherwise _currentLobby will be default by now
if (InLobby == false)
{
CurrentLobby = new CSteamID(e.m_ulSteamIDLobby);
Expand Down

0 comments on commit 8a9a9b0

Please sign in to comment.