You are viewing a potentially older version of this package. View all versions.
BMX-LobbyCompatibility-1.0.4 icon

LobbyCompatibility

Towards a future with fewer lobby incompatibility errors.

Date uploaded 8 months ago
Version 1.0.4
Download link BMX-LobbyCompatibility-1.0.4.zip
Downloads 2261
Dependency string BMX-LobbyCompatibility-1.0.4

This mod requires the following mods to function

BepInEx-BepInExPack-5.4.2100 icon
BepInEx-BepInExPack

BepInEx pack for Mono Unity games. Preconfigured and ready to use.

Preferred version: 5.4.2100

README

Lobby Compatibility

Build Latest Version Thunderstore Downloads NuGet Version

This mod aims to provide better vanilla/modded lobby compatibility and browsing.

For Players

Lobby Browser

This mod lets you know when a lobby is incompatible with your currently installed mods, and will let you know what mods you need to update, downgrade, download, or remove to join that lobby.

You will notice an icon at the bottom left of every lobby in the lobby browser, and you can see more information (such as whether it's incompatible, and what mods are causing it) by hovering over it.

Hovering over the Lobby Compatibility icon

If you click on the icon, you can then see an in-depth view of the mod list, with a scrollbar to view all mods required to connect to that server. Note that this only works if the server is running this mod.

The Lobby Compatibility modal

If you then attempt to connect to a server - either public or private - with incompatible or missing mods, an error will display telling you that you are missing required mods.

Lobby connection error due to incompatible or missing mods

Modded Leaderboards

This mod adds a separate modded leaderboard to better compare to your friends! The intent is to help split up vanilla and modded leaderboard listings, so modded runs (which might be easier or harder than vanilla runs) don't get mixed in with vanilla runs.

For Developers

To use this, you need to add a package reference to TeamBMX.LobbyCompatibility in your .csproj file. You can use the following code:

<ItemGroup>
    <PackageReference Include="TeamBMX.LobbyCompatibility" Version="1.*" PrivateAssets="all" />
</ItemGroup>

You can also use your IDE's interface to add the reference. For Visual Studio 2022, you do so by clicking on the Project dropdown, and clicking Manage NuGet Packages. You then can search for TeamBMX.LobbyCompatibility and add it from there.

Usage

Attribute

Simply add [LobbyCompatibility(CompatibilityLevel, VersionStrictness)] above your Plugin class like so:

// ...
[BepInPlugin(PluginInfo.PLUGIN_GUID, PluginInfo.PLUGIN_NAME, PluginInfo.PLUGIN_VERSION)]
[BepInDependency("BMX.LobbyCompatibility", DependencyFlags.HardDependency)]
[LobbyCompatibility(CompatibilityLevel = CompatibilityLevel.Everyone, VersionStrictness = VersionStrictness.Minor)]
class MyPlugin : BaseUnityPlugin
{
    // ...
}

The enums used are as follows:

CompatibilityLevel
  • ClientOnly
    • Mod only impacts the client.
    • Mod is not checked at all (i.e. you can join vanilla lobbies), VersionStrictness does not apply.
  • ServerOnly
    • Mod only impacts the server, and might implicitly impact the client without the client needing to have it installed for it to work.
    • Mod is only required by the server. VersionStrictness only applies if the mod is installed on the client.
  • Everyone
    • Mod impacts both the client and the server, and adds functionality that requires the mod to be installed on both.
    • Mod must be loaded on server and client. Version checking depends on the VersionStrictness.
  • ClientOptional
    • Not every client needs to have the mod installed, but if it is installed, the server also needs to have it. Generally used for mods that add extra (optional) functionality to the client if the server has it installed.
    • Mod must be loaded on server. Version checking depends on the VersionStrictness.
VersionStrictness
  • None
    • No version check is done (x.x.x)
  • Major
    • Mod must have the same Major version (1.x.x)
  • Minor
    • Mods must have the same Minor and Major version (1.1.x)
  • Patch
    • Mods must have the same Patch, Minor, and Major version (1.1.1)

Method

Alternatively, as a way to support soft dependencies, you can use the PluginHelper.RegisterPlugin method with the following signature:

public static void RegisterPlugin(string guid, Version version, CompatibilityLevel compatibilityLevel, VersionStrictness versionStrictness)

[!IMPORTANT]

This method should be called in the Awake method of your plugin's main class, as we cache some data when fetching the lobby list.

Retrieving & Using the LobbyDiff

If you want to use the lobby diff (the "diff" of mods installed by the lobby and client), it is accessible via LobbyCompatibility.Features.LobbyHelper.GetLobbyDiff(Lobby lobby), like so:

using LobbyCompatibility.Features;
using Steamworks.Data;

/* ... */

// Just an example - no data would be returned since the lobby is non-existant.
Lobby lobby = new();
LobbyDiff lobbyDiff = LobbyHelper.GetLobbyDiff(lobby);

Then, if you want to check to see if the lobby has a specific mod downloaded, you can it like so:

if (lobbyDiff.PluginDiffs.Any(diff => diff.GUID == "example.guid" && diff.ServerVersion != null))
{
    /* Code Here */
}

diff.ServerVersion != null is used to see if the lobby/server has the mod, as it is set only when the server has the corresponding mod installed.

CHANGELOG

Changelog

All notable changes to this project will be documented in this file.

The format is based on Keep a Changelog, and this project adheres to Semantic Versioning.

[Unreleased]

[1.3.0] - 06/11/2024

  • Disable certain functionality on LAN | authored by @1A3Dev
  • Fix LAN-related issues | authored by @1A3Dev

[1.2.0] - 20/08/2024

Changed

  • Changed internal method to hide the lobby from vanilla clients.

Fixed

  • Fixed the fatal error introduced in Lethal Company v62 that caused the mod to not function correctly.

[1.1.0] - 01/04/2024

Added

  • Prevent vanilla clients from seeing modded lobbies in the lobby list.

[1.0.4] - 30/03/2024

Fixed

  • Fixed issue with unloaded plugins.

[1.0.3] - 24/03/2024

Fixed

  • Fixed incorrect LobbyCompatibility spelling in Thunderstore.toml (@1A3Dev)

[1.0.2] - 23/03/2024

Fixed

  • Fixed manually registered plugins not being filtered from the auto-discovered list of plugins, and hence having an "unknown" duplicate entry.

[1.0.1]

Changed

  • Changed Thunderstore Icon to be 256x256 to fit Thunderstore Upload Reqs

[1.0.0]

Added

  • Mod compatibility information
  • Block incompatible clients from joining lobbies
  • Modded leaderboard
  • LobbyCompatibility attribute
    • CompatibilityLevel Enum
    • VersionStrictness Enum
  • register method for easier soft dependencies or dynamic registration
  • Lobby browser UI with diff information