diff options
Diffstat (limited to 'server/src/commands.rs')
-rw-r--r-- | server/src/commands.rs | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/server/src/commands.rs b/server/src/commands.rs index dab0e540..c03c8bcd 100644 --- a/server/src/commands.rs +++ b/server/src/commands.rs @@ -81,9 +81,11 @@ enum Command { Reload, /// Shows the recipe book Book, + #[clap(alias = "tutorial")] StartTutorial { item: String, }, + EndTutorial, #[clap(alias = "tr")] TranslateMessage { message_id: String, @@ -270,6 +272,18 @@ impl Server { } self.entities.push(Box::new(Tutorial::new(player, item))); } + Command::EndTutorial => { + #[cfg(not(test))] // TODO rust-analyser does not undestand trait upcasting + if let Some(tutorial) = self + .entities + .iter_mut() + .find_map(|e| <dyn std::any::Any>::downcast_mut::<Tutorial>(e.as_mut())) + { + tutorial.ended = true; + } else { + bail!("No tutorial running") + } + } Command::TranslateMessage { message_id, arguments, |