diff options
Diffstat (limited to 'server/src/commands.rs')
-rw-r--r-- | server/src/commands.rs | 30 |
1 files changed, 26 insertions, 4 deletions
diff --git a/server/src/commands.rs b/server/src/commands.rs index 96d9ab75..904305bf 100644 --- a/server/src/commands.rs +++ b/server/src/commands.rs @@ -15,7 +15,10 @@ along with this program. If not, see <https://www.gnu.org/licenses/>. */ -use crate::{entity::bot::BotDriver, server::Server}; +use crate::{ + entity::{bot::BotDriver, tutorial::Tutorial}, + server::Server, +}; use anyhow::{anyhow, bail, Result}; use clap::{Parser, ValueEnum}; use hurrycurry_bot::algos::ALGO_CONSTRUCTORS; @@ -58,18 +61,28 @@ enum Command { /// List all recipes and maps List, /// Send an effect - Effect { name: String }, + Effect { + name: String, + }, /// Send an item - Item { name: String }, + Item { + name: String, + }, /// Reload the resource index ReloadIndex, #[clap(alias = "summon-bot", alias = "spawn-bot")] - CreateBot { algo: String, name: Option<String> }, + CreateBot { + algo: String, + name: Option<String>, + }, /// Reload the current map #[clap(alias = "r")] Reload, /// Shows the recipe book Book, + StartTutorial { + item: String, + }, } #[derive(ValueEnum, Clone)] @@ -217,6 +230,15 @@ impl Server { info.players ) } + Command::StartTutorial { item } => { + let item = self + .game + .data + .get_item_by_name(&item) + .ok_or(anyhow!("unknown item"))?; + // TODO prevent too many (> 1) tutorials for this player + self.entities.push(Box::new(Tutorial::new(player, item))); + } } Ok(()) } |