From e0bcab53b8a3721a008e47062c6b5972fa64b8ad Mon Sep 17 00:00:00 2001 From: mat Date: Sun, 2 Oct 2022 15:02:27 -0500 Subject: [PATCH] start adding stuff to azalea crate --- Cargo.lock | 1 + azalea/Cargo.toml | 6 +++--- azalea/README.md | 2 +- azalea/src/bot.rs | 14 ++++++++++++++ azalea/src/lib.rs | 6 ++++-- azalea/src/prelude.rs | 1 + 6 files changed, 24 insertions(+), 6 deletions(-) create mode 100644 azalea/src/bot.rs create mode 100644 azalea/src/prelude.rs diff --git a/Cargo.lock b/Cargo.lock index 9d1ba73f..00ac6582 100755 --- a/Cargo.lock +++ b/Cargo.lock @@ -103,6 +103,7 @@ name = "azalea" version = "0.1.0" dependencies = [ "anyhow", + "azalea-client", "env_logger", "tokio", ] diff --git a/azalea/Cargo.toml b/azalea/Cargo.toml index 0256194e..77f07ab3 100644 --- a/azalea/Cargo.toml +++ b/azalea/Cargo.toml @@ -9,9 +9,9 @@ version = "0.1.0" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] - +azalea-client = {version = "0.1.0", path = "../azalea-client"} [dev-dependencies] -tokio = "^1.21.1" -env_logger = "^0.9.1" anyhow = "^1.0.65" +env_logger = "^0.9.1" +tokio = "^1.21.1" diff --git a/azalea/README.md b/azalea/README.md index fa77cd12..6678052c 100644 --- a/azalea/README.md +++ b/azalea/README.md @@ -1 +1 @@ -This is currently an advertisement crate for [Azalea](https://github.com/mat-1/azalea), it will have more stuff later! +A wrapper over azalea-client, adding useful functions for making bots. diff --git a/azalea/src/bot.rs b/azalea/src/bot.rs new file mode 100644 index 00000000..6746e09e --- /dev/null +++ b/azalea/src/bot.rs @@ -0,0 +1,14 @@ +pub struct BotState { + jumping_once: bool, +} + +pub trait BotTrait { + fn jump(&mut self); +} + +impl BotTrait for azalea_client::Client { + fn jump(&mut self) { + let mut physics_state = self.physics_state.lock().unwrap(); + physics_state.jumping_once = true; + } +} diff --git a/azalea/src/lib.rs b/azalea/src/lib.rs index 144caa55..fe8a3740 100644 --- a/azalea/src/lib.rs +++ b/azalea/src/lib.rs @@ -1,2 +1,4 @@ -//! This is currently an advertisement crate for -//! [Azalea](https://github.com/mat-1/azalea). More stuff will be here soon! +mod bot; +pub mod prelude; + +pub use azalea_client::Client; diff --git a/azalea/src/prelude.rs b/azalea/src/prelude.rs new file mode 100644 index 00000000..7b3345b0 --- /dev/null +++ b/azalea/src/prelude.rs @@ -0,0 +1 @@ +pub use crate::bot::BotTrait;