From a7747fe9650c4a47a2dd9f90b1d84237990b5fdb Mon Sep 17 00:00:00 2001 From: timokoesters Date: Sun, 25 Aug 2019 22:40:59 +0200 Subject: [PATCH] Simplify code --- common/src/sys/combat.rs | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/common/src/sys/combat.rs b/common/src/sys/combat.rs index b9e2e12bce..9b2b74f278 100644 --- a/common/src/sys/combat.rs +++ b/common/src/sys/combat.rs @@ -52,8 +52,6 @@ impl<'a> System<'a> for Sys { for (entity, uid, pos, ori, controller) in (&entities, &uids, &positions, &orientations, &controllers).join() { - let mut todo_end = false; - // Go through all other entities if let Some(Attack { time_left, applied }) = &mut character_states.get(entity).map(|c| c.action) @@ -108,7 +106,11 @@ impl<'a> System<'a> for Sys { *applied = true; if *time_left == Duration::default() { - todo_end = true; + if let Some(character) = &mut character_states.get_mut(entity) { + character.action = Wield { + time_left: Duration::default(), + }; + } } else { *time_left = time_left .checked_sub(Duration::from_secs_f32(dt.0)) @@ -116,13 +118,6 @@ impl<'a> System<'a> for Sys { } } } - if todo_end { - if let Some(character) = &mut character_states.get_mut(entity) { - character.action = Wield { - time_left: Duration::default(), - }; - } - } if let Some(Wield { time_left }) = &mut character_states.get_mut(entity).map(|c| &mut c.action)