34 lines
1.1 KiB
C#
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);
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|