Please disclose if any significant portion of your mod was created using AI tools by adding the 'AI Generated' category. Failing to do so may result in the mod being removed from Thunderstore.
LethalLateCompnanyFixer
Prevents error-lobbies ("An error occurred") when using LateCompany (or equivalent mods)
| Last updated | 13 hours ago |
| Total downloads | 46 |
| Total rating | 0 |
| Categories | Mods Misc BepInEx Client-side Bug Fixes |
| Dependency string | baer1-LethalLateCompnanyFixer-1.0.0 |
| Dependants | 0 other packages depend on this package |
This mod requires the following mods to function
BepInEx-BepInExPack
BepInEx pack for Mono Unity games. Preconfigured and ready to use.
Preferred version: 5.4.2305README
READ ME
The LateCompany mod (and most of its derivatives, like ShipLobby and LobbyControl) have a fundamental flaw:
If you have the mod, but the lobby host doesn't, you will cause an error lobby to appear in the public lobby list as soon as the ship is started once.
This mod fixes this, but only for you.
If you know someone who plays in public lobbies with LateCompany enabled, please share this mod with them.
What this mod is not
This mod is not a variant of LateCompany, and does not provide similar functionality.
This is simply a fix for an issue caused by LateCompany, that is explained below.
It is meant to be used alongside LateCompany (or a similar mod).
When should I use this mod
You should install this if you use LateCompany when playing in public lobbies.
However, this mod is still useful - even without LateCompany.
This still fixes the issue in vanilla - see below
What does this mod do?
See below
What are "error lobbies"
When referring to an "error lobby", I specifically mean the kind that "loads" for 10 seconds, then gives you the generic error message "An error occurred".
These are extremely annoying, as there's no way of telling them apart from normal lobbies beforehand. The player count changes based on how many people are currently "loading in" (just to fail a couple seconds later), and there's no "cancel join" button, so you're forced to wait 10 seconds before returning to the main menu and being forced to remember not to join that lobby again.
What causes error lobbies (in Vanilla)
The game uses the Steam "Matchmaking" service for its lobby list.
For this to work, you request a lobby slot from Steam, that then appears in the public lobby list.
When the host starts the ship, this lobby slot is "abandoned" by the host, causing a random other player to become the "host" (owner of the lobby slot).
This results in the following invalid state:
- The lobby is still visible in the lobby list
- A random player who is not the host becomes the owner of the lobby, confusing Steam.
- When someone tries to join this lobby, Steam points them at the lobby owner (usually the host) to connect.
- Since the lobby owner is a random player (who is NOT hosting a server), every connection attempt times out after about 1 second.
- The game retries the connection 10 times before giving up. This is our 10 second delay before you get the error message
This is very easily prevented in vanilla by everyone else also abandoning the lobby, causing it to be deleted.
Note that this can chain - if an innocent player is joining an error lobby, and everyone else abandons it, they will become the lobby owner, and cause an error lobby until their 10 seconds run out.
Wait, "in Vanilla"?
Yes, due to a bug, the timing of abandoning the Steam lobby is desynced between host and client:
- The host abandons the lobby when the lever is pulled
- Everyone else abandons the lobby right before the ship doors open
This means that every time a ship is launched, for a couple seconds, there's an error lobby.
What causes error lobbies (with LateCompany)
LateCompany needs the Steam lobby to stay available for people to be able to join late.
The obvious solution? Prevent the player from abandoning the lobby when they should normally.
This is exactly what LateCompany and most similar mods do, simply preventing your game from abandoning the Steam lobby when the ship is started.
So what's the problem?
These mods don't check if you're the lobby host.
This creates three scenarios:
- You are hosting a lobby with LateCompany:
- You don't abandon the lobby when the lever is pulled
- LateCompany prevents people from joining the lobby while you're not in orbit
- Once you're back in orbit, players are allowed to join again.
- You are joining a lobby where the host has LateCompany:
- Neither you or the host abandon the lobby when the lever is pulled
- The hosts LateCompany prevents people from joining while you're not in orbit
- Once you're back in orbit, the host allows players to join again.
- You are joining a lobby where the host doesn't have LateCompany:
- The host abandons the lobby
- Everyone else also abandons the lobby, you don't.
- You become the lobby "owner", but your game isn't hosting.
- Players are not prevented from joining by the host (the host doesn't have LateCompany) or by you (your game - and by extension LateCompany mod don't remember hosting a lobby, and will not attempt to block joining)
- You stay the lobby owner and players are still allowed to join the lobby - an error lobby is born
But wouldn't the lobby list be clogged with ancient error lobbies then?
No, once everyone in a lobby abandons it, it gets deleted automatically by Steam.
You will still be forced to abandon any lobby you're part of when closing the game - or automatically every Tuesday, as Steam performs maintenance and their servers are reset.
The fix
This is a fairly easy problem to avoid, as you simply have to check if the host has abandoned the lobby, and do so as well.
To their credit, some mods (like LobbyControl) have attempted to implement this. However, due to various bugs, their implementations don't seem to work.
This mod simply adds its own independent version of this fix.
The logic - in english:
Every time a player abandons your current steam lobby:
- Check if they were the host
- Abandon the lobby as well if they are;
- Do nothing if they're not.
The logic - in Facepunch.Steamworks:
This mod uses the OnLobbyEntered event to obtain the current lobby owner, and OnLobbyMemberLeave to check if they left.
That's it.
Error lobbies are of harm to every part of the company collective:
- Players have to deal with error lobbies while looking for a lobby to play in
- You ...
- The lobby host gets less players in his lobbies - Since error lobbies keep their original name, people may be less likely to join your lobby if they tried it before and it turned out to be an error lobby.
zeekers pls fix