mirror of
https://github.com/xivdev/Penumbra.git
synced 2025-12-12 18:27:24 +01:00
fix a bug where priorities weren't fixed after deleting mods
This commit is contained in:
parent
055399a7e7
commit
d7fda7cf1b
3 changed files with 70 additions and 11 deletions
|
|
@ -84,6 +84,14 @@ namespace Penumbra.Mods
|
||||||
)
|
)
|
||||||
).ToList();
|
).ToList();
|
||||||
|
|
||||||
|
// if anything gets removed above, the priority ordering gets fucked, so we need to resort and reindex them otherwise BAD THINGS HAPPEN
|
||||||
|
ModSettings = ModSettings.OrderBy( x => x.Priority ).ToList();
|
||||||
|
var p = 0;
|
||||||
|
foreach( var modSetting in ModSettings )
|
||||||
|
{
|
||||||
|
modSetting.Priority = p++;
|
||||||
|
}
|
||||||
|
|
||||||
// reorder the resourcemods list so we can just directly iterate
|
// reorder the resourcemods list so we can just directly iterate
|
||||||
EnabledMods = GetOrderedAndEnabledModList().ToArray();
|
EnabledMods = GetOrderedAndEnabledModList().ToArray();
|
||||||
|
|
||||||
|
|
@ -130,6 +138,8 @@ namespace Penumbra.Mods
|
||||||
Save();
|
Save();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public ModInfo FindModSettings( string name )
|
public ModInfo FindModSettings( string name )
|
||||||
{
|
{
|
||||||
var settings = ModSettings.FirstOrDefault(
|
var settings = ModSettings.FirstOrDefault(
|
||||||
|
|
|
||||||
|
|
@ -43,7 +43,7 @@ namespace Penumbra
|
||||||
|
|
||||||
PluginInterface.CommandManager.AddHandler( CommandName, new CommandInfo( OnCommand )
|
PluginInterface.CommandManager.AddHandler( CommandName, new CommandInfo( OnCommand )
|
||||||
{
|
{
|
||||||
HelpMessage = "/penumbra 0 will disable penumbra, /penumbra 1 will enable it."
|
HelpMessage = "/penumbra - toggle ui\n/penumbra reload - reload mod file lists & discover any new mods"
|
||||||
} );
|
} );
|
||||||
|
|
||||||
ResourceLoader.Init();
|
ResourceLoader.Init();
|
||||||
|
|
@ -65,15 +65,27 @@ namespace Penumbra
|
||||||
ResourceLoader.Dispose();
|
ResourceLoader.Dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnCommand( string command, string args )
|
private void OnCommand( string command, string rawArgs )
|
||||||
{
|
{
|
||||||
|
var args = rawArgs.Split( ' ' );
|
||||||
if( args.Length > 0 )
|
if( args.Length > 0 )
|
||||||
Configuration.IsEnabled = args[ 0 ] == '1';
|
{
|
||||||
|
switch( args[ 0 ] )
|
||||||
|
{
|
||||||
|
case "reload":
|
||||||
|
{
|
||||||
|
ModManager.DiscoverMods();
|
||||||
|
PluginInterface.Framework.Gui.Chat.Print(
|
||||||
|
$"Reloaded Penumbra mods. You have {ModManager.Mods.ModSettings.Count} mods, {ModManager.Mods.EnabledMods.Length} of which are enabled."
|
||||||
|
);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if( Configuration.IsEnabled )
|
return;
|
||||||
ResourceLoader.Enable();
|
}
|
||||||
else
|
|
||||||
ResourceLoader.Disable();
|
SettingsInterface.Visible = !SettingsInterface.Visible;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -18,6 +18,7 @@ namespace Penumbra.UI
|
||||||
private readonly Plugin _plugin;
|
private readonly Plugin _plugin;
|
||||||
|
|
||||||
public bool Visible = false;
|
public bool Visible = false;
|
||||||
|
public bool ShowDebugBar = false;
|
||||||
|
|
||||||
private static readonly Vector2 AutoFillSize = new Vector2( -1, -1 );
|
private static readonly Vector2 AutoFillSize = new Vector2( -1, -1 );
|
||||||
private static readonly Vector2 ModListSize = new Vector2( 200, -1 );
|
private static readonly Vector2 ModListSize = new Vector2( 200, -1 );
|
||||||
|
|
@ -36,10 +37,46 @@ namespace Penumbra.UI
|
||||||
public SettingsInterface( Plugin plugin )
|
public SettingsInterface( Plugin plugin )
|
||||||
{
|
{
|
||||||
_plugin = plugin;
|
_plugin = plugin;
|
||||||
|
#if DEBUG
|
||||||
|
Visible = true;
|
||||||
|
ShowDebugBar = true;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Draw()
|
public void Draw()
|
||||||
{
|
{
|
||||||
|
if( ShowDebugBar && ImGui.BeginMainMenuBar() )
|
||||||
|
{
|
||||||
|
if( ImGui.BeginMenu( "Penumbra" ) )
|
||||||
|
{
|
||||||
|
if( ImGui.MenuItem( "Toggle UI", "/penumbra", Visible ) )
|
||||||
|
{
|
||||||
|
Visible = !Visible;
|
||||||
|
}
|
||||||
|
|
||||||
|
if( ImGui.MenuItem( "Rediscover Mods" ) )
|
||||||
|
{
|
||||||
|
ReloadMods();
|
||||||
|
}
|
||||||
|
|
||||||
|
// ImGui.Separator();
|
||||||
|
// #if DEBUG
|
||||||
|
// ImGui.Text( _plugin.PluginDebugTitleStr );
|
||||||
|
// #else
|
||||||
|
// ImGui.Text( _plugin.Name );
|
||||||
|
// #endif
|
||||||
|
|
||||||
|
ImGui.EndMenu();
|
||||||
|
}
|
||||||
|
|
||||||
|
ImGui.EndMainMenuBar();
|
||||||
|
}
|
||||||
|
|
||||||
|
if( !Visible )
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
ImGui.SetNextWindowSizeConstraints( MinSettingsSize, MaxSettingsSize );
|
ImGui.SetNextWindowSizeConstraints( MinSettingsSize, MaxSettingsSize );
|
||||||
#if DEBUG
|
#if DEBUG
|
||||||
var ret = ImGui.Begin( _plugin.PluginDebugTitleStr, ref Visible );
|
var ret = ImGui.Begin( _plugin.PluginDebugTitleStr, ref Visible );
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue