aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBobTheBob <32057864+BobTheBob9@users.noreply.github.com>2022-04-23 16:56:23 +0000
committerBobTheBob <32057864+BobTheBob9@users.noreply.github.com>2022-04-23 16:56:23 +0000
commitb3011e8d285b7fac4e992afe1cfb87a186add673 (patch)
tree78808efd41a450108ccda97a035c755672d4aed0
parente23c3bb7ca83570b5ae7f72343237c31b1fc9b52 (diff)
downloadNorthstarMods-b3011e8d285b7fac4e992afe1cfb87a186add673.tar.gz
NorthstarMods-b3011e8d285b7fac4e992afe1cfb87a186add673.zip
allow custom playlist images to still use datatable-based images
-rw-r--r--Northstar.Client/mod/scripts/vscripts/ui/menu_playlist.nut58
1 files changed, 32 insertions, 26 deletions
diff --git a/Northstar.Client/mod/scripts/vscripts/ui/menu_playlist.nut b/Northstar.Client/mod/scripts/vscripts/ui/menu_playlist.nut
index 564af591..b498db46 100644
--- a/Northstar.Client/mod/scripts/vscripts/ui/menu_playlist.nut
+++ b/Northstar.Client/mod/scripts/vscripts/ui/menu_playlist.nut
@@ -64,54 +64,60 @@ bool function PlaylistButtonInit( var button, int elemNum )
}
asset function GetPlaylistImage( string playlistName )
-{
+{
+ var dataTable = GetDataTable( $"datatable/playlist_items.rpak" )
+
string imageName = GetPlaylistVarOrUseValue( playlistName, "image", "default" )
asset levelImage
-
+
if ( imageName == "custom" )
{
- string customImage = GetPlaylistVarOrUseValue( playlistName, "custom_image", "" )
+ imageName = GetPlaylistVarOrUseValue( playlistName, "custom_image", "" )
// ensure people aren't trying to do some fuckery with this
- if ( customImage.find( "\"" ) != null )
- customImage = ""
+ if ( imageName.find( "\"" ) != null )
+ imageName = ""
- // hell on earth
- levelImage = expect asset( compilestring( "return $\"" + customImage + "\"" )() )
- }
- else
- {
- var dataTable = GetDataTable( $"datatable/playlist_items.rpak" )
- int row = GetDataTableRowMatchingStringValue( dataTable, GetDataTableColumnByName( dataTable, "playlist" ), imageName )
- levelImage = GetDataTableAsset( dataTable, row, GetDataTableColumnByName( dataTable, "image" ) )
+ // if this is in the datatable, use the datatable image rather than the raw path
+ if ( GetDataTableRowMatchingStringValue( dataTable, GetDataTableColumnByName( dataTable, "playlist" ), imageName ) == -1 )
+ {
+ // hell on earth
+ return expect asset( compilestring( "return $\"" + imageName + "\"" )() )
+ }
}
+ int row = GetDataTableRowMatchingStringValue( dataTable, GetDataTableColumnByName( dataTable, "playlist" ), imageName )
+ levelImage = GetDataTableAsset( dataTable, row, GetDataTableColumnByName( dataTable, "image" ) )
+
return levelImage
}
asset function GetPlaylistThumbnailImage( string playlistName )
{
+ var dataTable = GetDataTable( $"datatable/playlist_items.rpak" )
+
string imageName = GetPlaylistVarOrUseValue( playlistName, "image", playlistName )
asset levelImage
if ( imageName == "custom" )
{
- string customImage = GetPlaylistVarOrUseValue( playlistName, "custom_thumbnail", "" )
+ imageName = GetPlaylistVarOrUseValue( playlistName, "custom_thumbnail", "" )
// ensure people aren't trying to do some fuckery with this
- if ( customImage.find( "\"" ) != null )
- customImage = ""
+ if ( imageName.find( "\"" ) != null )
+ imageName = ""
- // hell on earth
- levelImage = expect asset( compilestring( "return $\"" + customImage + "\"" )() )
- }
- else
- {
- var dataTable = GetDataTable( $"datatable/playlist_items.rpak" )
- int row = GetDataTableRowMatchingStringValue( dataTable, GetDataTableColumnByName( dataTable, "playlist" ), imageName )
- if ( row == -1 )
- row = GetDataTableRowMatchingStringValue( dataTable, GetDataTableColumnByName( dataTable, "playlist" ), "default" )
- levelImage = GetDataTableAsset( dataTable, row, GetDataTableColumnByName( dataTable, "thumbnail" ) )
+ // if this is in the datatable, use the datatable image rather than the raw path
+ if ( GetDataTableRowMatchingStringValue( dataTable, GetDataTableColumnByName( dataTable, "playlist" ), imageName ) == -1 )
+ {
+ // hell on earth
+ return expect asset( compilestring( "return $\"" + imageName + "\"" )() )
+ }
}
+ int row = GetDataTableRowMatchingStringValue( dataTable, GetDataTableColumnByName( dataTable, "playlist" ), imageName )
+ if ( row == -1 )
+ row = GetDataTableRowMatchingStringValue( dataTable, GetDataTableColumnByName( dataTable, "playlist" ), "default" )
+ levelImage = GetDataTableAsset( dataTable, row, GetDataTableColumnByName( dataTable, "thumbnail" ) )
+
return levelImage
}