mirror of
https://github.com/loot/loot-condition-interpreter.git
synced 2026-07-27 14:16:09 -07:00
Fix description_contains for OpenMW plugins
This commit is contained in:
+15
-2
@@ -128,8 +128,7 @@ fn parse_plugin(state: &State, file_path: &Path) -> Option<esplugin::Plugin> {
|
|||||||
use esplugin::GameId;
|
use esplugin::GameId;
|
||||||
|
|
||||||
let game_id = match state.game_type {
|
let game_id = match state.game_type {
|
||||||
GameType::OpenMW => return None,
|
GameType::Morrowind | GameType::OpenMW => GameId::Morrowind,
|
||||||
GameType::Morrowind => GameId::Morrowind,
|
|
||||||
GameType::Oblivion => GameId::Oblivion,
|
GameType::Oblivion => GameId::Oblivion,
|
||||||
GameType::Skyrim => GameId::Skyrim,
|
GameType::Skyrim => GameId::Skyrim,
|
||||||
GameType::SkyrimSE | GameType::SkyrimVR => GameId::SkyrimSE,
|
GameType::SkyrimSE | GameType::SkyrimVR => GameId::SkyrimSE,
|
||||||
@@ -150,8 +149,12 @@ fn parse_plugin(state: &State, file_path: &Path) -> Option<esplugin::Plugin> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn evaluate_is_master(state: &State, file_path: &Path) -> bool {
|
fn evaluate_is_master(state: &State, file_path: &Path) -> bool {
|
||||||
|
if state.game_type == GameType::OpenMW {
|
||||||
|
false
|
||||||
|
} else {
|
||||||
parse_plugin(state, file_path).is_some_and(|plugin| plugin.is_master_file())
|
parse_plugin(state, file_path).is_some_and(|plugin| plugin.is_master_file())
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#[expect(clippy::iter_over_hash_type)]
|
#[expect(clippy::iter_over_hash_type)]
|
||||||
fn evaluate_many_active(state: &State, regex: &Regex) -> bool {
|
fn evaluate_many_active(state: &State, regex: &Regex) -> bool {
|
||||||
@@ -526,6 +529,16 @@ mod tests {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn parse_plugin_should_parse_openmw_plugins() {
|
||||||
|
let mut state = state(Path::new("./tests/testing-plugins/Morrowind/Data Files"));
|
||||||
|
state.game_type = GameType::OpenMW;
|
||||||
|
|
||||||
|
let plugin = parse_plugin(&state, Path::new("Blank.esp"));
|
||||||
|
|
||||||
|
assert!(plugin.is_some());
|
||||||
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn function_file_path_eval_should_return_true_if_the_file_exists_relative_to_the_data_path() {
|
fn function_file_path_eval_should_return_true_if_the_file_exists_relative_to_the_data_path() {
|
||||||
let function = Function::FilePath(PathBuf::from("Cargo.toml"));
|
let function = Function::FilePath(PathBuf::from("Cargo.toml"));
|
||||||
|
|||||||
Reference in New Issue
Block a user