fixed fomod visable condition

This commit is contained in:
2026-03-11 00:29:38 +01:00
parent d806b331db
commit 295c9bd8c3
2 changed files with 30 additions and 4 deletions

View File

@@ -4,7 +4,7 @@ use log::{debug, warn};
use crate::fomod::{
CompositeDependency, Config, DependencyOperator, DependencyState, FileList, FileTypeEnum,
Group, GroupType, Plugin, PluginTypeDescriptorEnum, PluginTypeEnum,
Group, GroupType, ModuleDependency, Plugin, PluginTypeDescriptorEnum, PluginTypeEnum,
};
#[derive(Debug)]
@@ -101,6 +101,22 @@ fn evaluate_dependency(
}
}
fn evaluate_module_depbendecy(
dep: &ModuleDependency,
state: &InstallerState,
installed_plugins: &[String],
) -> bool {
let mut evaluated = dep
.list
.iter()
.map(|e| evaluate_dependency(e, state, installed_plugins));
match dep.operator {
DependencyOperator::And => evaluated.all(|r| r),
DependencyOperator::Or => evaluated.any(|r| r),
}
}
pub struct GroupPrompt {
pub name: String,
pub select_type: GroupType,
@@ -191,7 +207,7 @@ pub fn run_fomod_installer(
if step
.visible
.as_ref()
.is_some_and(|v| !evaluate_dependency(v, &state, installed_plugins))
.is_some_and(|v| !evaluate_module_depbendecy(v, &state, installed_plugins))
{
// Dependency to show the step not meet. Skipping.
continue;