diff options
| author | troido <troido@protonmail.com> | 2020-09-22 14:34:53 +0200 |
|---|---|---|
| committer | troido <troido@protonmail.com> | 2020-09-22 14:34:53 +0200 |
| commit | 33c1054d528efd896415baf08d4a52e1cdd7b801 (patch) | |
| tree | 9d564a101129ca800f91fa37c4c002747e06c8da /src/systems/interact.rs | |
| parent | 410de5640c76b1501240e39e725350fc58a7e094 (diff) | |
turned some math into if let to decrease indentation
Diffstat (limited to 'src/systems/interact.rs')
| -rw-r--r-- | src/systems/interact.rs | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/src/systems/interact.rs b/src/systems/interact.rs index 1eb4589..0629dc1 100644 --- a/src/systems/interact.rs +++ b/src/systems/interact.rs @@ -59,16 +59,13 @@ impl <'a> System<'a> for Interact { for (actor, controller, position) in (&entities, &controllers, &positions).join(){ let mut target = None; let ear = ears.get_mut(actor); - match &controller.control { - Control::Interact(directions, arg) => { - for (ent, interactable) in ground.components_near(position.pos, directions, &interactables) { - if interactable.accepts_arg(arg){ - target = Some((ent, interactable, arg.clone())); - break; - } + if let Control::Interact(directions, arg) = &controller.control { + for (ent, interactable) in ground.components_near(position.pos, directions, &interactables) { + if interactable.accepts_arg(arg){ + target = Some((ent, interactable, arg.clone())); + break; } } - _ => {} } if let Some((ent, interactable, arg)) = target { let mut cooldown = 2; |
