diff options
| author | troido <troido@protonmail.com> | 2021-12-30 21:20:46 +0100 |
|---|---|---|
| committer | troido <troido@protonmail.com> | 2021-12-30 21:20:46 +0100 |
| commit | 755ae8512bfe3ff39a55c22a958e15399e886c5f (patch) | |
| tree | 167b34f51071ee6ec915b787094c8dadef2d4dde /src/controls.rs | |
| parent | d10d3e0368bd1178085ab8abd2ea24afe912b26f (diff) | |
entities can now have descriptions
Diffstat (limited to 'src/controls.rs')
| -rw-r--r-- | src/controls.rs | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/controls.rs b/src/controls.rs index ca1ed8e..38611aa 100644 --- a/src/controls.rs +++ b/src/controls.rs @@ -8,9 +8,13 @@ use crate::{PlayerId, Pos}; #[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)] #[serde(rename_all="lowercase")] pub enum Direction { + #[serde(alias="n")] North, + #[serde(alias="s")] South, + #[serde(alias="e")] East, + #[serde(alias="w")] West, #[serde(alias="")] None @@ -38,6 +42,7 @@ pub enum Control { Attack(Vec<Direction>), AttackTarget(Entity), Interact(Vec<Direction>, Option<String>), + Describe(Direction) } @@ -85,6 +90,9 @@ impl Control { None } )), + "describe" => Some(Control::Describe( + Direction::deserialize(val.get(1)?).ok()? + )), _ => None } } else {None} |
