From 15978d216b3b5a98248c8f667a30da0c6686e1a8 Mon Sep 17 00:00:00 2001 From: timokoesters Date: Sat, 31 Aug 2019 00:13:45 +0200 Subject: [PATCH] Rename controller main, alt to primary, secondary --- common/src/comp/controller.rs | 4 ++-- common/src/sys/agent.rs | 4 ++-- common/src/sys/controller.rs | 12 ++++++------ voxygen/src/session.rs | 8 ++++---- voxygen/src/settings.rs | 8 ++++---- voxygen/src/window.rs | 12 ++++++------ 6 files changed, 24 insertions(+), 24 deletions(-) diff --git a/common/src/comp/controller.rs b/common/src/comp/controller.rs index 0c592e4cf3..eb4912e107 100644 --- a/common/src/comp/controller.rs +++ b/common/src/comp/controller.rs @@ -4,11 +4,11 @@ use vek::*; #[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] pub struct Controller { + pub primary: bool, + pub secondary: bool, pub move_dir: Vec2, pub look_dir: Vec3, pub jump: bool, - pub main: bool, - pub alt: bool, pub roll: bool, pub glide: bool, pub respawn: bool, diff --git a/common/src/sys/agent.rs b/common/src/sys/agent.rs index 20f38144ef..99ae500a01 100644 --- a/common/src/sys/agent.rs +++ b/common/src/sys/agent.rs @@ -87,9 +87,9 @@ impl<'a> System<'a> for Sys { Vec2::::from(target_pos.0 - pos.0).normalized() * 0.5; if rand::random::() < 0.05 { - controller.main = true; + controller.primary = true; } else { - controller.main = false; + controller.primary = false; } } else if dist < SIGHT_DIST { controller.move_dir = diff --git a/common/src/sys/controller.rs b/common/src/sys/controller.rs index 7191e10b6c..98a210da7e 100644 --- a/common/src/sys/controller.rs +++ b/common/src/sys/controller.rs @@ -97,7 +97,7 @@ impl<'a> System<'a> for Sys { } // Wield - if controller.main + if controller.primary && character.action == Idle && (character.movement == Stand || character.movement == Run) { @@ -109,7 +109,7 @@ impl<'a> System<'a> for Sys { match stats.equipment.main { Some(Item::Tool { .. }) => { // Attack - if controller.main + if controller.primary && (character.movement == Stand || character.movement == Run || character.movement == Jump) @@ -126,25 +126,25 @@ impl<'a> System<'a> for Sys { } // Block - if controller.alt + if controller.secondary && (character.movement == Stand || character.movement == Run) && (character.action == Idle || character.action.is_wield()) { character.action = Block { time_left: Duration::from_secs(5), }; - } else if !controller.alt && character.action.is_block() { + } else if !controller.secondary && character.action.is_block() { character.action = Idle; } } Some(Item::Debug(item::Debug::Boost)) => { - if controller.main { + if controller.primary { local_emitter.emit(LocalEvent::Boost { entity, vel: controller.look_dir * 7.0, }); } - if controller.alt { + if controller.secondary { // Go upward local_emitter.emit(LocalEvent::Boost { entity, diff --git a/voxygen/src/session.rs b/voxygen/src/session.rs index b912c99853..af62898a32 100644 --- a/voxygen/src/session.rs +++ b/voxygen/src/session.rs @@ -129,7 +129,7 @@ impl PlayState for SessionState { Event::Close => { return PlayStateResult::Shutdown; } - Event::InputUpdate(GameInput::Main, state) => { + Event::InputUpdate(GameInput::Primary, state) => { // Check the existence of CanBuild component. If it's here, use LMB to // place blocks, if not, use it to attack let mut client = self.client.borrow_mut(); @@ -152,11 +152,11 @@ impl PlayState for SessionState { client.place_block(pos, self.selected_block); } } else { - self.controller.main = state + self.controller.primary = state } } - Event::InputUpdate(GameInput::Alt, state) => { + Event::InputUpdate(GameInput::Secondary, state) => { let mut client = self.client.borrow_mut(); if state && client @@ -176,7 +176,7 @@ impl PlayState for SessionState { client.remove_block(pos); } } else { - self.controller.alt = state; + self.controller.secondary = state; } } Event::InputUpdate(GameInput::Roll, state) => { diff --git a/voxygen/src/settings.rs b/voxygen/src/settings.rs index 7ad1dcc2b6..8f46dd5d47 100644 --- a/voxygen/src/settings.rs +++ b/voxygen/src/settings.rs @@ -13,8 +13,8 @@ use std::{fs, io::prelude::*, path::PathBuf}; #[derive(Clone, Debug, Serialize, Deserialize)] #[serde(default)] pub struct ControlSettings { - pub main: KeyMouse, - pub alt: KeyMouse, + pub primary: KeyMouse, + pub secondary: KeyMouse, pub toggle_cursor: KeyMouse, pub escape: KeyMouse, pub enter: KeyMouse, @@ -46,8 +46,8 @@ pub struct ControlSettings { impl Default for ControlSettings { fn default() -> Self { Self { - main: KeyMouse::Mouse(MouseButton::Left), - alt: KeyMouse::Mouse(MouseButton::Right), + primary: KeyMouse::Mouse(MouseButton::Left), + secondary: KeyMouse::Mouse(MouseButton::Right), toggle_cursor: KeyMouse::Key(VirtualKeyCode::Tab), escape: KeyMouse::Key(VirtualKeyCode::Escape), enter: KeyMouse::Key(VirtualKeyCode::Return), diff --git a/voxygen/src/window.rs b/voxygen/src/window.rs index fafc9ac23f..6676c98223 100644 --- a/voxygen/src/window.rs +++ b/voxygen/src/window.rs @@ -11,8 +11,8 @@ use vek::*; /// Represents a key that the game recognises after keyboard mapping. #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, Deserialize, Serialize)] pub enum GameInput { - Main, - Alt, + Primary, + Secondary, ToggleCursor, MoveForward, MoveBack, @@ -109,12 +109,12 @@ impl Window { .map_err(|err| Error::BackendError(Box::new(err)))?; let mut map: HashMap<_, Vec<_>> = HashMap::new(); - map.entry(settings.controls.main) + map.entry(settings.controls.primary) .or_default() - .push(GameInput::Main); - map.entry(settings.controls.alt) + .push(GameInput::Primary); + map.entry(settings.controls.secondary) .or_default() - .push(GameInput::Alt); + .push(GameInput::Secondary); map.entry(settings.controls.toggle_cursor) .or_default() .push(GameInput::ToggleCursor);