Skip to content

Commit

Permalink
fix: enable required local mods on server join
Browse files Browse the repository at this point in the history
  • Loading branch information
Alystrasz committed Nov 20, 2024
1 parent 9c85d6c commit 93c15fb
Showing 1 changed file with 15 additions and 11 deletions.
26 changes: 15 additions & 11 deletions Northstar.Client/mod/scripts/vscripts/ui/menu_ns_serverbrowser.nut
Original file line number Diff line number Diff line change
Expand Up @@ -1010,9 +1010,7 @@ void function OnServerSelected_Threaded( var button )
if ( IsCoreMod( mod.name ) )
continue

array<string> modVersions = GetModVersions( mod.name )

if ( !NSGetModNames().contains( mod.name ) || !modVersions.contains( mod.version ) )
if ( !NSGetModNames().contains( mod.name ) || !GetModVersions( mod.name ).contains( mod.version ) )
{
// Auto-download mod
if ( autoDownloadAllowed )
Expand Down Expand Up @@ -1145,25 +1143,31 @@ void function ThreadedAuthAndConnectToServer( string password = "", bool modsCha
{
string modName = mod.name
string modVersion = mod.version
array<ModInfo> localModInfo = NSGetModInformation( modName )
ModInfo firstModInfo = localModInfo[0]
array<ModInfo> localModInfos = NSGetModInformation( modName )

// Tolerate core mods (only Northstar.Custom for now) having a different version than server
if ( IsCoreMod(modName) )
{
if ( !firstModInfo.enabled )
if ( !localModInfos[0].enabled )
{
modsChanged = true
NSSetModEnabled( modName, true )
print(format("Enabled \"%s\" (v%s) to join server.", modName, firstModInfo.version))
print(format("Enabled \"%s\" (v%s) to join server.", modName, localModInfos[0].version))
}
}

else if ( !firstModInfo.enabled ) //todo(in multiple versions PR): loop over `NSGetModInformation` members and check versions
else
{
modsChanged = true
NSSetModEnabled( mod.name, true )
print(format("Enabled \"%s\" (v%s) to join server.", modName, modVersion))
foreach( localMod in localModInfos )
{
if ( localMod.version == mod.version )
{
modsChanged = true
NSSetModEnabled( mod.name, true )
print(format("Enabled \"%s\" (v%s) to join server.", modName, modVersion))
break
}
}
}
}

Expand Down

0 comments on commit 93c15fb

Please sign in to comment.