summaryrefslogtreecommitdiff
path: root/server/src/commands.rs
diff options
context:
space:
mode:
authormetamuffin <metamuffin@disroot.org>2024-12-26 10:57:17 +0100
committermetamuffin <metamuffin@disroot.org>2024-12-26 10:57:17 +0100
commit35bb41ad0ef2dcb34f143c0cc066610c29bae455 (patch)
tree6547a2301e8c9909bf927ed3f324520989d476eb /server/src/commands.rs
parent6ca4b3377a08fa30a13835d59f9558419f7f5cd1 (diff)
downloadhurrycurry-35bb41ad0ef2dcb34f143c0cc066610c29bae455.tar
hurrycurry-35bb41ad0ef2dcb34f143c0cc066610c29bae455.tar.bz2
hurrycurry-35bb41ad0ef2dcb34f143c0cc066610c29bae455.tar.zst
editor load feature and return to editor command
Diffstat (limited to 'server/src/commands.rs')
-rw-r--r--server/src/commands.rs35
1 files changed, 22 insertions, 13 deletions
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<String>,
- },
+ CreateBot { algo: String, name: Option<String> },
/// 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<String>,
},
+ /// 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(())
}