summaryrefslogtreecommitdiff
path: root/server/src
diff options
context:
space:
mode:
Diffstat (limited to 'server/src')
-rw-r--r--server/src/commands.rs35
-rw-r--r--server/src/server.rs2
2 files changed, 24 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(())
}
diff --git a/server/src/server.rs b/server/src/server.rs
index 0889cd71..3da95a43 100644
--- a/server/src/server.rs
+++ b/server/src/server.rs
@@ -56,6 +56,7 @@ pub struct Server {
pub packet_out: VecDeque<PacketC>,
pub scoreboard: ScoreboardStore,
pub gamedata_index: GamedataIndex,
+ pub editor_address: Option<String>,
}
pub trait GameServerExt {
@@ -326,6 +327,7 @@ impl Server {
scoreboard: ScoreboardStore::load()
.await
.context("Failed to load scoreboards")?,
+ editor_address: None,
})
}
}