aboutsummaryrefslogtreecommitdiff
path: root/azalea/examples/testbot/commands
diff options
context:
space:
mode:
authormat <git@matdoes.dev>2026-03-27 13:49:18 -0600
committermat <git@matdoes.dev>2026-03-28 01:49:34 +0600
commit2d3e4194b885ec499826812da52c965f5a7235cf (patch)
tree9cffc73bb9c5ffa29591392f060816b2c9f321a6 /azalea/examples/testbot/commands
parenteeaf1435e81d9cbd8daa0efa22029c1f259a64b5 (diff)
downloadazalea-drasl-2d3e4194b885ec499826812da52c965f5a7235cf.tar.xz
instant path updates for simple paths, and add follow command to testbot
Diffstat (limited to 'azalea/examples/testbot/commands')
-rw-r--r--azalea/examples/testbot/commands/movement.rs18
1 files changed, 15 insertions, 3 deletions
diff --git a/azalea/examples/testbot/commands/movement.rs b/azalea/examples/testbot/commands/movement.rs
index 3f015f2c..500e17b0 100644
--- a/azalea/examples/testbot/commands/movement.rs
+++ b/azalea/examples/testbot/commands/movement.rs
@@ -9,7 +9,6 @@ use azalea::{
use parking_lot::Mutex;
use super::{CommandSource, Ctx};
-use crate::BotTask;
pub fn register(commands: &mut CommandDispatcher<Mutex<CommandSource>>) {
commands.register(
@@ -72,6 +71,19 @@ pub fn register(commands: &mut CommandDispatcher<Mutex<CommandSource>>) {
))),
);
+ commands.register(literal("follow").executes(|ctx: &Ctx| {
+ let source = ctx.source.lock();
+ println!("got follow");
+ // look for the sender
+ let Some(entity) = source.entity() else {
+ source.reply("I can't see you!");
+ return 0;
+ };
+ source.reply("ok");
+ *source.state.following_entity.lock() = Some(entity);
+ 1
+ }));
+
commands.register(literal("down").executes(|ctx: &Ctx| {
let source = ctx.source.clone();
tokio::spawn(async move {
@@ -207,14 +219,14 @@ pub fn register(commands: &mut CommandDispatcher<Mutex<CommandSource>>) {
let source = ctx.source.lock();
source.bot.stop_pathfinding();
source.reply("ok");
- *source.state.task.lock() = BotTask::None;
+ *source.state.following_entity.lock() = None;
1
}));
commands.register(literal("forcestop").executes(|ctx: &Ctx| {
let source = ctx.source.lock();
source.bot.force_stop_pathfinding();
source.reply("ok");
- *source.state.task.lock() = BotTask::None;
+ *source.state.following_entity.lock() = None;
1
}));
}