From 35bb41ad0ef2dcb34f143c0cc066610c29bae455 Mon Sep 17 00:00:00 2001 From: metamuffin Date: Thu, 26 Dec 2024 10:57:17 +0100 Subject: editor load feature and return to editor command --- server/src/commands.rs | 35 ++++++++++++++++++++++------------- 1 file changed, 22 insertions(+), 13 deletions(-) (limited to 'server/src/commands.rs') diff --git a/server/src/commands.rs b/server/src/commands.rs index 5daedda9..64fa50f6 100644 --- a/server/src/commands.rs +++ b/server/src/commands.rs @@ -65,35 +65,34 @@ 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", alias = "bot")] - CreateBot { - algo: String, - name: Option, - }, + CreateBot { algo: String, name: Option }, /// Reload the current map #[clap(alias = "r")] Reload, /// Shows the recipe book Book, + /// Start an interactive tutorial for some item #[clap(alias = "tutorial")] - StartTutorial { - item: String, - }, + StartTutorial { item: String }, + /// End the tutorial unfinished EndTutorial, #[clap(alias = "tr")] + /// Manually send a translated message TranslateMessage { message_id: String, arguments: Vec, }, + /// Return to the map editor + #[clap(alias = "e", alias = "editor")] + Edit, + #[clap(hide = true)] + SetEditorAddress { url: String }, } #[derive(ValueEnum, Clone)] @@ -365,6 +364,16 @@ impl Server { timeout: None, }); } + Command::Edit => { + let addr = self + .editor_address + .clone() + .ok_or(tre!("s.error.not_editor_session"))?; + replies.push(PacketC::Redirect { uri: vec![addr] }); + } + Command::SetEditorAddress { url } => { + self.editor_address = Some(url); + } } Ok(()) } -- cgit v1.2.3-70-g09d2