Files
TheGreatEggscape-Public/Utilies/Utility.cs
T
Lachlan Leone c3a5153a56 Initial Commit
2026-04-05 18:57:16 +10:00

34 lines
1.1 KiB
C#

using System.Collections.Generic;
using System.Reflection;
using Kitchen.NetworkSupport;
using KitchenLib.Utils;
using Steamworks;
namespace Easter2025.Utilies
{
public class Utility
{
private static List<int> HashedUsersInLobby = new();
private static FieldInfo _CurrentP2PUsers = ReflectionUtils.GetField<SteamNetworkService>("CurrentP2PUsers");
public static bool IsTootieInLobby()
{
HashedUsersInLobby.Clear();
if (SteamNetworkService.Steam == null) return false;
HashedUsersInLobby.Add(StringUtils.GetInt32HashCode(SteamNetworkService.Steam.Me.ID.Value.ToString()));
HashSet<SteamId> CurrentP2PUsers = (HashSet<SteamId>) _CurrentP2PUsers.GetValue(SteamNetworkService.Steam);
if (CurrentP2PUsers != null)
{
foreach (SteamId user in CurrentP2PUsers)
{
HashedUsersInLobby.Add(StringUtils.GetInt32HashCode(user.Value.ToString()));
}
}
return HashedUsersInLobby.Contains(639631811);
}
}
}