From 3a1ae1b3612b304d342f61511d9c530fe30de9e9 Mon Sep 17 00:00:00 2001 From: Tom Watson Date: Thu, 18 Jul 2019 22:50:46 +0000 Subject: [PATCH] Send commands on client launch, closes #190 --- voxygen/src/session.rs | 7 +++++++ voxygen/src/settings.rs | 5 +++++ 2 files changed, 12 insertions(+) diff --git a/voxygen/src/session.rs b/voxygen/src/session.rs index 660463fa12..5221971b7c 100644 --- a/voxygen/src/session.rs +++ b/voxygen/src/session.rs @@ -85,6 +85,13 @@ impl PlayState for SessionState { let mut clock = Clock::start(); self.client.borrow_mut().clear_terrain(); + // Send startup commands to the server + if global_state.settings.send_logon_commands { + for cmd in &global_state.settings.logon_commands { + self.client.borrow_mut().send_chat(cmd.to_string()); + } + } + // Game loop let mut current_client_state = self.client.borrow().get_client_state(); while let ClientState::Pending | ClientState::Character | ClientState::Dead = diff --git a/voxygen/src/settings.rs b/voxygen/src/settings.rs index fdee8ca795..ae2b92158b 100644 --- a/voxygen/src/settings.rs +++ b/voxygen/src/settings.rs @@ -176,6 +176,9 @@ pub struct Settings { pub graphics: GraphicsSettings, pub audio: AudioSettings, pub show_disclaimer: bool, + pub send_logon_commands: bool, + // TODO: Remove at a later date, for dev testing + pub logon_commands: Vec, } impl Default for Settings { @@ -188,6 +191,8 @@ impl Default for Settings { graphics: GraphicsSettings::default(), audio: AudioSettings::default(), show_disclaimer: true, + send_logon_commands: false, + logon_commands: Vec::new(), } } }