winstxnhdw / lc-hax

A powerful, feature-rich and highly performant internal cheat for the co-op indie horror video game, Lethal Company.
77 stars 25 forks source link

[Bug]: The autorejoin breaks when there is too many players. #332

Closed Totoqoe closed 4 months ago

Totoqoe commented 5 months ago

What happened?

When a lobby has many players, the auto rejoin spits an error stating that "An error occured while spawning into the game. Please report the glitch!"

Current Commit Hash

f21ba203b2797757b1f376bbac7dd68ec9b8ac63

Injector

If you selected "Others" above, please specify the injector you are using.

No response

Log output

The bepinex logs the following: [Info : Unity Log] NEW CLIENT JOINED THE SERVER!!; clientId: 29 [Info : Unity Log] adding value to ClientPlayerList at value of index 0: 0 [Info : Unity Log] adding value to ClientPlayerList at value of index 1: 1 [Info : Unity Log] adding value to ClientPlayerList at value of index 2: 7 [Info : Unity Log] adding value to ClientPlayerList at value of index 3: 3 [Info : Unity Log] adding value to ClientPlayerList at value of index 4: 4 [Info : Unity Log] adding value to ClientPlayerList at value of index 5: 29 [Info : Unity Log] adding value to ClientPlayerList at value of index 6: 6 [Info : Unity Log] adding value to ClientPlayerList at value of index 7: 8 [Info : Unity Log] adding value to ClientPlayerList at value of index 8: 9 [Info : Unity Log] adding value to ClientPlayerList at value of index 9: 11 [Info : Unity Log] adding value to ClientPlayerList at value of index 10: 12 [Info : Unity Log] adding value to ClientPlayerList at value of index 11: 15 [Info : Unity Log] adding value to ClientPlayerList at value of index 12: 14 [Info : Unity Log] Skipping at index 13 [Info : Unity Log] Skipping at index 14 [Info : Unity Log] Skipping at index 15 [Info : Unity Log] Skipping at index 16 [Info : Unity Log] Skipping at index 17 [Info : Unity Log] Skipping at index 18 [Info : Unity Log] Skipping at index 19 [Info : Unity Log] Skipping at index 20 [Info : Unity Log] Skipping at index 21 [Info : Unity Log] Skipping at index 22 [Info : Unity Log] Skipping at index 23 [Info : Unity Log] ClientId already in ClientPlayerList! [Info : Unity Log] clientplayerlist count for client: 13 [Info : Unity Log] level id: 0 [Info : Unity Log] Changing level [Info : Unity Log] New player: Player (5) [Error : Unity Log] Failed to assign new player with client id #29: System.IndexOutOfRangeException: Index was outside the bounds of the array. at (wrapper dynamic-method) StartOfRound.DMD(StartOfRound,ulong,int,ulong[],int,int,int,int,int,int,int,bool) [Info : Unity Log] Leaving current lobby [Info : Unity Log] Disconnecting and setting networkobjects to destroy with owner [Info : Unity Log] Shutting down and disconnecting from server. Is host?: False [Info : Unity Log] Current lobby is null. (Attempted to set lobby joinable False.) [Info : Unity Log] Taking control of player Player (5) and enabling camera! [Info : Unity Log] Message Received =>Snaa joined the ship. [Info : Unity Log] !!!! ENABLING CAMERA FOR PLAYER: Player (5) [Info : Unity Log] !!!! connectedPlayersAmount: 12 [Info : Unity Log] Has beta?: {hasBeta} [Info : Unity Log] Has beta save data: True [Warning: Unity Log] [Netcode] Deferred messages were received for a trigger of type OnSpawn with key 37, but that trigger was not received within within 1 second(s). [Warning: Unity Log] [Netcode] Deferred messages were received for a trigger of type OnSpawn with key 41, but that trigger was not received within within 1 second(s). [Warning: Unity Log] [Netcode] Deferred messages were received for a trigger of type OnSpawn with key 42, but that trigger was not received within within 1 second(s). [Info : Unity Log] Resetting unlockables list! [Info : Unity Log] Scene manager is null [Error : Unity Log] NullReferenceException: Object reference not set to an instance of an object Stack trace: StartOfRound+d__217.MoveNext () (at :0) UnityEngine.SetupCoroutine.InvokeMoveNext (System.Collections.IEnumerator enumerator, System.IntPtr returnValueAddress) (at :0)

[Error : Unity Log] NullReferenceException Stack trace: UnityEngine.Renderer.get_bounds () (at :0) ESPMod+<>c__DisplayClass26_0.b__3 (UnityEngine.Renderer renderer) (at <714989db4c1d4199b6072c5884679085>:0) Extensions.ForEach[T] (System.Collections.Generic.IEnumerable1[T] array, System.Action1[T] action) (at <714989db4c1d4199b6072c5884679085>:0) ESPMod.OnGUI () (at <714989db4c1d4199b6072c5884679085>:0)

[Error : Unity Log] NullReferenceException Stack trace: UnityEngine.Renderer.get_bounds () (at :0) ESPMod+<>c__DisplayClass26_0.b__3 (UnityEngine.Renderer renderer) (at <714989db4c1d4199b6072c5884679085>:0) Extensions.ForEach[T] (System.Collections.Generic.IEnumerable1[T] array, System.Action1[T] action) (at <714989db4c1d4199b6072c5884679085>:0) ESPMod.OnGUI () (at <714989db4c1d4199b6072c5884679085>:0)

[Info : Unity Log] DISABLING connection callbacks in round manager [Info : Unity Log] Terminal disabled, disabling ESC key listener [Info : Unity Log] Displaying menu message [Info : Unity Log] Displaying menu message 3 [Info : Unity Log] Displaying menu notification: An error occured while spawning into the game. Please report the glitch!

Acknowledgement

Totoqoe commented 5 months ago

An important note I left out is that the auto rejoin will attempt to rejoin despite the error occurring, causing you to get stuck on a loop unless you turn antikick off.

D1GQ commented 5 months ago

It also forces you to rejoin if you do shift F4, which crashes your game if the game already started.

Totoqoe commented 5 months ago

It also forces you to rejoin if you do shift F4, which crashes your game if the game already started.

It doesn't crash for me, i actually like this feature as it forces you to be the last player to join which works well with antikick.

joep26020 commented 5 months ago

It also forces you to rejoin if you do shift F4, which crashes your game if the game already started.

It doesn't crash for me, i actually like this feature as it forces you to be the last player to join which works well with antikick.

yeah works for me too. wdym it forces u to be last to join?

Totoqoe commented 5 months ago

It also forces you to rejoin if you do shift F4, which crashes your game if the game already started.

It doesn't crash for me, i actually like this feature as it forces you to be the last player to join which works well with antikick.

yeah works for me too. wdym it forces u to be last to join?

Most lobbies disable joining after the ship lands, so rejoining during a moon makes you the last player, at least for that round.

D1GQ commented 5 months ago

It doesn't crash for me, i actually like this feature as it forces you to be the last player to join which works well with antikick.

I know why it was implemented I'm the one that suggested it lmao.

D1GQ commented 5 months ago

It doesn't crash for me, i actually like this feature as it forces you to be the last player to join which works well with antikick.

yeah works for me too. wdym it forces u to be last to join?

And I'm mostly talking about when you shift F4

Totoqoe commented 5 months ago

I mayy have found a workaround, if you use MC, host a lobby with max players and then leave and join your desired lobby. May need more testing though,

joep26020 commented 5 months ago

I mayy have found a workaround, if you use MC, host a lobby with max players and then leave and join your desired lobby. May need more testing though,

what is mc and how much is max for max players?

Totoqoe commented 5 months ago

what is mc and how much is max for max players?

Probably should've been more specific but MC is More Company and it seems this error is based on the max player quantity you last hosted on. I noticed this because i had mine on 7 players and whenever the player count was higher than this, the error would pop up, even if I did rejoin successfully. All it took was the player count to surpass 7. Currently More Company allows a max of 50 players so I set it to that and haven't experienced the error since.

winstxnhdw commented 5 months ago

I don’t see how this is our problem? If the room is full, it’s only right that it errors.

Totoqoe commented 5 months ago

I don’t see how this is our problem? If the room is full, it’s only right that it errors.

The problem was that the rejoin breaks based on the max players of the room you last hosted, not the room I joined. For example, rooms with a max player count of 20 would still break if there were over 7 players in the room despite there being room for 13 more players.(At the time, the last room I hosted had max players set to 7.) The issue went away when I changed the max players of the room I last hosted to the max, which ensures that the game properly has "room" for you to rejoin. I hope this makes sense.

winstxnhdw commented 5 months ago

This doesn’t make sense. I am virtually using the same methods we use to join and disconnect via the menu. If this issue is happening with you for auto-rejoin, then it would’ve happened either way, even without auto-rejoin.

winstxnhdw commented 5 months ago

@Totoqoe I am trying to test this without injecting. How do you set player limits in MoreCompany?

Totoqoe commented 5 months ago

@Totoqoe I am trying to test this without injecting. How do you set player limits in MoreCompany?

When choosing a save file, in the center box where it shows the name, theres an option to set crew size below the friends only button.

winstxnhdw commented 4 months ago

Is MoreCompany the only mod we need? That box doesn’t show up for me.

Totoqoe commented 4 months ago

Is MoreCompany the only mod we need? That box doesn’t show up for me.

I believe so, i have a video of what im talking about. https://cdn.discordapp.com/attachments/772945937009868851/1203879476157616188/2024-02-02_15-50-43.mp4?ex=65d2b322&is=65c03e22&hm=067a580bf8b222550d52d9174cee2b3eb6729f0f720c42b0c0511552fd7a34a6&

winstxnhdw commented 4 months ago

I gave this a good attempt to fix it, but I couldn't get it. Let's hope MoreCompany fixes their shit.

Totoqoe commented 4 months ago

Dang it, seems like the rejoin no longer works to join in the middle of a moon or on lobbies without late joining enabled. I think that was a MoreCompany vulnerability as the hosts that uses an old version (I believe below <1.8.0) still work to do this.

winstxnhdw commented 4 months ago

Probably fixed in latest.

Totoqoe commented 4 months ago

Can confirm, it makes it so much easier to trigger the funny invisibility glitch too!