Downloadable mod icon (#1009)

* feat: display an icon next to downloadable mods

* fix: fetch verified mods list on start

* feat: add IsModInstalled function

* feat: display a red cross if a mod cannot be downloaded

* style: apply sqformat
This commit is contained in:
Rémy Raes 2026-08-18 01:51:20 +02:00 committed by GitHub
parent 509b14c727
commit 047cebfd8f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -293,6 +293,9 @@ void function InitServerBrowserMenu()
// UI was cut off on some aspect ratios; not perfect
UpdateServerInfoBasedOnRes()
// Retrieve list of verified mods
thread NSFetchVerifiedModsManifesto()
}
// //////////////////////////
@ -1094,7 +1097,20 @@ string function FillInServerModsLabel( array<RequiredModInfo> mods )
foreach ( RequiredModInfo mod in mods )
{
ret += format( " %s v%s\n", mod.name, mod.version )
string template = ""
// Display nothing if the mod is installed locally
if ( IsCoreMod( mod.name ) || IsModInstalled( mod.name, mod.version ) )
{
template = " %s v%s\n"
}
// Display a green checkmark if it can be downloaded, a red cross if not
else
{
template = NSIsModDownloadable( mod.name, mod.version ) ? " %s v%s ^00ff0000(↓)^FFFFFFFF\n" : " %s v%s ^ff000000(x)^FFFFFFFF\n"
}
ret += format( template, mod.name, mod.version )
}
return ret
@ -1531,6 +1547,25 @@ array<string> function GetModVersions( string modName )
return versions
}
bool function IsModInstalled( string modName, string modVersion )
{
array<string> versions = GetModVersions( modName )
if ( versions.len() == 0 )
{
return false
}
foreach ( string version in versions )
{
if ( version == modVersion )
{
return true
}
}
return false
}
// escapes localisation by replacing # with ^FFFFFFFF#
string function EscapeLocalisation( string input )
{