Skip to content

Commit 8a9a9b0

Browse files
authored
CurrentLobby now cleared properly
Hook SteamLobbyHandler.LeaveLobby to clear CurrentLobby
2 parents 9561341 + 338d5a6 commit 8a9a9b0

File tree

2 files changed

+17
-1
lines changed

2 files changed

+17
-1
lines changed

Patches/SteamLobbyHandlerPatch.cs

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
using ContentWarningShop;
2+
using HarmonyLib;
3+
using Steamworks;
4+
5+
namespace ShopAPI.Patches
6+
{
7+
[HarmonyPatch(typeof(SteamLobbyHandler))]
8+
internal class SteamLobbyHandlerPatch
9+
{
10+
[HarmonyPatch(nameof(SteamLobbyHandler.LeaveLobby))]
11+
[HarmonyPostfix]
12+
static void LeaveLobby()
13+
{
14+
SteamLobbyMetadataHandler.CurrentLobby = CSteamID.Nil;
15+
}
16+
}
17+
}

SteamLobbyMetadataHandler.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@ private static void Steam_LobbyCreated(LobbyCreated_t e)
3535

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

0 commit comments

Comments
 (0)