diff options
| author | troido <troido@protonmail.com> | 2020-03-04 19:58:29 +0100 |
|---|---|---|
| committer | troido <troido@protonmail.com> | 2020-03-04 19:58:29 +0100 |
| commit | e0dcd48034e2bab9e0ae17a80a5b4d9f0f2a7900 (patch) | |
| tree | 958a9de5ec4552613379b8077b79b5956f092c7f /src/controls.rs | |
| parent | 022e439a6677b9865b7a3287dbd197d86266f8ef (diff) | |
useitem now actually respects rank
Diffstat (limited to 'src/controls.rs')
| -rw-r--r-- | src/controls.rs | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/controls.rs b/src/controls.rs index 581b522..3254e00 100644 --- a/src/controls.rs +++ b/src/controls.rs @@ -62,7 +62,13 @@ impl Control { }, "take" => Some(Control::Take(val.get(1)?.as_u64().map(|idx| idx as usize))), "drop" => Some(Control::Drop(val.get(1)?.as_u64().unwrap_or(0) as usize)), - "use" => Some(Control::Use(val.get(1)?.as_u64().unwrap_or(0) as usize)), + "use" => Some({ + println!("use argument {:?}", val); + if val.get(1)?.as_str()? != "inventory" { + return None; + } + Control::Use(val.get(2)?.as_u64().unwrap_or(0) as usize) + }), "attack" => Some(Control::Attack({ let mut directions = Vec::new(); for dir in val.get(1)?.as_array()? { |
