mirror of
https://github.com/R2Northstar/NorthstarMods
synced 2026-08-25 12:29:17 -04:00
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:
parent
509b14c727
commit
047cebfd8f
1 changed files with 36 additions and 1 deletions
|
|
@ -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 )
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue