Send commands on client launch, closes #190

This commit is contained in:
Tom Watson 2019-07-18 22:50:46 +00:00 committed by Marcel
parent 81ca86ad06
commit 3a1ae1b361
2 changed files with 12 additions and 0 deletions

View File

@ -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 =

View File

@ -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<String>,
}
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(),
}
}
}