mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
Merge remote-tracking branch 'origin/master' into combat
This commit is contained in:
commit
fe2aa7da7b
@ -27,6 +27,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||
- Added authentication system (to play on the official server register on https://account.veloren.net)
|
||||
- Added gamepad/controller support
|
||||
- Added player feedback when attempting to pickup an item with a full inventory
|
||||
- Added free look
|
||||
|
||||
### Changed
|
||||
|
||||
|
@ -333,6 +333,8 @@ Chat commands:
|
||||
"hud.social.play_online_fmt": "{nb_player} player(s) online",
|
||||
|
||||
"hud.spell": "Spell",
|
||||
|
||||
"hud.free_look_indicator": "Free look active",
|
||||
/// End HUD section
|
||||
|
||||
|
||||
|
@ -9,9 +9,12 @@ const TPS: u64 = 30;
|
||||
|
||||
fn main() {
|
||||
// Init logging
|
||||
if let Err(_) = std::env::var("RUST_LOG") {
|
||||
std::env::set_var("RUST_LOG", "info");
|
||||
}
|
||||
pretty_env_logger::init();
|
||||
|
||||
info!("Starting server-cli...");
|
||||
info!("Starting server...");
|
||||
|
||||
// Set up an fps clock
|
||||
let mut clock = Clock::start();
|
||||
@ -23,7 +26,7 @@ fn main() {
|
||||
// Create server
|
||||
let mut server = Server::new(settings).expect("Failed to create server instance!");
|
||||
|
||||
info!("Server is ready to accept connections");
|
||||
info!("Server is ready to accept connections.");
|
||||
info!("Metrics port: {}", metrics_port);
|
||||
|
||||
loop {
|
||||
|
@ -203,6 +203,11 @@ impl Server {
|
||||
server_settings: settings.clone(),
|
||||
};
|
||||
debug!("created veloren server with: {:?}", &settings);
|
||||
log::info!(
|
||||
"Server version: {}[{}]",
|
||||
*common::util::GIT_HASH,
|
||||
*common::util::GIT_DATE
|
||||
);
|
||||
|
||||
Ok(this)
|
||||
}
|
||||
|
@ -52,6 +52,7 @@ use vek::*;
|
||||
|
||||
const XP_COLOR: Color = Color::Rgba(0.59, 0.41, 0.67, 1.0);
|
||||
const TEXT_COLOR: Color = Color::Rgba(1.0, 1.0, 1.0, 1.0);
|
||||
const TEXT_BG: Color = Color::Rgba(0.0, 0.0, 0.0, 1.0);
|
||||
//const TEXT_COLOR_GREY: Color = Color::Rgba(1.0, 1.0, 1.0, 0.5);
|
||||
const MENU_BG: Color = Color::Rgba(0.0, 0.0, 0.0, 0.4);
|
||||
//const TEXT_COLOR_2: Color = Color::Rgba(0.0, 0.0, 0.0, 1.0);
|
||||
@ -180,6 +181,10 @@ widget_ids! {
|
||||
small_window,
|
||||
social_window,
|
||||
settings_window,
|
||||
|
||||
// Free look indicator
|
||||
free_look_txt,
|
||||
free_look_bg,
|
||||
}
|
||||
}
|
||||
|
||||
@ -289,6 +294,7 @@ pub struct Show {
|
||||
social_tab: SocialTab,
|
||||
want_grab: bool,
|
||||
stats: bool,
|
||||
free_look: bool,
|
||||
}
|
||||
impl Show {
|
||||
fn bag(&mut self, open: bool) {
|
||||
@ -479,6 +485,7 @@ impl Hud {
|
||||
want_grab: true,
|
||||
ingame: true,
|
||||
stats: false,
|
||||
free_look: false,
|
||||
},
|
||||
to_focus: None,
|
||||
never_show: false,
|
||||
@ -1901,6 +1908,22 @@ impl Hud {
|
||||
}
|
||||
}
|
||||
|
||||
// Free look indicator
|
||||
if self.show.free_look {
|
||||
Text::new(&self.voxygen_i18n.get("hud.free_look_indicator"))
|
||||
.color(TEXT_BG)
|
||||
.mid_top_with_margin_on(ui_widgets.window, 100.0)
|
||||
.font_id(self.fonts.cyri.conrod_id)
|
||||
.font_size(self.fonts.cyri.scale(20))
|
||||
.set(self.ids.free_look_bg, ui_widgets);
|
||||
Text::new(&self.voxygen_i18n.get("hud.free_look_indicator"))
|
||||
.color(KILL_COLOR)
|
||||
.top_left_with_margins_on(self.ids.free_look_bg, -1.0, -1.0)
|
||||
.font_id(self.fonts.cyri.conrod_id)
|
||||
.font_size(self.fonts.cyri.scale(20))
|
||||
.set(self.ids.free_look_txt, ui_widgets);
|
||||
}
|
||||
|
||||
events
|
||||
}
|
||||
|
||||
@ -2064,4 +2087,6 @@ impl Hud {
|
||||
self.ui.render(renderer, Some(globals));
|
||||
}
|
||||
}
|
||||
|
||||
pub fn free_look(&mut self, free_look: bool) { self.show.free_look = free_look; }
|
||||
}
|
||||
|
@ -155,6 +155,9 @@ impl PlayState for SessionState {
|
||||
)
|
||||
.unwrap();
|
||||
|
||||
let mut ori = self.scene.camera().get_orientation();
|
||||
let mut free_look = false;
|
||||
|
||||
// Game loop
|
||||
let mut current_client_state = self.client.borrow().get_client_state();
|
||||
while let ClientState::Pending | ClientState::Character = current_client_state {
|
||||
@ -418,6 +421,10 @@ impl PlayState for SessionState {
|
||||
Event::InputUpdate(GameInput::Charge, state) => {
|
||||
self.inputs.charge.set_state(state);
|
||||
},
|
||||
Event::InputUpdate(GameInput::FreeLook, true) => {
|
||||
free_look = !free_look;
|
||||
self.hud.free_look(free_look);
|
||||
},
|
||||
Event::AnalogGameInput(input) => match input {
|
||||
AnalogGameInput::MovementX(v) => {
|
||||
self.key_state.analog_matrix.x = v;
|
||||
@ -437,9 +444,12 @@ impl PlayState for SessionState {
|
||||
}
|
||||
}
|
||||
|
||||
if !free_look {
|
||||
ori = self.scene.camera().get_orientation();
|
||||
self.inputs.look_dir = cam_dir;
|
||||
}
|
||||
// Calculate the movement input vector of the player from the current key
|
||||
// presses and the camera direction.
|
||||
let ori = self.scene.camera().get_orientation();
|
||||
let unit_vecs = (
|
||||
Vec2::new(ori[0].cos(), -ori[0].sin()),
|
||||
Vec2::new(ori[0].sin(), ori[0].cos()),
|
||||
@ -447,8 +457,6 @@ impl PlayState for SessionState {
|
||||
let dir_vec = self.key_state.dir_vec();
|
||||
self.inputs.move_dir = unit_vecs.0 * dir_vec[0] + unit_vecs.1 * dir_vec[1];
|
||||
|
||||
self.inputs.look_dir = cam_dir;
|
||||
|
||||
self.inputs.climb = self.key_state.climb();
|
||||
|
||||
// Runs if either in a multiplayer server or the singleplayer server is unpaused
|
||||
|
@ -53,6 +53,7 @@ pub struct ControlSettings {
|
||||
pub toggle_wield: KeyMouse,
|
||||
pub swap_loadout: KeyMouse,
|
||||
pub charge: KeyMouse,
|
||||
pub free_look: KeyMouse,
|
||||
}
|
||||
|
||||
/// Since Macbook trackpads lack middle click, on OS X we default to LShift
|
||||
@ -105,6 +106,7 @@ impl Default for ControlSettings {
|
||||
toggle_wield: KeyMouse::Key(VirtualKeyCode::T),
|
||||
swap_loadout: KeyMouse::Key(VirtualKeyCode::Q),
|
||||
charge: KeyMouse::Key(VirtualKeyCode::Key1),
|
||||
free_look: KeyMouse::Key(VirtualKeyCode::LAlt),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -51,6 +51,7 @@ pub enum GameInput {
|
||||
ToggleWield,
|
||||
Charge,
|
||||
SwapLoadout,
|
||||
FreeLook,
|
||||
}
|
||||
|
||||
/// Represents a key that the game menus recognise after input mapping
|
||||
@ -466,6 +467,9 @@ impl Window {
|
||||
map.entry(settings.controls.charge)
|
||||
.or_default()
|
||||
.push(GameInput::Charge);
|
||||
map.entry(settings.controls.free_look)
|
||||
.or_default()
|
||||
.push(GameInput::FreeLook);
|
||||
|
||||
let keypress_map = HashMap::new();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user