Files
shinespark/src/scripting/mod.rs
T
EIREXE 7a9adbd6a4
CI / build-and-test (push) Successful in 1m33s
CI / production-build (push) Successful in 12m5s
Implement animation root motion deltas (#84)
Implements root motion and adds a dash attack.

Reviewed-on: #84
Co-authored-by: Álex Román Núñez <eirexe@eirteam.moe>
2026-10-05 20:04:35 +00:00

52 lines
1.5 KiB
Rust

use bevy::prelude::*;
use serde::{Deserialize, Serialize};
use crate::{fighter::attack::AttackHitbox, math::int::FGi32};
pub mod importer;
pub mod move_compiler;
pub enum MoveAngleKind {
Normal(FGi32),
Sakurai,
}
#[derive(Asset, Reflect, Serialize, Deserialize)]
pub struct FighterAttackScript {
pub hitboxes: Vec<AttackHitbox>,
pub iasa_frame: Option<u32>,
pub wont_autocancel_window: Option<(u32, u32)>,
pub landing_duration: Option<u32>,
pub use_root_motion: bool
}
impl FighterAttackScript {
pub fn validate(&self) -> Result<(), String> {
for hitbox in &self.hitboxes {
hitbox.validate()?;
}
for (index, left) in self.hitboxes.iter().enumerate() {
for right in self.hitboxes.iter().skip(index + 1) {
if left.id == right.id
&& left.start_frame < right.end_frame
&& right.start_frame < left.end_frame
{
return Err(format!(
"hitbox id {} has overlapping intervals {}..{} and {}..{}",
left.id, left.start_frame, left.end_frame, right.start_frame,
right.end_frame
));
}
}
}
if let Some(wont_autocancel_window) = self.wont_autocancel_window {
if wont_autocancel_window.0 > wont_autocancel_window.1 {
return Err("autocancel window end precedes its start".into());
}
}
Ok(())
}
}