Skip to content

Commit 4534eb8

Browse files
bors[bot]odecay
andauthored
Merge #301
301: Changed hitstun to not transition state if duration is 0 r=odecay a=odecay This means we can now have attacks which apply damage but do not interrupt other actions/state. Currently in use for the slingers rock throw attack. Co-authored-by: otis <electricbuck@gmail.com>
2 parents 8af5dbd + 82261b0 commit 4534eb8

3 files changed

Lines changed: 9 additions & 6 deletions

File tree

src/assets.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -305,7 +305,7 @@ impl AssetLoader for FighterLoader {
305305
get_relative_asset(load_context, load_context.path(), image);
306306

307307
let atlas_handle = load_context.set_labeled_asset(
308-
format!("atlas_{}", index).as_str(),
308+
format!("atlas_{index}").as_str(),
309309
LoadedAsset::new(TextureAtlas::from_grid(
310310
texture_handle,
311311
meta.spritesheet.tile_size.as_vec2(),
@@ -418,7 +418,7 @@ impl AssetLoader for ItemLoader {
418418
get_relative_asset(load_context, load_context.path(), image);
419419

420420
let atlas_handle = load_context.set_labeled_asset(
421-
format!("atlas_{}", index).as_str(),
421+
format!("atlas_{index}").as_str(),
422422
LoadedAsset::new(TextureAtlas::from_grid(
423423
texture_handle,
424424
spritesheet.tile_size.as_vec2(),
@@ -447,7 +447,7 @@ impl AssetLoader for ItemLoader {
447447
get_relative_asset(load_context, load_context.path(), image);
448448

449449
let atlas_handle = load_context.set_labeled_asset(
450-
format!("atlas_{}", index).as_str(),
450+
format!("atlas_{index}").as_str(),
451451
LoadedAsset::new(TextureAtlas::from_grid(
452452
texture_handle,
453453
spritesheet.tile_size.as_vec2(),

src/fighter_state.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -484,6 +484,9 @@ fn collect_hitstuns(
484484
for event in damage_events.iter() {
485485
// If the damaged entity was a fighter
486486
if let Ok(mut transition_intents) = fighters.get_mut(event.damaged_entity) {
487+
if event.hitstun_duration == 0.0 {
488+
continue;
489+
}
487490
// Trigger hit stun
488491
transition_intents.push_back(StateTransition::new(
489492
HitStun {

src/ui/main_menu.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -681,11 +681,11 @@ fn format_input(input: &InputKind) -> String {
681681
let direction = if axis.positive_low == 1.0 { "-" } else { "+" };
682682

683683
let stick = match axis.axis_type {
684-
leafwing_input_manager::axislike::AxisType::Gamepad(axis) => format!("{:?}", axis),
685-
other => format!("{:?}", other),
684+
leafwing_input_manager::axislike::AxisType::Gamepad(axis) => format!("{axis:?}"),
685+
other => format!("{other:?}"),
686686
};
687687

688-
format!("{} {}", stick, direction)
688+
format!("{stick} {direction}")
689689
}
690690
other => other.to_string(),
691691
}

0 commit comments

Comments
 (0)