mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
Simplify code
This commit is contained in:
parent
c4879307af
commit
a7747fe965
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user