iliadsh / RavenM

The RavenM Multiplayer Mod
MIT License
105 stars 14 forks source link

Fixes to Lobby #28

Closed SamuelMereau closed 1 year ago

iliadsh commented 1 year ago

Thanks for the PR. Is this check actually needed, though? As far as I remember, launching with that flag will prevent that game from loading mods on start, but not overall. Like, if you go to the mods menu and disable/enable some stuff and hit reload, it should work as normal. Is there a specific scenario where this breaks?

SamuelMereau commented 1 year ago

The check refers to an issue reported where players joining a lobby would not see modded items. The log file would produce an error to identify this:

NullReferenceException: Object reference not set to an instance of an object
  at RavenM.LobbySystem.Update () [0x009f4] in D:\RavenMProject\RavenM\LobbySystem.cs:754 

(Filename: D:/RavenMProject/RavenM/LobbySystem.cs Line: 754)

Referring to this line: https://github.com/iliadsh/RavenM/blob/bff5ac39a8b4afa014fb8992ee7e5ebc90c486d6/LobbySystem.cs#L754

The ModManager is blank initially due to the -nocontentmods argument being passed and is never populated again (according to the log). Ensuring the ModManager object is populated initially will resolve this issue.

It would be best to ensure mods are loaded initially regardless to ensure issues aren't created further down the line, however please correct me if you feel this is unrealistic.

SamuelMereau commented 1 year ago

Fixes include:

iliadsh commented 1 year ago

Basically this looks good to me, but I'm still not convinced the check for mods being enabled is necessary. If the error is on the foreach (var map in mod.content.GetMaps()) line, then I feel like the issue has something to do with either trying to access the server maps before it loaded or another issue in that vein. Unless I'm reading the RF source incorrectly, launching with this option should only prevent the initial load but won't affect subsequent loads (when requested by the host, for example).