Moar fixes and optimizations

This commit is contained in:
2026-09-12 17:10:20 +02:00
parent df18ffa1a7
commit 531ecc1aec
14 changed files with 371 additions and 128 deletions
+17
View File
@@ -1,5 +1,6 @@
use bevy::prelude::*;
use serde::{Deserialize, Serialize};
use std::collections::HashSet;
use crate::{fighter::attack::AttackHitbox, math::int::FGi32};
@@ -17,3 +18,19 @@ pub struct FighterAttackScript {
pub iasa_frame: u32,
pub wont_autocancel_window: (u32, u32),
}
impl FighterAttackScript {
pub fn validate(&self) -> Result<(), String> {
let mut ids = HashSet::with_capacity(self.hitboxes.len());
for hitbox in &self.hitboxes {
hitbox.validate()?;
if !ids.insert(hitbox.id) {
return Err(format!("duplicate hitbox id {}", hitbox.id));
}
}
if self.wont_autocancel_window.0 > self.wont_autocancel_window.1 {
return Err("autocancel window end precedes its start".into());
}
Ok(())
}
}