aboutsummaryrefslogtreecommitdiff
path: root/crates/fparkan-runtime/src/projectile_shield.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/fparkan-runtime/src/projectile_shield.rs')
-rw-r--r--crates/fparkan-runtime/src/projectile_shield.rs22
1 files changed, 13 insertions, 9 deletions
diff --git a/crates/fparkan-runtime/src/projectile_shield.rs b/crates/fparkan-runtime/src/projectile_shield.rs
index 91715cc1..bb766fc5 100644
--- a/crates/fparkan-runtime/src/projectile_shield.rs
+++ b/crates/fparkan-runtime/src/projectile_shield.rs
@@ -124,19 +124,23 @@ pub fn shield_effect_sources(
.iter()
.enumerate()
.flat_map(|(object, controls)| {
- controls.iter().flatten().flat_map(move |control| {
- control
- .typed_records
- .iter()
- .filter(|record| record.tag == 9)
- .filter_map(move |record| {
- Some((object, shield_effect_source(&record.fixed_words)?))
- })
- })
+ shield_effects_for_components(controls).map(move |key| (object, key))
})
})
}
+pub(super) fn shield_effects_for_components(
+ controls: &[Option<fparkan_assets::PreparedComponentControl>],
+) -> impl Iterator<Item = (String, String)> + '_ {
+ controls.iter().flatten().flat_map(|control| {
+ control
+ .typed_records
+ .iter()
+ .filter(|record| record.tag == 9)
+ .filter_map(|record| shield_effect_source(&record.fixed_words))
+ })
+}
+
fn shield_effect_source(words: &[u32; 44]) -> Option<(String, String)> {
let archive = fixed_words_ascii_c_string(&words[27..35])?;
let name = fixed_words_ascii_c_string(&words[35..43])?;