From 5d5ccd7b992c751d7fb51d553b1d08ba760800c2 Mon Sep 17 00:00:00 2001 From: timokoesters Date: Fri, 23 Aug 2019 12:11:37 +0200 Subject: [PATCH 01/33] Move from state components to single CharaterState struct This makes split animations easy and improves overall code quality --- client/src/lib.rs | 6 +- common/src/assets/mod.rs | 2 +- common/src/comp/action_state.rs | 29 ----- common/src/comp/character_state.rs | 68 ++++++++++ common/src/comp/mod.rs | 12 +- common/src/comp/phys.rs | 10 ++ common/src/event.rs | 17 ++- common/src/msg/server.rs | 4 +- common/src/state.rs | 15 +-- common/src/sys/action_state.rs | 69 ----------- common/src/sys/agent.rs | 13 +- common/src/sys/animation.rs | 54 ++++---- common/src/sys/combat.rs | 63 +++++----- common/src/sys/controller.rs | 132 +++++++++++--------- common/src/sys/mod.rs | 11 +- common/src/sys/movement.rs | 136 +++++++++----------- common/src/sys/phys.rs | 58 +++++---- common/src/sys/stats.rs | 29 +++-- server/src/lib.rs | 193 ++++++++++++++--------------- 19 files changed, 447 insertions(+), 474 deletions(-) delete mode 100644 common/src/comp/action_state.rs create mode 100644 common/src/comp/character_state.rs delete mode 100644 common/src/sys/action_state.rs diff --git a/client/src/lib.rs b/client/src/lib.rs index bb1bbf2873..5f4ca2798d 100644 --- a/client/src/lib.rs +++ b/client/src/lib.rs @@ -444,12 +444,12 @@ impl Client { self.state.write_component(entity, ori); } } - ServerMsg::EntityActionState { + ServerMsg::EntityCharacterState { entity, - action_state, + character_state, } => { if let Some(entity) = self.state.ecs().entity_from_uid(entity) { - self.state.write_component(entity, action_state); + self.state.write_component(entity, character_state); } } ServerMsg::InventoryUpdate(inventory) => { diff --git a/common/src/assets/mod.rs b/common/src/assets/mod.rs index 9f34be133a..2aa0e04fdb 100644 --- a/common/src/assets/mod.rs +++ b/common/src/assets/mod.rs @@ -188,8 +188,8 @@ impl Asset for String { } } -/// Lazy static to find and cache where the asset directory is. lazy_static! { + /// Lazy static to find and cache where the asset directory is. static ref ASSETS_PATH: PathBuf = { let mut paths = Vec::new(); diff --git a/common/src/comp/action_state.rs b/common/src/comp/action_state.rs deleted file mode 100644 index d638318538..0000000000 --- a/common/src/comp/action_state.rs +++ /dev/null @@ -1,29 +0,0 @@ -use specs::{Component, FlaggedStorage, HashMapStorage}; -use specs_idvs::IDVStorage; - -#[derive(Clone, Copy, Debug, PartialEq, Serialize, Deserialize)] -pub struct ActionState { - pub moving: bool, - pub on_ground: bool, - pub attacking: bool, - pub rolling: bool, - pub gliding: bool, - pub wielding: bool, -} - -impl Default for ActionState { - fn default() -> Self { - Self { - moving: false, - on_ground: false, - attacking: false, - rolling: false, - gliding: false, - wielding: false, - } - } -} - -impl Component for ActionState { - type Storage = FlaggedStorage>; -} diff --git a/common/src/comp/character_state.rs b/common/src/comp/character_state.rs new file mode 100644 index 0000000000..a7cffd1724 --- /dev/null +++ b/common/src/comp/character_state.rs @@ -0,0 +1,68 @@ +use specs::{Component, FlaggedStorage, HashMapStorage}; +use specs_idvs::IDVStorage; +use std::time::Duration; + +#[derive(Clone, Copy, Debug, PartialEq, Serialize, Deserialize)] +pub enum MovementState { + Stand, + Run, + Jump, + Glide, + Roll { time_left: Duration }, + //Swim, +} + +impl MovementState { + pub fn is_roll(&self) -> bool { + if let Self::Roll { .. } = self { + true + } else { + false + } + } +} + +#[derive(Clone, Copy, Debug, PartialEq, Serialize, Deserialize)] +pub enum ActionState { + Idle, + Wield { time_left: Duration }, + Attack { time_left: Duration, applied: bool }, + //Carry, +} + +impl ActionState { + pub fn is_wield(&self) -> bool { + if let Self::Wield { .. } = self { + true + } else { + false + } + } + + pub fn is_attack(&self) -> bool { + if let Self::Attack { .. } = self { + true + } else { + false + } + } +} + +#[derive(Clone, Copy, Debug, PartialEq, Serialize, Deserialize)] +pub struct CharacterState { + pub movement: MovementState, + pub action: ActionState, +} + +impl Default for CharacterState { + fn default() -> Self { + Self { + movement: MovementState::Jump, + action: ActionState::Idle, + } + } +} + +impl Component for CharacterState { + type Storage = FlaggedStorage>; +} diff --git a/common/src/comp/mod.rs b/common/src/comp/mod.rs index da82ee09af..22b9d4c52e 100644 --- a/common/src/comp/mod.rs +++ b/common/src/comp/mod.rs @@ -1,8 +1,8 @@ -mod action_state; mod admin; mod agent; mod animation; mod body; +mod character_state; mod controller; mod inputs; mod inventory; @@ -13,18 +13,16 @@ mod stats; mod visual; // Reexports -pub use action_state::ActionState; pub use admin::Admin; pub use agent::Agent; pub use animation::{Animation, AnimationInfo}; pub use body::{humanoid, object, quadruped, quadruped_medium, Body}; +pub use character_state::{ActionState, CharacterState, MovementState}; pub use controller::Controller; -pub use inputs::{ - Attacking, CanBuild, Gliding, Jumping, MoveDir, OnGround, Respawning, Rolling, Wielding, -}; +pub use inputs::CanBuild; pub use inventory::{item, Inventory, InventoryUpdate, Item}; pub use last::Last; -pub use phys::{ForceUpdate, Ori, Pos, Scale, Vel}; +pub use phys::{ForceUpdate, Ori, PhysicsState, Pos, Scale, Vel}; pub use player::Player; -pub use stats::{Dying, Exp, HealthSource, Level, Stats}; +pub use stats::{Exp, HealthSource, Level, Stats}; pub use visual::LightEmitter; diff --git a/common/src/comp/phys.rs b/common/src/comp/phys.rs index 5c7732886e..f8787a633a 100644 --- a/common/src/comp/phys.rs +++ b/common/src/comp/phys.rs @@ -34,6 +34,16 @@ impl Component for Scale { type Storage = FlaggedStorage>; } +// PhysicsState +#[derive(Copy, Clone, Default, Debug, PartialEq, Serialize, Deserialize)] +pub struct PhysicsState { + pub on_ground: bool, +} + +impl Component for PhysicsState { + type Storage = FlaggedStorage>; +} + // ForceUpdate #[derive(Copy, Clone, Debug, Default, PartialEq, Serialize, Deserialize)] pub struct ForceUpdate; diff --git a/common/src/event.rs b/common/src/event.rs index 464610d921..acaac6cf48 100644 --- a/common/src/event.rs +++ b/common/src/event.rs @@ -1,11 +1,24 @@ +use crate::comp; use parking_lot::Mutex; use specs::Entity as EcsEntity; use std::{collections::VecDeque, ops::DerefMut}; use vek::*; pub enum Event { - LandOnGround { entity: EcsEntity, vel: Vec3 }, - Explosion { pos: Vec3, radius: f32 }, + LandOnGround { + entity: EcsEntity, + vel: Vec3, + }, + Explosion { + pos: Vec3, + radius: f32, + }, + Die { + entity: EcsEntity, + cause: comp::HealthSource, + }, + Jump(EcsEntity), + Respawn(EcsEntity), } #[derive(Default)] diff --git a/common/src/msg/server.rs b/common/src/msg/server.rs index 6dbf86234c..5b12429a2a 100644 --- a/common/src/msg/server.rs +++ b/common/src/msg/server.rs @@ -51,9 +51,9 @@ pub enum ServerMsg { entity: u64, ori: comp::Ori, }, - EntityActionState { + EntityCharacterState { entity: u64, - action_state: comp::ActionState, + character_state: comp::CharacterState, }, InventoryUpdate(comp::Inventory), TerrainChunkUpdate { diff --git a/common/src/state.rs b/common/src/state.rs index c73a3602b6..cb89aff217 100644 --- a/common/src/state.rs +++ b/common/src/state.rs @@ -122,7 +122,8 @@ impl State { ecs.register::(); // Register components send directly from server -> all but one client - ecs.register::(); + ecs.register::(); + ecs.register::(); // Register components synced from client -> server -> all other clients ecs.register::(); @@ -132,27 +133,17 @@ impl State { // Register client-local components ecs.register::(); - ecs.register::(); // Register server-local components ecs.register::>(); ecs.register::>(); ecs.register::>(); - ecs.register::>(); + ecs.register::>(); ecs.register::(); - ecs.register::(); - ecs.register::(); ecs.register::(); ecs.register::(); ecs.register::(); ecs.register::(); - // Controller effects - ecs.register::(); - ecs.register::(); - ecs.register::(); - ecs.register::(); - ecs.register::(); - ecs.register::(); // Register synced resources used by the ECS. ecs.add_resource_synced(TimeOfDay(0.0)); diff --git a/common/src/sys/action_state.rs b/common/src/sys/action_state.rs deleted file mode 100644 index fd8d1ee11a..0000000000 --- a/common/src/sys/action_state.rs +++ /dev/null @@ -1,69 +0,0 @@ -use crate::{ - comp::{ActionState, Attacking, Controller, Gliding, OnGround, Rolling, Vel, Wielding}, - sys::movement::MOVEMENT_THRESHOLD_VEL, -}; -use specs::{Entities, Join, ReadStorage, System, WriteStorage}; - -/// This system will set the ActionState component as specified by other components -pub struct Sys; -impl<'a> System<'a> for Sys { - type SystemData = ( - Entities<'a>, - ReadStorage<'a, Controller>, - ReadStorage<'a, Vel>, - ReadStorage<'a, OnGround>, - ReadStorage<'a, Gliding>, - ReadStorage<'a, Attacking>, - ReadStorage<'a, Wielding>, - ReadStorage<'a, Rolling>, - WriteStorage<'a, ActionState>, - ); - - fn run( - &mut self, - ( - entities, - controllers, // To make sure it only runs on the single client and the server - velocities, - on_grounds, - glidings, - attackings, - wieldings, - rollings, - mut action_states, - ): Self::SystemData, - ) { - for ( - _entity, - vel, - _controller, - on_ground, - gliding, - attacking, - wielding, - rolling, - action_state, - ) in ( - &entities, - &velocities, - &controllers, - on_grounds.maybe(), - glidings.maybe(), - attackings.maybe(), - wieldings.maybe(), - rollings.maybe(), - &mut action_states, - ) - .join() - { - *action_state = ActionState { - on_ground: on_ground.is_some(), - moving: vel.0.magnitude_squared() > MOVEMENT_THRESHOLD_VEL.powf(2.0), - attacking: attacking.is_some(), - wielding: wielding.is_some(), - rolling: rolling.is_some(), - gliding: gliding.is_some(), - }; - } - } -} diff --git a/common/src/sys/agent.rs b/common/src/sys/agent.rs index 4a1c3d9d4e..1ce71eee45 100644 --- a/common/src/sys/agent.rs +++ b/common/src/sys/agent.rs @@ -1,4 +1,4 @@ -use crate::comp::{ActionState, Agent, Controller, Pos, Stats}; +use crate::comp::{Agent, CharacterState, Controller, MovementState::Glide, Pos, Stats}; use rand::{seq::SliceRandom, thread_rng}; use specs::{Entities, Join, ReadStorage, System, WriteStorage}; use vek::*; @@ -10,14 +10,14 @@ impl<'a> System<'a> for Sys { Entities<'a>, ReadStorage<'a, Pos>, ReadStorage<'a, Stats>, - ReadStorage<'a, ActionState>, + ReadStorage<'a, CharacterState>, WriteStorage<'a, Agent>, WriteStorage<'a, Controller>, ); fn run( &mut self, - (entities, positions, stats, action_states, mut agents, mut controllers): Self::SystemData, + (entities, positions, stats, character_states, mut agents, mut controllers): Self::SystemData, ) { for (entity, pos, agent, controller) in (&entities, &positions, &mut agents, &mut controllers).join() @@ -67,12 +67,12 @@ impl<'a> System<'a> for Sys { const SIGHT_DIST: f32 = 30.0; let mut choose_new = false; - if let Some((Some(target_pos), Some(target_stats), Some(a))) = + if let Some((Some(target_pos), Some(target_stats), Some(target_character))) = target.map(|target| { ( positions.get(target), stats.get(target), - action_states.get(target), + character_states.get(target), ) }) { @@ -97,7 +97,8 @@ impl<'a> System<'a> for Sys { controller.roll = true; } - if a.gliding && target_pos.0.z > pos.0.z + 5.0 { + if target_character.movement == Glide && target_pos.0.z > pos.0.z + 5.0 + { controller.glide = true; controller.jump = true; } diff --git a/common/src/sys/animation.rs b/common/src/sys/animation.rs index d03938668f..35f56bacaa 100644 --- a/common/src/sys/animation.rs +++ b/common/src/sys/animation.rs @@ -1,8 +1,11 @@ use crate::{ - comp::{ActionState, Animation, AnimationInfo}, + comp::{ + ActionState::*, Animation, AnimationInfo, CharacterState, MovementState::*, PhysicsState, + }, state::DeltaTime, }; use specs::{Entities, Join, Read, ReadStorage, System, WriteStorage}; +use std::fmt::Debug; /// This system will apply the animation that fits best to the users actions pub struct Sys; @@ -10,37 +13,32 @@ impl<'a> System<'a> for Sys { type SystemData = ( Entities<'a>, Read<'a, DeltaTime>, - ReadStorage<'a, ActionState>, + ReadStorage<'a, CharacterState>, + ReadStorage<'a, PhysicsState>, WriteStorage<'a, AnimationInfo>, ); - fn run(&mut self, (entities, dt, action_states, mut animation_infos): Self::SystemData) { - for (entity, a) in (&entities, &action_states).join() { - fn impossible_animation(message: &str) -> Animation { - warn!("{}", message); - Animation::Idle + fn run( + &mut self, + (entities, dt, character_states, physics_states, mut animation_infos): Self::SystemData, + ) { + for (entity, character, physics) in (&entities, &character_states, &physics_states).join() { + fn impossible_animation(physics: PhysicsState, character: CharacterState) -> Animation { + warn!("Impossible animation: {:?} {:?}", physics, character); + Animation::Roll } - let animation = match ( - a.on_ground, - a.moving, - a.attacking, - a.gliding, - a.rolling, - a.wielding, - ) { - (_, _, true, true, _, _) => impossible_animation("Attack while gliding"), - (_, _, true, _, true, _) => impossible_animation("Roll while attacking"), - (_, _, _, true, true, _) => impossible_animation("Roll while gliding"), - (_, false, _, _, true, _) => impossible_animation("Roll without moving"), - (_, true, false, false, true, _) => Animation::Roll, - (true, false, false, false, false, false) => Animation::Idle, - (true, true, false, false, false, false) => Animation::Run, - (false, _, false, false, false, false) => Animation::Jump, - (true, false, false, false, false, true) => Animation::Cidle, - (true, true, false, false, false, true) => Animation::Crun, - (false, _, false, false, false, true) => Animation::Cjump, - (_, _, false, true, false, _) => Animation::Gliding, - (_, _, true, false, false, _) => Animation::Attack, + + let animation = match (physics.on_ground, &character.movement, &character.action) { + (_, Roll { .. }, Idle) => Animation::Roll, + (true, Stand, Idle) => Animation::Idle, + (true, Run, Idle) => Animation::Run, + (false, Jump, Idle) => Animation::Jump, + (true, Stand, Wield { .. }) => Animation::Cidle, + (true, Run, Wield { .. }) => Animation::Crun, + (false, Jump, Wield { .. }) => Animation::Cjump, + (_, Glide, Idle) => Animation::Gliding, + (_, _, Attack { .. }) => Animation::Attack, + _ => impossible_animation(physics.clone(), character.clone()), }; let new_time = animation_infos diff --git a/common/src/sys/combat.rs b/common/src/sys/combat.rs index ba0e8a8e37..6181854063 100644 --- a/common/src/sys/combat.rs +++ b/common/src/sys/combat.rs @@ -1,8 +1,9 @@ use crate::{ - comp::{Attacking, ForceUpdate, HealthSource, Ori, Pos, Stats, Vel, Wielding}, + comp::{ActionState::*, CharacterState, ForceUpdate, HealthSource, Ori, Pos, Stats, Vel}, state::{DeltaTime, Uid}, }; use specs::{Entities, Join, Read, ReadStorage, System, WriteStorage}; +use std::time::Duration; /// This system is responsible for handling accepted inputs like moving or attacking pub struct Sys; @@ -14,8 +15,7 @@ impl<'a> System<'a> for Sys { ReadStorage<'a, Pos>, ReadStorage<'a, Ori>, WriteStorage<'a, Vel>, - WriteStorage<'a, Attacking>, - WriteStorage<'a, Wielding>, + WriteStorage<'a, CharacterState>, WriteStorage<'a, Stats>, WriteStorage<'a, ForceUpdate>, ); @@ -29,18 +29,26 @@ impl<'a> System<'a> for Sys { positions, orientations, mut velocities, - mut attackings, - mut wieldings, + mut character_states, mut stats, mut force_updates, ): Self::SystemData, ) { // Attacks - (&entities, &uids, &positions, &orientations, &mut attackings) + for (entity, uid, pos, ori, mut character) in ( + &entities, + &uids, + &positions, + &orientations, + &mut character_states, + ) .join() - .filter_map(|(entity, uid, pos, ori, mut attacking)| { - if !attacking.applied { - // Go through all other entities + { + let mut todo_end = false; + + // Go through all other entities + if let Attack { time_left, applied } = &mut character.action { + if !*applied { for (b, pos_b, mut vel_b, stat_b) in (&entities, &positions, &mut velocities, &mut stats).join() { @@ -59,29 +67,28 @@ impl<'a> System<'a> for Sys { let _ = force_updates.insert(b, ForceUpdate); } } - attacking.applied = true; + *applied = true; } - if attacking.time > 0.5 { - Some(entity) + if *time_left == Duration::default() { + todo_end = true; } else { - attacking.time += dt.0; - - None + *time_left = time_left + .checked_sub(Duration::from_secs_f32(dt.0)) + .unwrap_or_default(); } - }) - .collect::>() - .into_iter() - .for_each(|e| { - attackings.remove(e); - }); - { - // Wields - for wielding in (&mut wieldings).join() { - if !wielding.applied && wielding.time > 0.3 { - wielding.applied = true; - } else { - wielding.time += dt.0; + } + if todo_end { + character.action = Wield { + time_left: Duration::default(), + }; + } + + if let Wield { time_left } = &mut character.action { + if *time_left != Duration::default() { + *time_left = time_left + .checked_sub(Duration::from_secs_f32(dt.0)) + .unwrap_or_default(); } } } diff --git a/common/src/sys/controller.rs b/common/src/sys/controller.rs index a32ba98af8..fb663e4895 100644 --- a/common/src/sys/controller.rs +++ b/common/src/sys/controller.rs @@ -1,125 +1,135 @@ -use crate::comp::{ - ActionState, Attacking, Body, Controller, Gliding, Jumping, MoveDir, Respawning, Rolling, - Stats, Vel, Wielding, +use crate::{ + comp::{ + ActionState::*, Body, CharacterState, Controller, MovementState::*, PhysicsState, Stats, + Vel, + }, + event::{Event, EventBus}, }; -use specs::{Entities, Join, ReadStorage, System, WriteStorage}; +use specs::{Entities, Join, Read, ReadStorage, System, WriteStorage}; +use std::time::Duration; /// This system is responsible for validating controller inputs pub struct Sys; impl<'a> System<'a> for Sys { type SystemData = ( Entities<'a>, + Read<'a, EventBus>, WriteStorage<'a, Controller>, ReadStorage<'a, Stats>, ReadStorage<'a, Body>, ReadStorage<'a, Vel>, - WriteStorage<'a, ActionState>, - WriteStorage<'a, MoveDir>, - WriteStorage<'a, Jumping>, - WriteStorage<'a, Attacking>, - WriteStorage<'a, Wielding>, - WriteStorage<'a, Rolling>, - WriteStorage<'a, Respawning>, - WriteStorage<'a, Gliding>, + ReadStorage<'a, PhysicsState>, + WriteStorage<'a, CharacterState>, ); fn run( &mut self, ( entities, + event_bus, mut controllers, stats, bodies, velocities, - mut action_states, - mut move_dirs, - mut jumpings, - mut attackings, - mut wieldings, - mut rollings, - mut respawns, - mut glidings, + physics_states, + mut character_states, ): Self::SystemData, ) { - for (entity, controller, stats, body, vel, mut a) in ( + let mut event_emitter = event_bus.emitter(); + + for (entity, controller, stats, body, vel, physics, mut character) in ( &entities, &mut controllers, &stats, &bodies, &velocities, - // Although this is changed, it is only kept for this system - // as it will be replaced in the action state system - &mut action_states, + &physics_states, + &mut character_states, ) .join() { if stats.is_dead { // Respawn if controller.respawn { - let _ = respawns.insert(entity, Respawning); + event_emitter.emit(Event::Respawn(entity)); } continue; } - // Move dir - if !a.rolling { - let _ = move_dirs.insert( - entity, - MoveDir(if controller.move_dir.magnitude_squared() > 1.0 { - controller.move_dir.normalized() - } else { - controller.move_dir - }), - ); + // Move + controller.move_dir = if controller.move_dir.magnitude_squared() > 1.0 { + controller.move_dir.normalized() + } else { + controller.move_dir + }; + + if character.movement == Stand && controller.move_dir.magnitude_squared() > 0.0 { + character.movement = Run; + } else if character.movement == Run && controller.move_dir.magnitude_squared() == 0.0 { + character.movement = Stand; } // Glide - if controller.glide && !a.on_ground && !a.attacking && !a.rolling && body.is_humanoid() + if controller.glide + && !physics.on_ground + && (character.action == Idle || character.action.is_wield()) + && character.movement == Jump + // TODO: Ask zesterer if we can remove this + && body.is_humanoid() { - let _ = glidings.insert(entity, Gliding); - a.gliding = true; - } else { - let _ = glidings.remove(entity); - a.gliding = false; + character.movement = Glide; + } else if !controller.glide && character.movement == Glide { + character.movement = Jump; } // Wield - if controller.attack && !a.wielding && !a.gliding && !a.rolling { - let _ = wieldings.insert(entity, Wielding::start()); - a.wielding = true; + if controller.attack + && character.action == Idle + && (character.movement == Stand || character.movement == Run) + { + character.action = Wield { + time_left: Duration::from_millis(300), + }; } // Attack if controller.attack - && !a.attacking - && wieldings.get(entity).map(|w| w.applied).unwrap_or(false) - && !a.gliding - && !a.rolling + && (character.movement == Stand + || character.movement == Run + || character.movement == Jump) { - let _ = attackings.insert(entity, Attacking::start()); - a.attacking = true; + // TODO: Check if wield ability exists + if let Wield { time_left } = character.action { + if time_left == Duration::default() { + character.action = Attack { + time_left: Duration::from_millis(300), + applied: false, + }; + } + } } // Roll if controller.roll - && !a.rolling - && a.on_ground - && a.moving - && !a.attacking - && !a.gliding + && (character.action == Idle || character.action.is_wield()) + && character.movement == Run + && physics.on_ground { - let _ = rollings.insert(entity, Rolling::start()); - a.rolling = true; + character.movement = Roll { + time_left: Duration::from_millis(600), + }; } // Jump - if controller.jump && a.on_ground && vel.0.z <= 0.0 { - let _ = jumpings.insert(entity, Jumping); - a.on_ground = false; + if controller.jump && physics.on_ground && vel.0.z <= 0.0 { + dbg!(); + event_emitter.emit(Event::Jump(entity)); } + // TODO before merge: reset controller in a final ecs system + // Reset the controller ready for the next tick - *controller = Controller::default(); + //*controller = Controller::default(); } } } diff --git a/common/src/sys/mod.rs b/common/src/sys/mod.rs index 7664b4af8a..dc6be61e98 100644 --- a/common/src/sys/mod.rs +++ b/common/src/sys/mod.rs @@ -1,4 +1,3 @@ -mod action_state; pub mod agent; pub mod animation; pub mod combat; @@ -13,7 +12,6 @@ use specs::DispatcherBuilder; // System names const AGENT_SYS: &str = "agent_sys"; const CONTROLLER_SYS: &str = "controller_sys"; -const ACTION_STATE_SYS: &str = "action_state_sys"; const PHYS_SYS: &str = "phys_sys"; const MOVEMENT_SYS: &str = "movement_sys"; const COMBAT_SYS: &str = "combat_sys"; @@ -25,12 +23,7 @@ pub fn add_local_systems(dispatch_builder: &mut DispatcherBuilder) { dispatch_builder.add(controller::Sys, CONTROLLER_SYS, &[AGENT_SYS]); dispatch_builder.add(phys::Sys, PHYS_SYS, &[CONTROLLER_SYS]); dispatch_builder.add(movement::Sys, MOVEMENT_SYS, &[PHYS_SYS]); - dispatch_builder.add( - action_state::Sys, - ACTION_STATE_SYS, - &[CONTROLLER_SYS, PHYS_SYS], - ); - dispatch_builder.add(combat::Sys, COMBAT_SYS, &[ACTION_STATE_SYS]); - dispatch_builder.add(animation::Sys, ANIMATION_SYS, &[ACTION_STATE_SYS]); + dispatch_builder.add(combat::Sys, COMBAT_SYS, &[CONTROLLER_SYS]); + dispatch_builder.add(animation::Sys, ANIMATION_SYS, &[CONTROLLER_SYS]); dispatch_builder.add(stats::Sys, STATS_SYS, &[COMBAT_SYS]); } diff --git a/common/src/sys/movement.rs b/common/src/sys/movement.rs index 5fadb37a4c..f7c11e2862 100644 --- a/common/src/sys/movement.rs +++ b/common/src/sys/movement.rs @@ -1,10 +1,14 @@ use crate::{ - comp::{ActionState, Jumping, MoveDir, OnGround, Ori, Pos, Rolling, Stats, Vel, Wielding}, + comp::{ + ActionState::*, CharacterState, Controller, MovementState::*, Ori, PhysicsState, Pos, + Stats, Vel, + }, state::DeltaTime, terrain::TerrainMap, vol::{ReadVol, Vox}, }; use specs::{Entities, Join, Read, ReadExpect, ReadStorage, System, WriteStorage}; +use std::time::Duration; use vek::*; const HUMANOID_ACCEL: f32 = 70.0; @@ -13,7 +17,6 @@ const WIELD_ACCEL: f32 = 70.0; const WIELD_SPEED: f32 = 120.0; const HUMANOID_AIR_ACCEL: f32 = 10.0; const HUMANOID_AIR_SPEED: f32 = 100.0; -const HUMANOID_JUMP_ACCEL: f32 = 18.0; const ROLL_ACCEL: f32 = 160.0; const ROLL_SPEED: f32 = 550.0; const GLIDE_ACCEL: f32 = 15.0; @@ -30,13 +33,10 @@ impl<'a> System<'a> for Sys { Entities<'a>, ReadExpect<'a, TerrainMap>, Read<'a, DeltaTime>, - ReadStorage<'a, MoveDir>, ReadStorage<'a, Stats>, - ReadStorage<'a, ActionState>, - WriteStorage<'a, Jumping>, - WriteStorage<'a, Wielding>, - WriteStorage<'a, Rolling>, - WriteStorage<'a, OnGround>, + ReadStorage<'a, Controller>, + ReadStorage<'a, PhysicsState>, + WriteStorage<'a, CharacterState>, WriteStorage<'a, Pos>, WriteStorage<'a, Vel>, WriteStorage<'a, Ori>, @@ -48,105 +48,87 @@ impl<'a> System<'a> for Sys { entities, terrain, dt, - move_dirs, stats, - action_states, - mut jumpings, - mut wieldings, - mut rollings, - mut on_grounds, + controllers, + physics_states, + mut character_states, mut positions, mut velocities, mut orientations, ): Self::SystemData, ) { // Apply movement inputs - for (entity, stats, a, move_dir, mut pos, mut vel, mut ori) in ( + for (entity, stats, controller, physics, mut character, mut pos, mut vel, mut ori) in ( &entities, &stats, - &action_states, - move_dirs.maybe(), + &controllers, + &physics_states, + &mut character_states, &mut positions, &mut velocities, &mut orientations, ) .join() { - // Disable while dead TODO: Replace with client states? if stats.is_dead { continue; } // Move player according to move_dir - if let Some(move_dir) = move_dir { - vel.0 += Vec2::broadcast(dt.0) - * move_dir.0 - * match (a.on_ground, a.gliding, a.rolling, a.wielding) { - (true, false, false, false) - if vel.0.magnitude_squared() < HUMANOID_SPEED.powf(2.0) => - { - HUMANOID_ACCEL - } - (false, true, false, false) - if vel.0.magnitude_squared() < GLIDE_SPEED.powf(2.0) => - { - GLIDE_ACCEL - } - (false, false, false, false) - if vel.0.magnitude_squared() < HUMANOID_AIR_SPEED.powf(2.0) => - { - HUMANOID_AIR_ACCEL - } - (true, false, true, _) - if vel.0.magnitude_squared() < ROLL_SPEED.powf(2.0) => - { - ROLL_ACCEL - } - (true, false, false, true) - if vel.0.magnitude_squared() < WIELD_SPEED.powf(2.0) => - { - WIELD_ACCEL - } - _ => 0.0, - }; - - // Set direction based on move direction when on the ground - let ori_dir = if a.gliding || a.rolling { - Vec2::from(vel.0) - } else { - move_dir.0 + vel.0 += Vec2::broadcast(dt.0) + * controller.move_dir + * match (physics.on_ground, &character.movement) { + (true, Run) if vel.0.magnitude_squared() < HUMANOID_SPEED.powf(2.0) => { + HUMANOID_ACCEL + } + (false, Glide) if vel.0.magnitude_squared() < GLIDE_SPEED.powf(2.0) => { + GLIDE_ACCEL + } + (false, Jump) if vel.0.magnitude_squared() < HUMANOID_AIR_SPEED.powf(2.0) => { + HUMANOID_AIR_ACCEL + } + (true, Roll { .. }) if vel.0.magnitude_squared() < ROLL_SPEED.powf(2.0) => { + ROLL_ACCEL + } + _ => 0.0, }; - if ori_dir.magnitude_squared() > 0.0001 - && (ori.0.normalized() - Vec3::from(ori_dir).normalized()).magnitude_squared() - > 0.001 - { - ori.0 = vek::ops::Slerp::slerp( - ori.0, - ori_dir.into(), - if a.on_ground { 12.0 } else { 2.0 } * dt.0, - ); - } - } - // Jump - if jumpings.get(entity).is_some() { - vel.0.z = HUMANOID_JUMP_ACCEL; - jumpings.remove(entity); + // Set direction based on move direction when on the ground + let ori_dir = if character.movement == Glide || character.movement.is_roll() { + Vec2::from(vel.0) + } else { + controller.move_dir + }; + if ori_dir.magnitude_squared() > 0.0001 + && (ori.0.normalized() - Vec3::from(ori_dir).normalized()).magnitude_squared() + > 0.001 + { + ori.0 = vek::ops::Slerp::slerp( + ori.0, + ori_dir.into(), + if physics.on_ground { 12.0 } else { 2.0 } * dt.0, + ); } // Glide - if a.gliding && vel.0.magnitude_squared() < GLIDE_SPEED.powf(2.0) && vel.0.z < 0.0 { - let _ = wieldings.remove(entity); + if character.movement == Glide + && vel.0.magnitude_squared() < GLIDE_SPEED.powf(2.0) + && vel.0.z < 0.0 + { + character.action = Idle; let lift = GLIDE_ANTIGRAV + vel.0.z.powf(2.0) * 0.2; vel.0.z += dt.0 * lift * Vec2::::from(vel.0 * 0.15).magnitude().min(1.0); } // Roll - if let Some(time) = rollings.get_mut(entity).map(|r| &mut r.time) { - let _ = wieldings.remove(entity); - *time += dt.0; - if *time > 0.6 || !a.moving { - rollings.remove(entity); + if let Roll { time_left } = &mut character.movement { + character.action = Idle; + if *time_left == Duration::default() || vel.0.magnitude_squared() < 10.0 { + character.movement = Run; + } else { + *time_left = time_left + .checked_sub(Duration::from_secs_f32(dt.0)) + .unwrap_or_default(); } } } diff --git a/common/src/sys/phys.rs b/common/src/sys/phys.rs index a60a78ca39..352404fb69 100644 --- a/common/src/sys/phys.rs +++ b/common/src/sys/phys.rs @@ -1,16 +1,14 @@ -use crate::{ - comp::HealthSource, - comp::{ - ActionState, Body, Jumping, MoveDir, OnGround, Ori, Pos, Rolling, Scale, Stats, Vel, - Wielding, +use { + crate::{ + comp::{Body, CharacterState, MovementState::*, Ori, PhysicsState, Pos, Scale, Stats, Vel}, + event::{Event, EventBus}, + state::DeltaTime, + terrain::TerrainMap, + vol::{ReadVol, Vox}, }, - event::{Event, EventBus}, - state::DeltaTime, - terrain::TerrainMap, - vol::{ReadVol, Vox}, + specs::{Entities, Join, Read, ReadExpect, ReadStorage, System, WriteStorage}, + vek::*, }; -use specs::{Entities, Join, Read, ReadExpect, ReadStorage, System, WriteStorage}; -use vek::*; const GRAVITY: f32 = 9.81 * 4.0; const FRIC_GROUND: f32 = 0.15; @@ -37,10 +35,10 @@ impl<'a> System<'a> for Sys { ReadExpect<'a, TerrainMap>, Read<'a, DeltaTime>, Read<'a, EventBus>, - ReadStorage<'a, ActionState>, ReadStorage<'a, Scale>, ReadStorage<'a, Body>, - WriteStorage<'a, OnGround>, + WriteStorage<'a, CharacterState>, + WriteStorage<'a, PhysicsState>, WriteStorage<'a, Pos>, WriteStorage<'a, Vel>, WriteStorage<'a, Ori>, @@ -53,10 +51,10 @@ impl<'a> System<'a> for Sys { terrain, dt, event_bus, - action_states, scales, bodies, - mut on_grounds, + mut character_states, + mut physics_states, mut positions, mut velocities, mut orientations, @@ -65,9 +63,8 @@ impl<'a> System<'a> for Sys { let mut event_emitter = event_bus.emitter(); // Apply movement inputs - for (entity, a, scale, b, mut pos, mut vel, mut ori) in ( + for (entity, scale, b, mut pos, mut vel, mut ori) in ( &entities, - &action_states, scales.maybe(), &bodies, &mut positions, @@ -76,12 +73,14 @@ impl<'a> System<'a> for Sys { ) .join() { + let mut character_state = character_states.get(entity).cloned().unwrap_or_default(); + let mut physics_state = physics_states.get(entity).cloned().unwrap_or_default(); let scale = scale.map(|s| s.0).unwrap_or(1.0); // Integrate forces // Friction is assumed to be a constant dependent on location let friction = 50.0 - * if on_grounds.get(entity).is_some() { + * if physics_state.on_ground { FRIC_GROUND } else { FRIC_AIR @@ -108,7 +107,7 @@ impl<'a> System<'a> for Sys { if terrain .get(block_pos) - .map(|vox| vox.is_solid()) + .map(|vox| !vox.is_empty()) .unwrap_or(false) { let player_aabb = Aabb { @@ -128,8 +127,8 @@ impl<'a> System<'a> for Sys { false }; - let was_on_ground = a.on_ground; - on_grounds.remove(entity); // Assume we're in the air - unless we can prove otherwise + let was_on_ground = physics_state.on_ground; + physics_state.on_ground = false; let mut on_ground = false; let mut attempts = 0; // Don't loop infinitely here @@ -183,7 +182,7 @@ impl<'a> System<'a> for Sys { .filter(|(block_pos, _)| { terrain .get(*block_pos) - .map(|vox| vox.is_solid()) + .map(|vox| !vox.is_empty()) .unwrap_or(false) }) // Find the maximum of the minimum collision axes (this bit is weird, trust me that it works) @@ -216,6 +215,7 @@ impl<'a> System<'a> for Sys { if !was_on_ground { event_emitter.emit(Event::LandOnGround { entity, vel: vel.0 }); + character_state.movement = Stand; } } @@ -257,13 +257,16 @@ impl<'a> System<'a> for Sys { if attempts == MAX_ATTEMPTS { pos.0 = old_pos; - vel.0 = Vec3::zero(); break; } } if on_ground { - let _ = on_grounds.insert(entity, OnGround); + physics_state.on_ground = true; + + if !was_on_ground { + character_state.movement = Stand; + } // If the space below us is free, then "snap" to the ground } else if collision_with(pos.0 - Vec3::unit_z() * 1.05, near_iter.clone()) && vel.0.z < 0.0 @@ -271,8 +274,13 @@ impl<'a> System<'a> for Sys { && was_on_ground { pos.0.z = (pos.0.z - 0.05).floor(); - let _ = on_grounds.insert(entity, OnGround); + physics_state.on_ground = true; + } else if was_on_ground { + character_state.movement = Jump; } + + let _ = character_states.insert(entity, character_state); + let _ = physics_states.insert(entity, physics_state); } // Apply pushback diff --git a/common/src/sys/stats.rs b/common/src/sys/stats.rs index 270ddf7860..1ebd322a2c 100644 --- a/common/src/sys/stats.rs +++ b/common/src/sys/stats.rs @@ -1,5 +1,6 @@ use crate::{ - comp::{Dying, HealthSource, Stats}, + comp::{HealthSource, Stats}, + event::{Event, EventBus}, state::DeltaTime, }; use log::warn; @@ -11,27 +12,29 @@ impl<'a> System<'a> for Sys { type SystemData = ( Entities<'a>, Read<'a, DeltaTime>, + Read<'a, EventBus>, WriteStorage<'a, Stats>, - WriteStorage<'a, Dying>, ); - fn run(&mut self, (entities, dt, mut stats, mut dyings): Self::SystemData) { + fn run(&mut self, (entities, dt, event_bus, mut stats): Self::SystemData) { + let mut event_emitter = event_bus.emitter(); + for (entity, mut stat) in (&entities, &mut stats).join() { if stat.should_die() && !stat.is_dead { - let _ = dyings.insert( + event_emitter.emit(Event::Die { entity, - Dying { - cause: match stat.health.last_change { - Some(change) => change.2, - None => { - warn!("Nothing caused an entity to die!"); - HealthSource::Unknown - } - }, + cause: match stat.health.last_change { + Some(change) => change.2, + None => { + warn!("Nothing caused an entity to die!"); + HealthSource::Unknown + } }, - ); + }); + stat.is_dead = true; } + if let Some(change) = &mut stat.health.last_change { change.1 += f64::from(dt.0); } diff --git a/server/src/lib.rs b/server/src/lib.rs index 1a1db64ab9..5e71695c89 100644 --- a/server/src/lib.rs +++ b/server/src/lib.rs @@ -37,6 +37,7 @@ use vek::*; use world::{ChunkSupplement, World}; const CLIENT_TIMEOUT: f64 = 20.0; // Seconds +const HUMANOID_JUMP_ACCEL: f32 = 18.0; pub enum Event { ClientConnected { @@ -153,8 +154,7 @@ impl Server { .with(comp::Controller::default()) .with(body) .with(comp::Stats::new(name)) - .with(comp::ActionState::default()) - .with(comp::ForceUpdate) + .with(comp::CharacterState::default()) } /// Build a static object entity @@ -175,8 +175,7 @@ impl Server { ..comp::LightEmitter::default() }) //.with(comp::LightEmitter::default()) - .with(comp::ActionState::default()) - .with(comp::ForceUpdate) + .with(comp::CharacterState::default()) } pub fn create_player_character( @@ -195,7 +194,7 @@ impl Server { state.write_component(entity, comp::Pos(spawn_point)); state.write_component(entity, comp::Vel(Vec3::zero())); state.write_component(entity, comp::Ori(Vec3::unit_y())); - state.write_component(entity, comp::ActionState::default()); + state.write_component(entity, comp::CharacterState::default()); state.write_component(entity, comp::Inventory::default()); state.write_component(entity, comp::InventoryUpdate); // Make sure physics are accepted. @@ -221,6 +220,9 @@ impl Server { let terrain = self.state.ecs().read_resource::(); let mut block_change = self.state.ecs().write_resource::(); let mut stats = self.state.ecs().write_storage::(); + let mut positions = self.state.ecs().write_storage::(); + let mut velocities = self.state.ecs().write_storage::(); + let mut force_updates = self.state.ecs().write_storage::(); for event in self.state.ecs().read_resource::().recv_all() { match event { @@ -250,6 +252,74 @@ impl Server { .cast(); } } + GameEvent::Jump(entity) => { + if let Some(vel) = velocities.get_mut(entity) { + vel.0.z = HUMANOID_JUMP_ACCEL; + let _ = force_updates.insert(entity, comp::ForceUpdate); + } + } + GameEvent::Die { entity, cause } => { + // Chat message + if let Some(player) = + self.state.ecs().read_storage::().get(entity) + { + let msg = if let comp::HealthSource::Attack { by } = cause { + self.state() + .ecs() + .entity_from_uid(by.into()) + .and_then(|attacker| { + self.state + .ecs() + .read_storage::() + .get(attacker) + .map(|attacker_alias| { + format!( + "{} was killed by {}", + &player.alias, &attacker_alias.alias + ) + }) + }) + } else { + None + } + .unwrap_or(format!("{} died", &player.alias)); + + self.clients.notify_registered(ServerMsg::kill(msg)); + } + + // Give EXP to the client + if let Some(entity_stats) = stats.get(entity).cloned() { + if let comp::HealthSource::Attack { by } = cause { + self.state.ecs().entity_from_uid(by.into()).map(|attacker| { + if let Some(attacker_stats) = stats.get_mut(attacker) { + // TODO: Discuss whether we should give EXP by Player Killing or not. + attacker_stats.exp.change_by( + entity_stats.health.maximum() as f64 / 10.0 + + entity_stats.level.level() as f64 * 10.0, + ); + } + }); + } + } + + if let Some(client) = self.clients.get_mut(&entity) { + let _ = velocities.insert(entity, comp::Vel(Vec3::zero())); + let _ = force_updates.insert(entity, comp::ForceUpdate); + client.force_state(ClientState::Dead); + } else { + //let _ = self.state.ecs_mut().delete_entity_synced(entity); + continue; + } + } + GameEvent::Respawn(entity) => { + // Only clients can respawn + if let Some(client) = self.clients.get_mut(&entity) { + client.allow_state(ClientState::Character); + stats.get_mut(entity).map(|stats| stats.revive()); + positions.get_mut(entity).map(|pos| pos.0.z += 20.0); + force_updates.insert(entity, comp::ForceUpdate); + } + } } } } @@ -357,7 +427,7 @@ impl Server { .with(comp::Controller::default()) .with(body) .with(stats) - .with(comp::ActionState::default()) + .with(comp::CharacterState::default()) .with(comp::Agent::enemy()) .with(comp::Scale(scale)) .build(); @@ -475,13 +545,6 @@ impl Server { // 7) Finish the tick, pass control back to the frontend. - // Cleanup - let ecs = self.state.ecs_mut(); - for entity in ecs.entities().join() { - ecs.write_storage::().remove(entity); - ecs.write_storage::().remove(entity); - } - Ok(frontend_events) } @@ -885,12 +948,12 @@ impl Server { state.write_component(entity, player); // Sync physics of all entities - for (&uid, &pos, vel, ori, action_state) in ( + for (&uid, &pos, vel, ori, character_state) in ( &state.ecs().read_storage::(), &state.ecs().read_storage::(), // We assume all these entities have a position state.ecs().read_storage::().maybe(), state.ecs().read_storage::().maybe(), - state.ecs().read_storage::().maybe(), + state.ecs().read_storage::().maybe(), ) .join() { @@ -910,10 +973,10 @@ impl Server { ori, }); } - if let Some(action_state) = action_state.copied() { - client.notify(ServerMsg::EntityActionState { + if let Some(character_state) = character_state.copied() { + client.notify(ServerMsg::EntityCharacterState { entity: uid.into(), - action_state, + character_state, }); } } @@ -928,84 +991,7 @@ impl Server { self.clients .notify_registered(ServerMsg::EcsSync(self.state.ecs_mut().next_sync_package())); - // TODO: Move this into some new method like `handle_sys_outputs` right after ticking the world - // Handle deaths. let ecs = self.state.ecs_mut(); - let clients = &mut self.clients; - let todo_kill = (&ecs.entities(), &ecs.read_storage::()) - .join() - .map(|(entity, dying)| { - // Chat message - if let Some(player) = ecs.read_storage::().get(entity) { - let msg = if let comp::HealthSource::Attack { by } = dying.cause { - ecs.entity_from_uid(by.into()).and_then(|attacker| { - ecs.read_storage::() - .get(attacker) - .map(|attacker_alias| { - format!( - "{} was killed by {}", - &player.alias, &attacker_alias.alias - ) - }) - }) - } else { - None - } - .unwrap_or(format!("{} died", &player.alias)); - - clients.notify_registered(ServerMsg::kill(msg)); - } - - // Give EXP to the client - let mut stats = ecs.write_storage::(); - if let Some(entity_stats) = stats.get(entity).cloned() { - if let comp::HealthSource::Attack { by } = dying.cause { - ecs.entity_from_uid(by.into()).map(|attacker| { - if let Some(attacker_stats) = stats.get_mut(attacker) { - // TODO: Discuss whether we should give EXP by Player Killing or not. - attacker_stats.exp.change_by( - entity_stats.health.maximum() as f64 / 10.0 - + entity_stats.level.level() as f64 * 10.0, - ); - } - }); - } - } - - entity - }) - .collect::>(); - - // Actually kill them - for entity in todo_kill { - if let Some(client) = self.clients.get_mut(&entity) { - let _ = ecs.write_storage().insert(entity, comp::Vel(Vec3::zero())); - let _ = ecs.write_storage().insert(entity, comp::ForceUpdate); - client.force_state(ClientState::Dead); - } else { - let _ = ecs.delete_entity_synced(entity); - continue; - } - } - - // Handle respawns - let todo_respawn = (&ecs.entities(), &ecs.read_storage::()) - .join() - .map(|(entity, _)| entity) - .collect::>(); - - for entity in todo_respawn { - if let Some(client) = self.clients.get_mut(&entity) { - client.allow_state(ClientState::Character); - ecs.write_storage::() - .get_mut(entity) - .map(|stats| stats.revive()); - ecs.write_storage::() - .get_mut(entity) - .map(|pos| pos.0.z += 20.0); - let _ = ecs.write_storage().insert(entity, comp::ForceUpdate); - } - } // Sync physics for (entity, &uid, &pos, force_update) in ( @@ -1043,7 +1029,7 @@ impl Server { let mut last_pos = ecs.write_storage::>(); let mut last_vel = ecs.write_storage::>(); let mut last_ori = ecs.write_storage::>(); - let mut last_action_state = ecs.write_storage::>(); + let mut last_character_state = ecs.write_storage::>(); if let Some(client_pos) = ecs.read_storage::().get(entity) { if last_pos @@ -1099,16 +1085,19 @@ impl Server { } } - if let Some(client_action_state) = ecs.read_storage::().get(entity) { - if last_action_state + if let Some(client_character_state) = + ecs.read_storage::().get(entity) + { + if last_character_state .get(entity) - .map(|&l| l != *client_action_state) + .map(|&l| l != *client_character_state) .unwrap_or(true) { - let _ = last_action_state.insert(entity, comp::Last(*client_action_state)); - let msg = ServerMsg::EntityActionState { + let _ = + last_character_state.insert(entity, comp::Last(*client_character_state)); + let msg = ServerMsg::EntityCharacterState { entity: uid.into(), - action_state: *client_action_state, + character_state: *client_character_state, }; match force_update { Some(_) => clients.notify_ingame_if(msg, in_vd), From 90c81b4759a0a9c5103f0c80d91e863827312e08 Mon Sep 17 00:00:00 2001 From: timokoesters Date: Fri, 23 Aug 2019 22:11:14 +0200 Subject: [PATCH 02/33] Reset controller after each tick --- common/src/sys/controller.rs | 5 ----- common/src/sys/mod.rs | 3 +++ 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/common/src/sys/controller.rs b/common/src/sys/controller.rs index fb663e4895..92756f99f3 100644 --- a/common/src/sys/controller.rs +++ b/common/src/sys/controller.rs @@ -125,11 +125,6 @@ impl<'a> System<'a> for Sys { dbg!(); event_emitter.emit(Event::Jump(entity)); } - - // TODO before merge: reset controller in a final ecs system - - // Reset the controller ready for the next tick - //*controller = Controller::default(); } } } diff --git a/common/src/sys/mod.rs b/common/src/sys/mod.rs index dc6be61e98..5ffb8a956a 100644 --- a/common/src/sys/mod.rs +++ b/common/src/sys/mod.rs @@ -1,5 +1,6 @@ pub mod agent; pub mod animation; +mod cleanup; pub mod combat; pub mod controller; pub mod movement; @@ -17,6 +18,7 @@ const MOVEMENT_SYS: &str = "movement_sys"; const COMBAT_SYS: &str = "combat_sys"; const ANIMATION_SYS: &str = "animation_sys"; const STATS_SYS: &str = "stats_sys"; +const CLEANUP_SYS: &str = "cleanup_sys"; pub fn add_local_systems(dispatch_builder: &mut DispatcherBuilder) { dispatch_builder.add(agent::Sys, AGENT_SYS, &[]); @@ -26,4 +28,5 @@ pub fn add_local_systems(dispatch_builder: &mut DispatcherBuilder) { dispatch_builder.add(combat::Sys, COMBAT_SYS, &[CONTROLLER_SYS]); dispatch_builder.add(animation::Sys, ANIMATION_SYS, &[CONTROLLER_SYS]); dispatch_builder.add(stats::Sys, STATS_SYS, &[COMBAT_SYS]); + dispatch_builder.add(cleanup::Sys, CLEANUP_SYS, &[STATS_SYS, ANIMATION_SYS]); } From 4d6a32e00f2510a0806a7924b7aa63f9a963efd0 Mon Sep 17 00:00:00 2001 From: timokoesters Date: Fri, 23 Aug 2019 22:50:35 +0200 Subject: [PATCH 03/33] Allow non player entites to be removed again --- common/src/sys/controller.rs | 1 - server/src/lib.rs | 177 ++++++++++++++++++----------------- 2 files changed, 90 insertions(+), 88 deletions(-) diff --git a/common/src/sys/controller.rs b/common/src/sys/controller.rs index 92756f99f3..b28cff5b0f 100644 --- a/common/src/sys/controller.rs +++ b/common/src/sys/controller.rs @@ -122,7 +122,6 @@ impl<'a> System<'a> for Sys { // Jump if controller.jump && physics.on_ground && vel.0.z <= 0.0 { - dbg!(); event_emitter.emit(Event::Jump(entity)); } } diff --git a/server/src/lib.rs b/server/src/lib.rs index 5e71695c89..60eb1c42e2 100644 --- a/server/src/lib.rs +++ b/server/src/lib.rs @@ -217,109 +217,112 @@ impl Server { /// Handle events coming through via the event bus fn handle_events(&mut self) { - let terrain = self.state.ecs().read_resource::(); - let mut block_change = self.state.ecs().write_resource::(); - let mut stats = self.state.ecs().write_storage::(); - let mut positions = self.state.ecs().write_storage::(); - let mut velocities = self.state.ecs().write_storage::(); - let mut force_updates = self.state.ecs().write_storage::(); + let clients = &mut self.clients; - for event in self.state.ecs().read_resource::().recv_all() { - match event { - GameEvent::LandOnGround { entity, vel } => { - if let Some(stats) = stats.get_mut(entity) { - let falldmg = (vel.z / 1.5 + 10.0) as i32; - if falldmg < 0 { - stats.health.change_by(falldmg, comp::HealthSource::World); + let events = self.state.ecs().read_resource::().recv_all(); + for event in events { + let ecs = self.state.ecs_mut(); + let mut todo_remove = None; + { + let terrain = ecs.read_resource::(); + let mut block_change = ecs.write_resource::(); + let mut stats = ecs.write_storage::(); + let mut positions = ecs.write_storage::(); + let mut velocities = ecs.write_storage::(); + let mut force_updates = ecs.write_storage::(); + + match event { + GameEvent::LandOnGround { entity, vel } => { + if let Some(stats) = stats.get_mut(entity) { + let falldmg = (vel.z / 1.5 + 10.0) as i32; + if falldmg < 0 { + stats.health.change_by(falldmg, comp::HealthSource::World); + } } } - } - GameEvent::Explosion { pos, radius } => { - const RAYS: usize = 500; + GameEvent::Explosion { pos, radius } => { + const RAYS: usize = 500; - for _ in 0..RAYS { - let dir = Vec3::new( - rand::random::() - 0.5, - rand::random::() - 0.5, - rand::random::() - 0.5, - ) - .normalized(); + for _ in 0..RAYS { + let dir = Vec3::new( + rand::random::() - 0.5, + rand::random::() - 0.5, + rand::random::() - 0.5, + ) + .normalized(); - let _ = terrain - .ray(pos, pos + dir * radius) - .until(|_| rand::random::() < 0.05) - .for_each(|pos| block_change.set(pos, Block::empty())) - .cast(); + let _ = terrain + .ray(pos, pos + dir * radius) + .until(|_| rand::random::() < 0.05) + .for_each(|pos| block_change.set(pos, Block::empty())) + .cast(); + } } - } - GameEvent::Jump(entity) => { - if let Some(vel) = velocities.get_mut(entity) { - vel.0.z = HUMANOID_JUMP_ACCEL; - let _ = force_updates.insert(entity, comp::ForceUpdate); + GameEvent::Jump(entity) => { + if let Some(vel) = velocities.get_mut(entity) { + vel.0.z = HUMANOID_JUMP_ACCEL; + let _ = force_updates.insert(entity, comp::ForceUpdate); + } } - } - GameEvent::Die { entity, cause } => { - // Chat message - if let Some(player) = - self.state.ecs().read_storage::().get(entity) - { - let msg = if let comp::HealthSource::Attack { by } = cause { - self.state() - .ecs() - .entity_from_uid(by.into()) - .and_then(|attacker| { - self.state - .ecs() - .read_storage::() - .get(attacker) - .map(|attacker_alias| { + GameEvent::Die { entity, cause } => { + // Chat message + if let Some(player) = ecs.read_storage::().get(entity) { + let msg = if let comp::HealthSource::Attack { by } = cause { + ecs.entity_from_uid(by.into()).and_then(|attacker| { + ecs.read_storage::().get(attacker).map( + |attacker_alias| { format!( "{} was killed by {}", &player.alias, &attacker_alias.alias ) - }) + }, + ) }) + } else { + None + } + .unwrap_or(format!("{} died", &player.alias)); + + clients.notify_registered(ServerMsg::kill(msg)); + } + + // Give EXP to the client + if let Some(entity_stats) = stats.get(entity).cloned() { + if let comp::HealthSource::Attack { by } = cause { + ecs.entity_from_uid(by.into()).map(|attacker| { + if let Some(attacker_stats) = stats.get_mut(attacker) { + // TODO: Discuss whether we should give EXP by Player Killing or not. + attacker_stats.exp.change_by( + entity_stats.health.maximum() as f64 / 10.0 + + entity_stats.level.level() as f64 * 10.0, + ); + } + }); + } + } + + if let Some(client) = clients.get_mut(&entity) { + let _ = velocities.insert(entity, comp::Vel(Vec3::zero())); + let _ = force_updates.insert(entity, comp::ForceUpdate); + client.force_state(ClientState::Dead); } else { - None - } - .unwrap_or(format!("{} died", &player.alias)); - - self.clients.notify_registered(ServerMsg::kill(msg)); - } - - // Give EXP to the client - if let Some(entity_stats) = stats.get(entity).cloned() { - if let comp::HealthSource::Attack { by } = cause { - self.state.ecs().entity_from_uid(by.into()).map(|attacker| { - if let Some(attacker_stats) = stats.get_mut(attacker) { - // TODO: Discuss whether we should give EXP by Player Killing or not. - attacker_stats.exp.change_by( - entity_stats.health.maximum() as f64 / 10.0 - + entity_stats.level.level() as f64 * 10.0, - ); - } - }); + todo_remove = Some(entity.clone()); } } + GameEvent::Respawn(entity) => { + // Only clients can respawn + if let Some(client) = clients.get_mut(&entity) { + client.allow_state(ClientState::Character); + stats.get_mut(entity).map(|stats| stats.revive()); + positions.get_mut(entity).map(|pos| pos.0.z += 20.0); + let _ = force_updates.insert(entity, comp::ForceUpdate); + } + } + } + } - if let Some(client) = self.clients.get_mut(&entity) { - let _ = velocities.insert(entity, comp::Vel(Vec3::zero())); - let _ = force_updates.insert(entity, comp::ForceUpdate); - client.force_state(ClientState::Dead); - } else { - //let _ = self.state.ecs_mut().delete_entity_synced(entity); - continue; - } - } - GameEvent::Respawn(entity) => { - // Only clients can respawn - if let Some(client) = self.clients.get_mut(&entity) { - client.allow_state(ClientState::Character); - stats.get_mut(entity).map(|stats| stats.revive()); - positions.get_mut(entity).map(|pos| pos.0.z += 20.0); - force_updates.insert(entity, comp::ForceUpdate); - } - } + if let Some(entity) = todo_remove { + let _ = ecs.delete_entity_synced(entity); } } } From 808467c616e298607dd5ba36aabbb443649975d6 Mon Sep 17 00:00:00 2001 From: timokoesters Date: Fri, 23 Aug 2019 22:11:14 +0200 Subject: [PATCH 04/33] Reset controller after each tick --- common/src/sys/cleanup.rs | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 common/src/sys/cleanup.rs diff --git a/common/src/sys/cleanup.rs b/common/src/sys/cleanup.rs new file mode 100644 index 0000000000..090e137d62 --- /dev/null +++ b/common/src/sys/cleanup.rs @@ -0,0 +1,15 @@ +use crate::comp::Controller; +use specs::{Entities, Join, System, WriteStorage}; +use vek::*; + +/// This system will allow NPCs to modify their controller +pub struct Sys; +impl<'a> System<'a> for Sys { + type SystemData = (Entities<'a>, WriteStorage<'a, Controller>); + + fn run(&mut self, (entities, mut controllers): Self::SystemData) { + for controller in (&mut controllers).join() { + *controller = Controller::default(); + } + } +} From 799c73d43a3bbbb7b15aa718fae5da2a9dac8dd3 Mon Sep 17 00:00:00 2001 From: timokoesters Date: Sat, 24 Aug 2019 10:56:28 +0200 Subject: [PATCH 05/33] Fix characterstate in movement.rs, not phys.rs --- common/src/sys/mod.rs | 2 +- common/src/sys/movement.rs | 8 ++++++++ common/src/sys/phys.rs | 13 +------------ 3 files changed, 10 insertions(+), 13 deletions(-) diff --git a/common/src/sys/mod.rs b/common/src/sys/mod.rs index 5ffb8a956a..d1d7895e08 100644 --- a/common/src/sys/mod.rs +++ b/common/src/sys/mod.rs @@ -26,7 +26,7 @@ pub fn add_local_systems(dispatch_builder: &mut DispatcherBuilder) { dispatch_builder.add(phys::Sys, PHYS_SYS, &[CONTROLLER_SYS]); dispatch_builder.add(movement::Sys, MOVEMENT_SYS, &[PHYS_SYS]); dispatch_builder.add(combat::Sys, COMBAT_SYS, &[CONTROLLER_SYS]); - dispatch_builder.add(animation::Sys, ANIMATION_SYS, &[CONTROLLER_SYS]); + dispatch_builder.add(animation::Sys, ANIMATION_SYS, &[MOVEMENT_SYS]); dispatch_builder.add(stats::Sys, STATS_SYS, &[COMBAT_SYS]); dispatch_builder.add(cleanup::Sys, CLEANUP_SYS, &[STATS_SYS, ANIMATION_SYS]); } diff --git a/common/src/sys/movement.rs b/common/src/sys/movement.rs index f7c11e2862..9eb73c1c71 100644 --- a/common/src/sys/movement.rs +++ b/common/src/sys/movement.rs @@ -131,6 +131,14 @@ impl<'a> System<'a> for Sys { .unwrap_or_default(); } } + + if physics.on_ground && (character.movement == Jump || character.movement == Glide) { + character.movement = Stand; + } + + if !physics.on_ground && (character.movement == Stand || character.movement == Run) { + character.movement = Jump; + } } } } diff --git a/common/src/sys/phys.rs b/common/src/sys/phys.rs index 352404fb69..3329ea9ea7 100644 --- a/common/src/sys/phys.rs +++ b/common/src/sys/phys.rs @@ -1,6 +1,6 @@ use { crate::{ - comp::{Body, CharacterState, MovementState::*, Ori, PhysicsState, Pos, Scale, Stats, Vel}, + comp::{Body, MovementState::*, Ori, PhysicsState, Pos, Scale, Stats, Vel}, event::{Event, EventBus}, state::DeltaTime, terrain::TerrainMap, @@ -37,7 +37,6 @@ impl<'a> System<'a> for Sys { Read<'a, EventBus>, ReadStorage<'a, Scale>, ReadStorage<'a, Body>, - WriteStorage<'a, CharacterState>, WriteStorage<'a, PhysicsState>, WriteStorage<'a, Pos>, WriteStorage<'a, Vel>, @@ -53,7 +52,6 @@ impl<'a> System<'a> for Sys { event_bus, scales, bodies, - mut character_states, mut physics_states, mut positions, mut velocities, @@ -73,7 +71,6 @@ impl<'a> System<'a> for Sys { ) .join() { - let mut character_state = character_states.get(entity).cloned().unwrap_or_default(); let mut physics_state = physics_states.get(entity).cloned().unwrap_or_default(); let scale = scale.map(|s| s.0).unwrap_or(1.0); @@ -215,7 +212,6 @@ impl<'a> System<'a> for Sys { if !was_on_ground { event_emitter.emit(Event::LandOnGround { entity, vel: vel.0 }); - character_state.movement = Stand; } } @@ -263,10 +259,6 @@ impl<'a> System<'a> for Sys { if on_ground { physics_state.on_ground = true; - - if !was_on_ground { - character_state.movement = Stand; - } // If the space below us is free, then "snap" to the ground } else if collision_with(pos.0 - Vec3::unit_z() * 1.05, near_iter.clone()) && vel.0.z < 0.0 @@ -275,11 +267,8 @@ impl<'a> System<'a> for Sys { { pos.0.z = (pos.0.z - 0.05).floor(); physics_state.on_ground = true; - } else if was_on_ground { - character_state.movement = Jump; } - let _ = character_states.insert(entity, character_state); let _ = physics_states.insert(entity, physics_state); } From 5ab03abbddd4a4c78921883062f50a87fd7ada4c Mon Sep 17 00:00:00 2001 From: timokoesters Date: Sat, 24 Aug 2019 10:57:47 +0200 Subject: [PATCH 06/33] Remove animation warnings --- common/src/sys/animation.rs | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/common/src/sys/animation.rs b/common/src/sys/animation.rs index 35f56bacaa..a158dd2001 100644 --- a/common/src/sys/animation.rs +++ b/common/src/sys/animation.rs @@ -1,6 +1,7 @@ use crate::{ comp::{ ActionState::*, Animation, AnimationInfo, CharacterState, MovementState::*, PhysicsState, + Stats, }, state::DeltaTime, }; @@ -13,6 +14,7 @@ impl<'a> System<'a> for Sys { type SystemData = ( Entities<'a>, Read<'a, DeltaTime>, + ReadStorage<'a, Stats>, ReadStorage<'a, CharacterState>, ReadStorage<'a, PhysicsState>, WriteStorage<'a, AnimationInfo>, @@ -20,12 +22,13 @@ impl<'a> System<'a> for Sys { fn run( &mut self, - (entities, dt, character_states, physics_states, mut animation_infos): Self::SystemData, + (entities, dt, stats, character_states, physics_states, mut animation_infos): Self::SystemData, ) { - for (entity, character, physics) in (&entities, &character_states, &physics_states).join() { - fn impossible_animation(physics: PhysicsState, character: CharacterState) -> Animation { - warn!("Impossible animation: {:?} {:?}", physics, character); - Animation::Roll + for (entity, stats, character, physics) in + (&entities, &stats, &character_states, &physics_states).join() + { + if stats.is_dead { + continue; } let animation = match (physics.on_ground, &character.movement, &character.action) { @@ -38,7 +41,8 @@ impl<'a> System<'a> for Sys { (false, Jump, Wield { .. }) => Animation::Cjump, (_, Glide, Idle) => Animation::Gliding, (_, _, Attack { .. }) => Animation::Attack, - _ => impossible_animation(physics.clone(), character.clone()), + // Impossible animation (Caused by missing animations or syncing delays) + _ => Animation::Roll, }; let new_time = animation_infos From 0bb70d8182e65cd6ef9879a185a42d8b4b2cfa9b Mon Sep 17 00:00:00 2001 From: timokoesters Date: Sat, 24 Aug 2019 11:04:32 +0200 Subject: [PATCH 07/33] Fix water --- common/src/sys/phys.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/common/src/sys/phys.rs b/common/src/sys/phys.rs index 3329ea9ea7..b8bfd11cce 100644 --- a/common/src/sys/phys.rs +++ b/common/src/sys/phys.rs @@ -104,7 +104,7 @@ impl<'a> System<'a> for Sys { if terrain .get(block_pos) - .map(|vox| !vox.is_empty()) + .map(|vox| vox.is_solid()) .unwrap_or(false) { let player_aabb = Aabb { @@ -179,7 +179,7 @@ impl<'a> System<'a> for Sys { .filter(|(block_pos, _)| { terrain .get(*block_pos) - .map(|vox| !vox.is_empty()) + .map(|vox| vox.is_solid()) .unwrap_or(false) }) // Find the maximum of the minimum collision axes (this bit is weird, trust me that it works) @@ -225,7 +225,7 @@ impl<'a> System<'a> for Sys { // ...and we're falling/standing OR there is a block *directly* beneath our current origin (note: not hitbox)... && (vel.0.z <= 0.0 || terrain .get((pos.0 - Vec3::unit_z() * 0.1).map(|e| e.floor() as i32)) - .map(|vox| !vox.is_empty()) + .map(|vox| vox.is_solid()) .unwrap_or(false)) // ...and there is a collision with a block beneath our current hitbox... && collision_with( From b748c1a6e594407cfdf70b208e1b254cbf3a8301 Mon Sep 17 00:00:00 2001 From: timokoesters Date: Sat, 24 Aug 2019 11:40:07 +0200 Subject: [PATCH 08/33] Make gliding the error animation --- common/src/sys/animation.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common/src/sys/animation.rs b/common/src/sys/animation.rs index a158dd2001..4affc39fb2 100644 --- a/common/src/sys/animation.rs +++ b/common/src/sys/animation.rs @@ -42,7 +42,7 @@ impl<'a> System<'a> for Sys { (_, Glide, Idle) => Animation::Gliding, (_, _, Attack { .. }) => Animation::Attack, // Impossible animation (Caused by missing animations or syncing delays) - _ => Animation::Roll, + _ => Animation::Gliding, }; let new_time = animation_infos From e42ffb362a523e37553bf3685127cb1d8ea88552 Mon Sep 17 00:00:00 2001 From: timokoesters Date: Sat, 24 Aug 2019 16:32:36 +0200 Subject: [PATCH 09/33] Remove unnecessary components --- common/src/comp/inputs.rs | 93 --------------------------------------- 1 file changed, 93 deletions(-) diff --git a/common/src/comp/inputs.rs b/common/src/comp/inputs.rs index a98012c787..d748b16652 100644 --- a/common/src/comp/inputs.rs +++ b/common/src/comp/inputs.rs @@ -2,101 +2,8 @@ use specs::{Component, FlaggedStorage, NullStorage}; use specs_idvs::IDVStorage; use vek::*; -#[derive(Clone, Debug, Default, Serialize, Deserialize)] -pub struct Respawning; - -#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] -pub struct MoveDir(pub Vec2); - -#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] -pub struct Wielding { - pub time: f32, - pub applied: bool, -} - -#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] -pub struct Attacking { - pub time: f32, - pub applied: bool, -} - -#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] -pub struct Rolling { - pub time: f32, - pub applied: bool, -} - -#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] -pub struct OnGround; - #[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] pub struct CanBuild; - -#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] -pub struct Jumping; - -#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] -pub struct Gliding; - -impl Component for Respawning { - type Storage = NullStorage; -} - -impl Wielding { - pub fn start() -> Self { - Self { - time: 0.0, - applied: false, - } - } -} - -impl Attacking { - pub fn start() -> Self { - Self { - time: 0.0, - applied: false, - } - } -} - -impl Rolling { - pub fn start() -> Self { - Self { - time: 0.0, - applied: false, - } - } -} - -impl Component for MoveDir { - type Storage = IDVStorage; -} - -impl Component for Wielding { - type Storage = FlaggedStorage>; -} - -impl Component for Attacking { - type Storage = FlaggedStorage>; -} - -impl Component for Rolling { - type Storage = FlaggedStorage>; -} - -impl Component for OnGround { - type Storage = NullStorage; -} - impl Component for CanBuild { type Storage = FlaggedStorage>; } - -impl Component for Jumping { - type Storage = NullStorage; -} - -impl Component for Gliding { - type Storage = FlaggedStorage>; -} From e7c61c30cc29303b5c6a35ecd9abac08ff4fa38f Mon Sep 17 00:00:00 2001 From: timokoesters Date: Sat, 24 Aug 2019 18:38:59 +0200 Subject: [PATCH 10/33] Block when pressing right click while looking at the attacker --- common/src/comp/character_state.rs | 9 ++++ common/src/comp/controller.rs | 1 + common/src/sys/animation.rs | 1 + common/src/sys/combat.rs | 67 +++++++++++++++++++----------- common/src/sys/controller.rs | 13 ++++++ voxygen/src/session.rs | 35 +++++++--------- voxygen/src/settings.rs | 4 +- voxygen/src/window.rs | 4 +- 8 files changed, 87 insertions(+), 47 deletions(-) diff --git a/common/src/comp/character_state.rs b/common/src/comp/character_state.rs index a7cffd1724..c9d5c55b17 100644 --- a/common/src/comp/character_state.rs +++ b/common/src/comp/character_state.rs @@ -27,6 +27,7 @@ pub enum ActionState { Idle, Wield { time_left: Duration }, Attack { time_left: Duration, applied: bool }, + Block { time_left: Duration }, //Carry, } @@ -46,6 +47,14 @@ impl ActionState { false } } + + pub fn is_block(&self) -> bool { + if let Self::Block { .. } = self { + true + } else { + false + } + } } #[derive(Clone, Copy, Debug, PartialEq, Serialize, Deserialize)] diff --git a/common/src/comp/controller.rs b/common/src/comp/controller.rs index 38f5796193..f64c961977 100644 --- a/common/src/comp/controller.rs +++ b/common/src/comp/controller.rs @@ -7,6 +7,7 @@ pub struct Controller { pub move_dir: Vec2, pub jump: bool, pub attack: bool, + pub block: bool, pub roll: bool, pub glide: bool, pub respawn: bool, diff --git a/common/src/sys/animation.rs b/common/src/sys/animation.rs index 4affc39fb2..6b30123ac1 100644 --- a/common/src/sys/animation.rs +++ b/common/src/sys/animation.rs @@ -41,6 +41,7 @@ impl<'a> System<'a> for Sys { (false, Jump, Wield { .. }) => Animation::Cjump, (_, Glide, Idle) => Animation::Gliding, (_, _, Attack { .. }) => Animation::Attack, + (_, _, Block { .. }) => Animation::Gliding, // Impossible animation (Caused by missing animations or syncing delays) _ => Animation::Gliding, }; diff --git a/common/src/sys/combat.rs b/common/src/sys/combat.rs index 6181854063..9e83b6faa0 100644 --- a/common/src/sys/combat.rs +++ b/common/src/sys/combat.rs @@ -35,22 +35,23 @@ impl<'a> System<'a> for Sys { ): Self::SystemData, ) { // Attacks - for (entity, uid, pos, ori, mut character) in ( - &entities, - &uids, - &positions, - &orientations, - &mut character_states, - ) - .join() - { + for (entity, uid, pos, ori) in (&entities, &uids, &positions, &orientations).join() { let mut todo_end = false; // Go through all other entities - if let Attack { time_left, applied } = &mut character.action { + if let Some(Attack { time_left, applied }) = + &mut character_states.get(entity).map(|c| c.action) + { if !*applied { - for (b, pos_b, mut vel_b, stat_b) in - (&entities, &positions, &mut velocities, &mut stats).join() + for (b, pos_b, ori_b, character_b, mut vel_b, stat_b) in ( + &entities, + &positions, + &orientations, + &character_states, + &mut velocities, + &mut stats, + ) + .join() { // Check if it is a hit if entity != b @@ -58,33 +59,51 @@ impl<'a> System<'a> for Sys { && pos.0.distance_squared(pos_b.0) < 50.0 && ori.0.angle_between(pos_b.0 - pos.0).to_degrees() < 90.0 { + let dmg = if character_b.action.is_block() + && ori_b.0.angle_between(pos.0 - pos_b.0).to_degrees() < 90.0 + { + 1 + } else { + 10 + }; + // Deal damage stat_b .health - .change_by(-10, HealthSource::Attack { by: *uid }); // TODO: variable damage and weapon + .change_by(-dmg, HealthSource::Attack { by: *uid }); // TODO: variable damage and weapon vel_b.0 += (pos_b.0 - pos.0).normalized() * 2.0; vel_b.0.z = 2.0; let _ = force_updates.insert(b, ForceUpdate); } } - *applied = true; } - if *time_left == Duration::default() { - todo_end = true; - } else { - *time_left = time_left - .checked_sub(Duration::from_secs_f32(dt.0)) - .unwrap_or_default(); + if let Some(Attack { time_left, applied }) = + &mut character_states.get_mut(entity).map(|c| &mut c.action) + { + // Only attack once + *applied = true; + + if *time_left == Duration::default() { + todo_end = true; + } else { + *time_left = time_left + .checked_sub(Duration::from_secs_f32(dt.0)) + .unwrap_or_default(); + } } } if todo_end { - character.action = Wield { - time_left: Duration::default(), - }; + if let Some(character) = &mut character_states.get_mut(entity) { + character.action = Wield { + time_left: Duration::default(), + }; + } } - if let Wield { time_left } = &mut character.action { + if let Some(Wield { time_left }) = + &mut character_states.get_mut(entity).map(|c| &mut c.action) + { if *time_left != Duration::default() { *time_left = time_left .checked_sub(Duration::from_secs_f32(dt.0)) diff --git a/common/src/sys/controller.rs b/common/src/sys/controller.rs index b28cff5b0f..d74281e1da 100644 --- a/common/src/sys/controller.rs +++ b/common/src/sys/controller.rs @@ -109,6 +109,19 @@ impl<'a> System<'a> for Sys { } } + // Block + if controller.block + && (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.block && character.action.is_block() { + dbg!(); + character.action = Idle; + } + // Roll if controller.roll && (character.action == Idle || character.action.is_wield()) diff --git a/voxygen/src/session.rs b/voxygen/src/session.rs index 4bbc3814da..3b750fdbeb 100644 --- a/voxygen/src/session.rs +++ b/voxygen/src/session.rs @@ -160,32 +160,29 @@ impl PlayState for SessionState { } } - Event::InputUpdate(GameInput::SecondAttack, state) => { - if state { - let mut client = self.client.borrow_mut(); - if client + Event::InputUpdate(GameInput::Block, state) => { + let mut client = self.client.borrow_mut(); + if state + && client .state() .read_storage::() .get(client.entity()) .is_some() - { - let (cam_dir, cam_pos) = - get_cam_data(&self.scene.camera(), &client); + { + let (cam_dir, cam_pos) = get_cam_data(&self.scene.camera(), &client); - let (d, b) = { - let terrain = client.state().terrain(); - let ray = - terrain.ray(cam_pos, cam_pos + cam_dir * 100.0).cast(); - (ray.0, if let Ok(Some(_)) = ray.1 { true } else { false }) - }; + let (d, b) = { + let terrain = client.state().terrain(); + let ray = terrain.ray(cam_pos, cam_pos + cam_dir * 100.0).cast(); + (ray.0, if let Ok(Some(_)) = ray.1 { true } else { false }) + }; - if b { - let pos = (cam_pos + cam_dir * d).map(|e| e.floor() as i32); - client.remove_block(pos); - } - } else { - // TODO: Handle secondary attack + if b { + let pos = (cam_pos + cam_dir * d).map(|e| e.floor() as i32); + client.remove_block(pos); } + } else { + self.controller.block = state; } } Event::InputUpdate(GameInput::Roll, state) => { diff --git a/voxygen/src/settings.rs b/voxygen/src/settings.rs index 3e4e4f23e3..853a6cac08 100644 --- a/voxygen/src/settings.rs +++ b/voxygen/src/settings.rs @@ -37,7 +37,7 @@ pub struct ControlSettings { pub screenshot: KeyMouse, pub toggle_ingame_ui: KeyMouse, pub attack: KeyMouse, - pub second_attack: KeyMouse, + pub block: KeyMouse, pub roll: KeyMouse, pub interact: KeyMouse, } @@ -69,7 +69,7 @@ impl Default for ControlSettings { screenshot: KeyMouse::Key(VirtualKeyCode::F4), toggle_ingame_ui: KeyMouse::Key(VirtualKeyCode::F6), attack: KeyMouse::Mouse(MouseButton::Left), - second_attack: KeyMouse::Mouse(MouseButton::Right), + block: KeyMouse::Mouse(MouseButton::Right), roll: KeyMouse::Mouse(MouseButton::Middle), interact: KeyMouse::Key(VirtualKeyCode::E), } diff --git a/voxygen/src/window.rs b/voxygen/src/window.rs index 4ebd0e2088..2e9b9534ec 100644 --- a/voxygen/src/window.rs +++ b/voxygen/src/window.rs @@ -35,7 +35,7 @@ pub enum GameInput { Screenshot, ToggleIngameUi, Attack, - SecondAttack, + Block, Roll, Respawn, Interact, @@ -142,7 +142,7 @@ impl Window { GameInput::ToggleIngameUi, ); key_map.insert(settings.controls.attack, GameInput::Attack); - key_map.insert(settings.controls.second_attack, GameInput::SecondAttack); + key_map.insert(settings.controls.block, GameInput::Block); key_map.insert(settings.controls.roll, GameInput::Roll); key_map.insert(settings.controls.interact, GameInput::Interact); From 39bd888a7c342cedeff0f6c48e720c7771f923f7 Mon Sep 17 00:00:00 2001 From: jshipsey Date: Sat, 24 Aug 2019 15:15:30 -0400 Subject: [PATCH 11/33] idle block animation --- common/src/comp/animation.rs | 1 + common/src/sys/animation.rs | 2 +- voxygen/src/anim/character/block.rs | 260 ++++++++++++++++++++++++++++ voxygen/src/anim/character/mod.rs | 3 + voxygen/src/scene/figure.rs | 8 + 5 files changed, 273 insertions(+), 1 deletion(-) create mode 100644 voxygen/src/anim/character/block.rs diff --git a/common/src/comp/animation.rs b/common/src/comp/animation.rs index f7ac0ac521..ee4fc69da4 100644 --- a/common/src/comp/animation.rs +++ b/common/src/comp/animation.rs @@ -8,6 +8,7 @@ pub enum Animation { Jump, Gliding, Attack, + Block, Roll, Crun, Cidle, diff --git a/common/src/sys/animation.rs b/common/src/sys/animation.rs index 6b30123ac1..fde92932c3 100644 --- a/common/src/sys/animation.rs +++ b/common/src/sys/animation.rs @@ -41,7 +41,7 @@ impl<'a> System<'a> for Sys { (false, Jump, Wield { .. }) => Animation::Cjump, (_, Glide, Idle) => Animation::Gliding, (_, _, Attack { .. }) => Animation::Attack, - (_, _, Block { .. }) => Animation::Gliding, + (_, _, Block { .. }) => Animation::Block, // Impossible animation (Caused by missing animations or syncing delays) _ => Animation::Gliding, }; diff --git a/voxygen/src/anim/character/block.rs b/voxygen/src/anim/character/block.rs new file mode 100644 index 0000000000..f1b98b7ac0 --- /dev/null +++ b/voxygen/src/anim/character/block.rs @@ -0,0 +1,260 @@ +use super::{ + super::{Animation, SkeletonAttr}, + CharacterSkeleton, +}; +use common::comp::item::Tool; +use std::{f32::consts::PI, ops::Mul}; +use vek::*; + +pub struct Input { + pub attack: bool, +} +pub struct BlockAnimation; + +impl Animation for BlockAnimation { + type Skeleton = CharacterSkeleton; + type Dependency = f64; + + fn update_skeleton( + skeleton: &Self::Skeleton, + global_time: f64, + anim_time: f64, + skeleton_attr: &SkeletonAttr, + ) -> Self::Skeleton { + let mut next = (*skeleton).clone(); + + let wave_ultra_slow = (anim_time as f32 * 3.0 + PI).sin(); + let wave_ultra_slow_cos = (anim_time as f32 * 3.0 + PI).cos(); + let wave_slow_cos = (anim_time as f32 * 6.0 + PI).cos(); + let wave_slow = (anim_time as f32 * 6.0 + PI).sin(); + + let head_look = Vec2::new( + ((global_time + anim_time) as f32 / 1.5) + .floor() + .mul(7331.0) + .sin() + * 0.3, + ((global_time + anim_time) as f32 / 1.5) + .floor() + .mul(1337.0) + .sin() + * 0.15, + ); + next.head.offset = Vec3::new( + 0.0 + skeleton_attr.neck_right + wave_slow_cos * 0.2, + 1.0 + skeleton_attr.neck_forward, + skeleton_attr.neck_height + 13.5 + wave_ultra_slow * 0.2, + ); + next.head.ori = + Quaternion::rotation_x(-0.25); + next.head.scale = Vec3::one() * 1.01 * skeleton_attr.head_scale; + + next.chest.offset = Vec3::new(0.0 + wave_slow_cos * 0.2, 0.0, 5.0 + wave_ultra_slow * 0.2); + next.chest.ori = Quaternion::rotation_x(-0.15) * Quaternion::rotation_y(wave_ultra_slow_cos * 0.01); + next.chest.scale = Vec3::one(); + + next.belt.offset = Vec3::new(0.0 + wave_slow_cos * 0.2, 0.0, 3.0 + wave_ultra_slow * 0.2); + next.belt.ori = Quaternion::rotation_x(0.0) * Quaternion::rotation_y(wave_ultra_slow_cos * 0.008); + next.belt.scale = Vec3::one() * 1.01; + + next.shorts.offset = Vec3::new(0.0 + wave_slow_cos * 0.2, 0.0, 1.0 + wave_ultra_slow * 0.2); + next.shorts.ori = Quaternion::rotation_x(0.1); + next.shorts.scale = Vec3::one(); + + match Tool::Hammer { + //TODO: Inventory + Tool::Sword => { + next.l_hand.offset = Vec3::new( + -6.0, + 3.5, + 0.0 + wave_ultra_slow * 1.0, + ); + next.l_hand.ori = Quaternion::rotation_x(-0.3); + next.l_hand.scale = Vec3::one() * 1.01; + next.r_hand.offset = Vec3::new( + -6.0, + 3.0, + -2.0, + ); + next.r_hand.ori = Quaternion::rotation_x(-0.3); + next.r_hand.scale = Vec3::one() * 1.01; + next.weapon.offset = Vec3::new( + -6.0 + skeleton_attr.weapon_x, + 4.5 + skeleton_attr.weapon_y, + 0.0, + ); + next.weapon.ori = Quaternion::rotation_x(-0.3) + * Quaternion::rotation_y(0.0) + * Quaternion::rotation_z(0.0); + next.weapon.scale = Vec3::one(); + } + Tool::Axe => { + next.l_hand.offset = Vec3::new( + -6.0 + wave_ultra_slow_cos * 1.0, + 3.5 + wave_ultra_slow_cos * 0.5, + 0.0 + wave_ultra_slow * 1.0, + ); + next.l_hand.ori = Quaternion::rotation_x(-0.3); + next.l_hand.scale = Vec3::one() * 1.01; + next.r_hand.offset = Vec3::new( + -6.0 + wave_ultra_slow_cos * 1.0, + 3.0 + wave_ultra_slow_cos * 0.5, + -2.0 + wave_ultra_slow * 1.0, + ); + next.r_hand.ori = Quaternion::rotation_x(-0.3); + next.r_hand.scale = Vec3::one() * 1.01; + next.weapon.offset = Vec3::new( + -6.0 + skeleton_attr.weapon_x, + 4.5 + skeleton_attr.weapon_y, + 0.0 + wave_ultra_slow * 1.0, + ); + next.weapon.ori = Quaternion::rotation_x(-0.3) + * Quaternion::rotation_y(0.0) + * Quaternion::rotation_z(0.0); + next.weapon.scale = Vec3::one(); + } + Tool::Hammer => { + next.l_hand.offset = Vec3::new(-5.5, 9.0, 5.5); + next.l_hand.ori = Quaternion::rotation_x(-0.3) + * Quaternion::rotation_y(-1.57) + * Quaternion::rotation_z(0.5); + next.l_hand.scale = Vec3::one() * 1.01; + next.r_hand.offset = Vec3::new(8.4, 9.3, 5.5); + next.r_hand.ori = Quaternion::rotation_x(-0.3) + * Quaternion::rotation_y(-1.57) + * Quaternion::rotation_z(0.5); + next.r_hand.scale = Vec3::one() * 1.01; + next.weapon.offset = Vec3::new( + 7.0 + skeleton_attr.weapon_x, + 10.75 + skeleton_attr.weapon_y, + 5.5, + ); + next.weapon.ori = Quaternion::rotation_x(-0.3) + * Quaternion::rotation_y(-1.57) + * Quaternion::rotation_z(0.5); + next.weapon.scale = Vec3::one(); + } + Tool::Staff => { + next.l_hand.offset = Vec3::new( + -6.0 + wave_ultra_slow_cos * 1.0, + 3.5 + wave_ultra_slow_cos * 0.5, + 0.0 + wave_ultra_slow * 1.0, + ); + next.l_hand.ori = Quaternion::rotation_x(-0.3); + next.l_hand.scale = Vec3::one() * 1.01; + next.r_hand.offset = Vec3::new( + -6.0 + wave_ultra_slow_cos * 1.0, + 3.0 + wave_ultra_slow_cos * 0.5, + -2.0 + wave_ultra_slow * 1.0, + ); + next.r_hand.ori = Quaternion::rotation_x(-0.3); + next.r_hand.scale = Vec3::one() * 1.01; + next.weapon.offset = Vec3::new( + -6.0 + skeleton_attr.weapon_x + wave_ultra_slow_cos * 1.0, + 4.5 + skeleton_attr.weapon_y + wave_ultra_slow_cos * 0.5, + 0.0 + wave_ultra_slow * 1.0, + ); + next.weapon.ori = Quaternion::rotation_x(-0.3) + * Quaternion::rotation_y(0.0) + * Quaternion::rotation_z(0.0); + next.weapon.scale = Vec3::one(); + } + Tool::SwordShield => { + next.l_hand.offset = Vec3::new( + -6.0 + wave_ultra_slow_cos * 1.0, + 3.5 + wave_ultra_slow_cos * 0.5, + 0.0 + wave_ultra_slow * 1.0, + ); + next.l_hand.ori = Quaternion::rotation_x(-0.3); + next.l_hand.scale = Vec3::one() * 1.01; + next.r_hand.offset = Vec3::new( + -6.0 + wave_ultra_slow_cos * 1.0, + 3.0 + wave_ultra_slow_cos * 0.5, + -2.0 + wave_ultra_slow * 1.0, + ); + next.r_hand.ori = Quaternion::rotation_x(-0.3); + next.r_hand.scale = Vec3::one() * 1.01; + next.weapon.offset = Vec3::new( + -6.0 + skeleton_attr.weapon_x + wave_ultra_slow_cos * 1.0, + 4.5 + skeleton_attr.weapon_y + wave_ultra_slow_cos * 0.5, + 0.0 + wave_ultra_slow * 1.0, + ); + next.weapon.ori = Quaternion::rotation_x(-0.3) + * Quaternion::rotation_y(0.0) + * Quaternion::rotation_z(0.0); + next.weapon.scale = Vec3::one(); + } + Tool::Bow => { + next.l_hand.offset = Vec3::new( + -6.0 + wave_ultra_slow_cos * 1.0, + 3.5 + wave_ultra_slow_cos * 0.5, + 0.0 + wave_ultra_slow * 1.0, + ); + next.l_hand.ori = Quaternion::rotation_x(-0.3); + next.l_hand.scale = Vec3::one() * 1.01; + next.r_hand.offset = Vec3::new( + -6.0 + wave_ultra_slow_cos * 1.0, + 3.0 + wave_ultra_slow_cos * 0.5, + -2.0 + wave_ultra_slow * 1.0, + ); + next.r_hand.ori = Quaternion::rotation_x(-0.3); + next.r_hand.scale = Vec3::one() * 1.01; + next.weapon.offset = Vec3::new( + -6.0 + skeleton_attr.weapon_x + wave_ultra_slow_cos * 1.0, + 4.5 + skeleton_attr.weapon_y + wave_ultra_slow_cos * 0.5, + 0.0 + wave_ultra_slow * 1.0, + ); + next.weapon.ori = Quaternion::rotation_x(-0.3) + * Quaternion::rotation_y(0.0) + * Quaternion::rotation_z(0.0); + next.weapon.scale = Vec3::one(); + } + Tool::Daggers => { + next.l_hand.offset = Vec3::new( + -6.0 + wave_ultra_slow_cos * 1.0, + 3.5 + wave_ultra_slow_cos * 0.5, + 0.0 + wave_ultra_slow * 1.0, + ); + next.l_hand.ori = Quaternion::rotation_x(-0.3); + next.l_hand.scale = Vec3::one() * 1.01; + next.r_hand.offset = Vec3::new(-6.0, 3.0, -2.0); + next.r_hand.ori = Quaternion::rotation_x(-0.3); + next.r_hand.scale = Vec3::one() * 1.01; + next.weapon.offset = Vec3::new( + -6.0 + skeleton_attr.weapon_x, + 4.5 + skeleton_attr.weapon_y, + 0.0, + ); + next.weapon.ori = Quaternion::rotation_x(-0.3) + * Quaternion::rotation_y(0.0) + * Quaternion::rotation_z(0.0); + next.weapon.scale = Vec3::one(); + } + } + next.l_foot.offset = Vec3::new(-3.4, 0.3, 8.0 + wave_ultra_slow_cos * 0.1); + next.l_foot.ori = Quaternion::rotation_x(-0.3); + next.l_foot.scale = Vec3::one(); + + next.r_foot.offset = Vec3::new(3.4, 1.2, 8.0 + wave_ultra_slow * 0.1); + next.r_foot.ori = Quaternion::rotation_x(0.3); + next.r_foot.scale = Vec3::one(); + + next.l_shoulder.offset = Vec3::new(-5.0, 0.0, 4.7); + next.l_shoulder.ori = Quaternion::rotation_x(0.0); + next.l_shoulder.scale = Vec3::one() * 1.1; + + next.r_shoulder.offset = Vec3::new(5.0, 0.0, 4.7); + next.r_shoulder.ori = Quaternion::rotation_x(0.0); + next.r_shoulder.scale = Vec3::one() * 1.1; + + next.draw.offset = Vec3::new(0.0, 5.0, 0.0); + next.draw.ori = Quaternion::rotation_y(0.0); + next.draw.scale = Vec3::one() * 0.0; + + next.torso.offset = Vec3::new(0.0, -0.2, 0.1) * skeleton_attr.scaler; + next.torso.ori = Quaternion::rotation_x(0.0); + next.torso.scale = Vec3::one() / 11.0 * skeleton_attr.scaler; + + next + } +} diff --git a/voxygen/src/anim/character/mod.rs b/voxygen/src/anim/character/mod.rs index 6165aeb170..e497818193 100644 --- a/voxygen/src/anim/character/mod.rs +++ b/voxygen/src/anim/character/mod.rs @@ -7,6 +7,7 @@ pub mod idle; pub mod jump; pub mod roll; pub mod run; +pub mod block; // Reexports pub use self::attack::AttackAnimation; @@ -18,6 +19,8 @@ pub use self::idle::IdleAnimation; pub use self::jump::JumpAnimation; pub use self::roll::RollAnimation; pub use self::run::RunAnimation; +pub use self::block::BlockAnimation; + use super::{Bone, Skeleton}; use crate::render::FigureBoneData; diff --git a/voxygen/src/scene/figure.rs b/voxygen/src/scene/figure.rs index 910e5a9c1b..4843d7dd6c 100644 --- a/voxygen/src/scene/figure.rs +++ b/voxygen/src/scene/figure.rs @@ -693,6 +693,14 @@ impl FigureMgr { skeleton_attr, ) } + comp::Animation::Block => { + anim::character::BlockAnimation::update_skeleton( + state.skeleton_mut(), + time, + animation_info.time, + skeleton_attr, + ) + } comp::Animation::Cjump => anim::character::CjumpAnimation::update_skeleton( state.skeleton_mut(), time, From e90f95bc756755f988b03c3427cd9feaccf76810 Mon Sep 17 00:00:00 2001 From: timokoesters Date: Sat, 24 Aug 2019 19:58:28 +0200 Subject: [PATCH 12/33] Look in the direction of the camera --- common/src/comp/controller.rs | 1 + common/src/sys/movement.rs | 11 +++++++++-- voxygen/src/session.rs | 23 +++++++++-------------- 3 files changed, 19 insertions(+), 16 deletions(-) diff --git a/common/src/comp/controller.rs b/common/src/comp/controller.rs index f64c961977..45dc34df86 100644 --- a/common/src/comp/controller.rs +++ b/common/src/comp/controller.rs @@ -5,6 +5,7 @@ use vek::*; #[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] pub struct Controller { pub move_dir: Vec2, + pub look_dir: Vec3, pub jump: bool, pub attack: bool, pub block: bool, diff --git a/common/src/sys/movement.rs b/common/src/sys/movement.rs index 9eb73c1c71..5414fe3645 100644 --- a/common/src/sys/movement.rs +++ b/common/src/sys/movement.rs @@ -94,11 +94,18 @@ impl<'a> System<'a> for Sys { }; // Set direction based on move direction when on the ground - let ori_dir = if character.movement == Glide || character.movement.is_roll() { + let ori_dir = if controller + .look_dir + .map(|n| !n.is_normal() || n.abs() < std::f32::EPSILON) + .reduce_or() + || character.movement == Glide + || character.movement.is_roll() + { Vec2::from(vel.0) } else { - controller.move_dir + Vec2::from(controller.look_dir).normalized() }; + if ori_dir.magnitude_squared() > 0.0001 && (ori.0.normalized() - Vec3::from(ori_dir).normalized()).magnitude_squared() > 0.001 diff --git a/voxygen/src/session.rs b/voxygen/src/session.rs index 3b750fdbeb..1bbfad91e6 100644 --- a/voxygen/src/session.rs +++ b/voxygen/src/session.rs @@ -105,19 +105,19 @@ impl PlayState for SessionState { self.client.borrow_mut().send_chat(cmd.to_string()); } } - // Compute camera data - let get_cam_data = |camera: &Camera, client: &Client| { - let (view_mat, _, cam_pos) = camera.compute_dependents(client); - let cam_dir: Vec3 = Vec3::from(view_mat.inverted() * -Vec4::unit_z()); - - (cam_dir, cam_pos) - }; // Game loop let mut current_client_state = self.client.borrow().get_client_state(); while let ClientState::Pending | ClientState::Character | ClientState::Dead = current_client_state { + // Compute camera data + let (view_mat, _, cam_pos) = self + .scene + .camera() + .compute_dependents(&self.client.borrow()); + let cam_dir: Vec3 = Vec3::from(view_mat.inverted() * -Vec4::unit_z()); + // Handle window events. for event in global_state.window.fetch_events() { // Pass all events to the ui first. @@ -142,8 +142,6 @@ impl PlayState for SessionState { .get(client.entity()) .is_some() { - let (cam_dir, cam_pos) = get_cam_data(&self.scene.camera(), &client); - let (d, b) = { let terrain = client.state().terrain(); let ray = terrain.ray(cam_pos, cam_pos + cam_dir * 100.0).cast(); @@ -169,8 +167,6 @@ impl PlayState for SessionState { .get(client.entity()) .is_some() { - let (cam_dir, cam_pos) = get_cam_data(&self.scene.camera(), &client); - let (d, b) = { let terrain = client.state().terrain(); let ray = terrain.ray(cam_pos, cam_pos + cam_dir * 100.0).cast(); @@ -194,9 +190,6 @@ impl PlayState for SessionState { .is_some() { if state { - let (cam_dir, cam_pos) = - get_cam_data(&self.scene.camera(), &client); - if let Ok(Some(block)) = client .state() .terrain() @@ -268,6 +261,8 @@ impl PlayState for SessionState { let dir_vec = self.key_state.dir_vec(); self.controller.move_dir = unit_vecs.0 * dir_vec[0] + unit_vecs.1 * dir_vec[1]; + self.controller.look_dir = cam_dir; + // Perform an in-game tick. if let Err(err) = self.tick(clock.get_avg_delta()) { error!("Failed to tick the scene: {:?}", err); From 0912de2a268a68a76e887a9e1082d0dbb144ac23 Mon Sep 17 00:00:00 2001 From: timokoesters Date: Sat, 24 Aug 2019 21:12:54 +0200 Subject: [PATCH 13/33] Make aiming more precise --- common/src/sys/agent.rs | 2 ++ common/src/sys/combat.rs | 18 ++++++++++++++---- common/src/sys/controller.rs | 9 +++++++++ common/src/sys/movement.rs | 8 +------- 4 files changed, 26 insertions(+), 11 deletions(-) diff --git a/common/src/sys/agent.rs b/common/src/sys/agent.rs index 1ce71eee45..929579ecce 100644 --- a/common/src/sys/agent.rs +++ b/common/src/sys/agent.rs @@ -76,6 +76,8 @@ impl<'a> System<'a> for Sys { ) }) { + controller.look_dir = target_pos.0 - pos.0; + let dist = Vec2::::from(target_pos.0 - pos.0).magnitude(); if target_stats.is_dead { choose_new = true; diff --git a/common/src/sys/combat.rs b/common/src/sys/combat.rs index 9e83b6faa0..3514719a5b 100644 --- a/common/src/sys/combat.rs +++ b/common/src/sys/combat.rs @@ -1,5 +1,7 @@ use crate::{ - comp::{ActionState::*, CharacterState, ForceUpdate, HealthSource, Ori, Pos, Stats, Vel}, + comp::{ + ActionState::*, CharacterState, Controller, ForceUpdate, HealthSource, Ori, Pos, Stats, Vel, + }, state::{DeltaTime, Uid}, }; use specs::{Entities, Join, Read, ReadStorage, System, WriteStorage}; @@ -14,6 +16,7 @@ impl<'a> System<'a> for Sys { Read<'a, DeltaTime>, ReadStorage<'a, Pos>, ReadStorage<'a, Ori>, + ReadStorage<'a, Controller>, WriteStorage<'a, Vel>, WriteStorage<'a, CharacterState>, WriteStorage<'a, Stats>, @@ -28,6 +31,7 @@ impl<'a> System<'a> for Sys { dt, positions, orientations, + controllers, mut velocities, mut character_states, mut stats, @@ -35,7 +39,9 @@ impl<'a> System<'a> for Sys { ): Self::SystemData, ) { // Attacks - for (entity, uid, pos, ori) in (&entities, &uids, &positions, &orientations).join() { + for (entity, uid, pos, ori, controller) in + (&entities, &uids, &positions, &orientations, &controllers).join() + { let mut todo_end = false; // Go through all other entities @@ -53,11 +59,15 @@ impl<'a> System<'a> for Sys { ) .join() { + let dist = pos.0.distance(pos_b.0); + // Check if it is a hit if entity != b && !stat_b.is_dead - && pos.0.distance_squared(pos_b.0) < 50.0 - && ori.0.angle_between(pos_b.0 - pos.0).to_degrees() < 90.0 + && dist < 6.0 + // TODO: Use size instead of 1.0 + // TODO: Implement eye levels + && controller.look_dir.angle_between(pos_b.0 - pos.0)) < (1.0 / dist).atan() { let dmg = if character_b.action.is_block() && ori_b.0.angle_between(pos.0 - pos_b.0).to_degrees() < 90.0 diff --git a/common/src/sys/controller.rs b/common/src/sys/controller.rs index d74281e1da..ce35df54f2 100644 --- a/common/src/sys/controller.rs +++ b/common/src/sys/controller.rs @@ -69,6 +69,15 @@ impl<'a> System<'a> for Sys { character.movement = Stand; } + // Look + if controller + .look_dir + .map(|n| !n.is_normal() || n.abs() < std::f32::EPSILON) + .reduce_or() + { + controller.look_dir = controller.move_dir.into(); + } + // Glide if controller.glide && !physics.on_ground diff --git a/common/src/sys/movement.rs b/common/src/sys/movement.rs index 5414fe3645..dff5174b7b 100644 --- a/common/src/sys/movement.rs +++ b/common/src/sys/movement.rs @@ -94,13 +94,7 @@ impl<'a> System<'a> for Sys { }; // Set direction based on move direction when on the ground - let ori_dir = if controller - .look_dir - .map(|n| !n.is_normal() || n.abs() < std::f32::EPSILON) - .reduce_or() - || character.movement == Glide - || character.movement.is_roll() - { + let ori_dir = if character.movement == Glide || character.movement.is_roll() { Vec2::from(vel.0) } else { Vec2::from(controller.look_dir).normalized() From b826edf6e8d16385c35a101ade634c7f116c1c33 Mon Sep 17 00:00:00 2001 From: timokoesters Date: Sat, 24 Aug 2019 22:41:34 +0200 Subject: [PATCH 14/33] Make aiming 2D --- common/src/sys/combat.rs | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/common/src/sys/combat.rs b/common/src/sys/combat.rs index 3514719a5b..05c57c9917 100644 --- a/common/src/sys/combat.rs +++ b/common/src/sys/combat.rs @@ -6,6 +6,7 @@ use crate::{ }; use specs::{Entities, Join, Read, ReadStorage, System, WriteStorage}; use std::time::Duration; +use vek::*; /// This system is responsible for handling accepted inputs like moving or attacking pub struct Sys; @@ -59,15 +60,16 @@ impl<'a> System<'a> for Sys { ) .join() { - let dist = pos.0.distance(pos_b.0); + let pos2 = Vec2::from(pos.0); + let pos_b2: Vec2 = Vec2::from(pos_b.0); + let ori2 = Vec2::from(ori.0); // Check if it is a hit if entity != b && !stat_b.is_dead - && dist < 6.0 + && pos.0.distance_squared(pos_b.0) < 40.0 // TODO: Use size instead of 1.0 - // TODO: Implement eye levels - && controller.look_dir.angle_between(pos_b.0 - pos.0)) < (1.0 / dist).atan() + && ori2.angle_between(pos_b2 - pos2) < (1.0 / pos2.distance(pos_b2)).atan() { let dmg = if character_b.action.is_block() && ori_b.0.angle_between(pos.0 - pos_b.0).to_degrees() < 90.0 From e8ccbe75facc308b53366b48cef426463311b709 Mon Sep 17 00:00:00 2001 From: timokoesters Date: Sun, 25 Aug 2019 11:35:54 +0200 Subject: [PATCH 15/33] Clean up entity spawning code --- server/src/cmd.rs | 2 +- server/src/lib.rs | 18 ++++-------------- 2 files changed, 5 insertions(+), 15 deletions(-) diff --git a/server/src/cmd.rs b/server/src/cmd.rs index cbd5b2b99f..e03e28bdc1 100644 --- a/server/src/cmd.rs +++ b/server/src/cmd.rs @@ -411,7 +411,7 @@ fn handle_spawn(server: &mut Server, entity: EcsEntity, args: String, action: &C let body = kind_to_body(id); server - .create_npc(pos, get_npc_name(id), body) + .create_npc(pos, comp::Stats::new(get_npc_name(id)), body) .with(comp::Vel(vel)) .with(agent) .build(); diff --git a/server/src/lib.rs b/server/src/lib.rs index 60eb1c42e2..8eb3cbd0e1 100644 --- a/server/src/lib.rs +++ b/server/src/lib.rs @@ -142,7 +142,7 @@ impl Server { pub fn create_npc( &mut self, pos: comp::Pos, - name: String, + stats: comp::Stats, body: comp::Body, ) -> EcsEntityBuilder { self.state @@ -153,7 +153,7 @@ impl Server { .with(comp::Ori(Vec3::unit_y())) .with(comp::Controller::default()) .with(body) - .with(comp::Stats::new(name)) + .with(stats) .with(comp::CharacterState::default()) } @@ -174,8 +174,7 @@ impl Server { offset: Vec3::unit_z(), ..comp::LightEmitter::default() }) - //.with(comp::LightEmitter::default()) - .with(comp::CharacterState::default()) + //.with(comp::LightEmitter::default()) } pub fn create_player_character( @@ -421,16 +420,7 @@ impl Server { scale = 2.5 + rand::random::(); } - self.state - .ecs_mut() - .create_entity_synced() - .with(comp::Pos(npc.pos)) - .with(comp::Vel(Vec3::zero())) - .with(comp::Ori(Vec3::unit_y())) - .with(comp::Controller::default()) - .with(body) - .with(stats) - .with(comp::CharacterState::default()) + self.create_npc(comp::Pos(npc.pos), stats, body) .with(comp::Agent::enemy()) .with(comp::Scale(scale)) .build(); From 295969517c27291298003911fdb8951cadd5dc06 Mon Sep 17 00:00:00 2001 From: timokoesters Date: Sun, 25 Aug 2019 11:36:24 +0200 Subject: [PATCH 16/33] Improve combat range --- common/src/sys/combat.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common/src/sys/combat.rs b/common/src/sys/combat.rs index 05c57c9917..a3c4282663 100644 --- a/common/src/sys/combat.rs +++ b/common/src/sys/combat.rs @@ -67,7 +67,7 @@ impl<'a> System<'a> for Sys { // Check if it is a hit if entity != b && !stat_b.is_dead - && pos.0.distance_squared(pos_b.0) < 40.0 + && pos.0.distance_squared(pos_b.0) < 20.0 // TODO: Use size instead of 1.0 && ori2.angle_between(pos_b2 - pos2) < (1.0 / pos2.distance(pos_b2)).atan() { From 62745c4cad9dcd98c8fd15a3b5784b4ce58791f3 Mon Sep 17 00:00:00 2001 From: timokoesters Date: Sun, 25 Aug 2019 12:10:42 +0200 Subject: [PATCH 17/33] Only use look_dir for ori when wielded or attacking --- common/src/sys/movement.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/common/src/sys/movement.rs b/common/src/sys/movement.rs index dff5174b7b..99c9bb2d47 100644 --- a/common/src/sys/movement.rs +++ b/common/src/sys/movement.rs @@ -94,10 +94,10 @@ impl<'a> System<'a> for Sys { }; // Set direction based on move direction when on the ground - let ori_dir = if character.movement == Glide || character.movement.is_roll() { - Vec2::from(vel.0) - } else { + let ori_dir = if character.action.is_wield() || character.action.is_attack() { Vec2::from(controller.look_dir).normalized() + } else { + Vec2::from(vel.0) }; if ori_dir.magnitude_squared() > 0.0001 From 75368dbac110c005a192a436dfc3a89f3c4ca854 Mon Sep 17 00:00:00 2001 From: timokoesters Date: Sun, 25 Aug 2019 12:10:58 +0200 Subject: [PATCH 18/33] Remove dbg --- common/src/sys/controller.rs | 1 - 1 file changed, 1 deletion(-) diff --git a/common/src/sys/controller.rs b/common/src/sys/controller.rs index ce35df54f2..304e60c86c 100644 --- a/common/src/sys/controller.rs +++ b/common/src/sys/controller.rs @@ -127,7 +127,6 @@ impl<'a> System<'a> for Sys { time_left: Duration::from_secs(5), }; } else if !controller.block && character.action.is_block() { - dbg!(); character.action = Idle; } From 814e8587205fccaea896399f3abfc8a151f1d293 Mon Sep 17 00:00:00 2001 From: Songtronix Date: Sun, 25 Aug 2019 16:49:54 +0200 Subject: [PATCH 19/33] Split Events in ServerEvent and LocalEvent --- common/src/event.rs | 40 ++++++++++++++++++++++-------------- common/src/state.rs | 27 +++++++++++++++++++++--- common/src/sys/controller.rs | 17 ++++++++------- common/src/sys/phys.rs | 6 +++--- common/src/sys/stats.rs | 6 +++--- server/src/cmd.rs | 6 +++--- server/src/lib.rs | 21 +++++++------------ 7 files changed, 75 insertions(+), 48 deletions(-) diff --git a/common/src/event.rs b/common/src/event.rs index acaac6cf48..a5ed0840fb 100644 --- a/common/src/event.rs +++ b/common/src/event.rs @@ -4,7 +4,11 @@ use specs::Entity as EcsEntity; use std::{collections::VecDeque, ops::DerefMut}; use vek::*; -pub enum Event { +pub enum LocalEvent { + Jump(EcsEntity), +} + +pub enum ServerEvent { LandOnGround { entity: EcsEntity, vel: Vec3, @@ -17,44 +21,50 @@ pub enum Event { entity: EcsEntity, cause: comp::HealthSource, }, - Jump(EcsEntity), Respawn(EcsEntity), } -#[derive(Default)] -pub struct EventBus { - queue: Mutex>, +pub struct EventBus { + queue: Mutex>, } -impl EventBus { - pub fn emitter(&self) -> Emitter { +impl Default for EventBus { + fn default() -> Self { + Self { + queue: Mutex::new(VecDeque::new()), + } + } +} + +impl EventBus { + pub fn emitter(&self) -> Emitter { Emitter { bus: self, events: VecDeque::new(), } } - pub fn emit(&self, event: Event) { + pub fn emit(&self, event: E) { self.queue.lock().push_front(event); } - pub fn recv_all(&self) -> impl ExactSizeIterator { + pub fn recv_all(&self) -> impl ExactSizeIterator { std::mem::replace(self.queue.lock().deref_mut(), VecDeque::new()).into_iter() } } -pub struct Emitter<'a> { - bus: &'a EventBus, - events: VecDeque, +pub struct Emitter<'a, E> { + bus: &'a EventBus, + events: VecDeque, } -impl<'a> Emitter<'a> { - pub fn emit(&mut self, event: Event) { +impl<'a, E> Emitter<'a, E> { + pub fn emit(&mut self, event: E) { self.events.push_front(event); } } -impl<'a> Drop for Emitter<'a> { +impl<'a, E> Drop for Emitter<'a, E> { fn drop(&mut self) { self.bus.queue.lock().append(&mut self.events); } diff --git a/common/src/state.rs b/common/src/state.rs index cb89aff217..179f6ee360 100644 --- a/common/src/state.rs +++ b/common/src/state.rs @@ -3,7 +3,7 @@ pub use sphynx::Uid; use crate::{ comp, - event::EventBus, + event::{EventBus, LocalEvent, ServerEvent}, msg::{EcsCompPacket, EcsResPacket}, sys, terrain::{Block, TerrainChunk, TerrainMap}, @@ -42,6 +42,7 @@ pub struct DeltaTime(pub f32); /// upper limit. If delta time exceeds this value, the game's physics will begin to produce time /// lag. Ideally, we'd avoid such a situation. const MAX_DELTA_TIME: f32 = 1.0; +const HUMANOID_JUMP_ACCEL: f32 = 18.0; #[derive(Default)] pub struct BlockChange { @@ -108,6 +109,7 @@ impl State { } // Create a new Sphynx ECS world. + // TODO: Split up registering into server and client (e.g. move EventBus to the server) fn setup_sphynx_world(ecs: &mut sphynx::World) { // Register server -> all clients synced components. ecs.register_synced::(); @@ -154,7 +156,8 @@ impl State { ecs.add_resource(TerrainMap::new().unwrap()); ecs.add_resource(BlockChange::default()); ecs.add_resource(TerrainChanges::default()); - ecs.add_resource(EventBus::default()); + ecs.add_resource(EventBus::::default()); + ecs.add_resource(EventBus::::default()); } /// Register a component with the state's ECS. @@ -311,8 +314,26 @@ impl State { &mut self.ecs.write_resource::().blocks, Default::default(), ); + + // Process local events + let events = self.ecs.read_resource::>().recv_all(); + for event in events { + { + let mut velocities = self.ecs.write_storage::(); + let mut force_updates = self.ecs.write_storage::(); + + match event { + LocalEvent::Jump(entity) => { + if let Some(vel) = velocities.get_mut(entity) { + vel.0.z = HUMANOID_JUMP_ACCEL; + let _ = force_updates.insert(entity, comp::ForceUpdate); + } + } + } + } + } } - + /// Clean up the state after a tick. pub fn cleanup(&mut self) { // Clean up data structures from the last tick. diff --git a/common/src/sys/controller.rs b/common/src/sys/controller.rs index 304e60c86c..79a12d7a17 100644 --- a/common/src/sys/controller.rs +++ b/common/src/sys/controller.rs @@ -3,7 +3,7 @@ use crate::{ ActionState::*, Body, CharacterState, Controller, MovementState::*, PhysicsState, Stats, Vel, }, - event::{Event, EventBus}, + event::{EventBus, ServerEvent, LocalEvent}, }; use specs::{Entities, Join, Read, ReadStorage, System, WriteStorage}; use std::time::Duration; @@ -13,7 +13,8 @@ pub struct Sys; impl<'a> System<'a> for Sys { type SystemData = ( Entities<'a>, - Read<'a, EventBus>, + Read<'a, EventBus>, + Read<'a, EventBus>, WriteStorage<'a, Controller>, ReadStorage<'a, Stats>, ReadStorage<'a, Body>, @@ -26,7 +27,8 @@ impl<'a> System<'a> for Sys { &mut self, ( entities, - event_bus, + server_bus, + local_bus, mut controllers, stats, bodies, @@ -35,7 +37,8 @@ impl<'a> System<'a> for Sys { mut character_states, ): Self::SystemData, ) { - let mut event_emitter = event_bus.emitter(); + let mut server_emitter = server_bus.emitter(); + let mut local_emitter = local_bus.emitter(); for (entity, controller, stats, body, vel, physics, mut character) in ( &entities, @@ -51,7 +54,7 @@ impl<'a> System<'a> for Sys { if stats.is_dead { // Respawn if controller.respawn { - event_emitter.emit(Event::Respawn(entity)); + server_emitter.emit(ServerEvent::Respawn(entity)); } continue; } @@ -140,10 +143,10 @@ impl<'a> System<'a> for Sys { time_left: Duration::from_millis(600), }; } - + // Jump if controller.jump && physics.on_ground && vel.0.z <= 0.0 { - event_emitter.emit(Event::Jump(entity)); + local_emitter.emit(LocalEvent::Jump(entity)); } } } diff --git a/common/src/sys/phys.rs b/common/src/sys/phys.rs index b8bfd11cce..ad31ff7188 100644 --- a/common/src/sys/phys.rs +++ b/common/src/sys/phys.rs @@ -1,7 +1,7 @@ use { crate::{ comp::{Body, MovementState::*, Ori, PhysicsState, Pos, Scale, Stats, Vel}, - event::{Event, EventBus}, + event::{ServerEvent, EventBus}, state::DeltaTime, terrain::TerrainMap, vol::{ReadVol, Vox}, @@ -34,7 +34,7 @@ impl<'a> System<'a> for Sys { Entities<'a>, ReadExpect<'a, TerrainMap>, Read<'a, DeltaTime>, - Read<'a, EventBus>, + Read<'a, EventBus>, ReadStorage<'a, Scale>, ReadStorage<'a, Body>, WriteStorage<'a, PhysicsState>, @@ -211,7 +211,7 @@ impl<'a> System<'a> for Sys { on_ground = true; if !was_on_ground { - event_emitter.emit(Event::LandOnGround { entity, vel: vel.0 }); + event_emitter.emit(ServerEvent::LandOnGround { entity, vel: vel.0 }); } } diff --git a/common/src/sys/stats.rs b/common/src/sys/stats.rs index 1ebd322a2c..e461a1fad7 100644 --- a/common/src/sys/stats.rs +++ b/common/src/sys/stats.rs @@ -1,6 +1,6 @@ use crate::{ comp::{HealthSource, Stats}, - event::{Event, EventBus}, + event::{ServerEvent, EventBus}, state::DeltaTime, }; use log::warn; @@ -12,7 +12,7 @@ impl<'a> System<'a> for Sys { type SystemData = ( Entities<'a>, Read<'a, DeltaTime>, - Read<'a, EventBus>, + Read<'a, EventBus>, WriteStorage<'a, Stats>, ); @@ -21,7 +21,7 @@ impl<'a> System<'a> for Sys { for (entity, mut stat) in (&entities, &mut stats).join() { if stat.should_die() && !stat.is_dead { - event_emitter.emit(Event::Die { + event_emitter.emit(ServerEvent::Die { entity, cause: match stat.health.last_change { Some(change) => change.2, diff --git a/server/src/cmd.rs b/server/src/cmd.rs index e03e28bdc1..675cee77b4 100644 --- a/server/src/cmd.rs +++ b/server/src/cmd.rs @@ -6,7 +6,7 @@ use crate::Server; use chrono::{NaiveTime, Timelike}; use common::{ comp, - event::{Event as GameEvent, EventBus}, + event::{ServerEvent, EventBus}, msg::ServerMsg, npc::{get_npc_name, NpcKind}, state::TimeOfDay, @@ -741,8 +741,8 @@ fn handle_explosion(server: &mut Server, entity: EcsEntity, args: String, action Some(pos) => server .state .ecs() - .read_resource::() - .emit(GameEvent::Explosion { pos: pos.0, radius }), + .read_resource::>() + .emit(ServerEvent::Explosion { pos: pos.0, radius }), None => server.clients.notify( entity, ServerMsg::private(String::from("You have no position!")), diff --git a/server/src/lib.rs b/server/src/lib.rs index 8eb3cbd0e1..0eba3c5ff5 100644 --- a/server/src/lib.rs +++ b/server/src/lib.rs @@ -18,7 +18,7 @@ use crate::{ }; use common::{ comp, - event::{Event as GameEvent, EventBus}, + event::{EventBus, ServerEvent}, msg::{ClientMsg, ClientState, RequestStateError, ServerError, ServerInfo, ServerMsg}, net::PostOffice, state::{BlockChange, State, TimeOfDay, Uid}, @@ -37,7 +37,6 @@ use vek::*; use world::{ChunkSupplement, World}; const CLIENT_TIMEOUT: f64 = 20.0; // Seconds -const HUMANOID_JUMP_ACCEL: f32 = 18.0; pub enum Event { ClientConnected { @@ -88,7 +87,7 @@ impl Server { state .ecs_mut() .add_resource(SpawnPoint(Vec3::new(16_384.0, 16_384.0, 512.0))); - state.ecs_mut().add_resource(EventBus::default()); + state.ecs_mut().add_resource(EventBus::::default()); // Set starting time for the server. state.ecs_mut().write_resource::().0 = settings.start_time; @@ -218,7 +217,7 @@ impl Server { fn handle_events(&mut self) { let clients = &mut self.clients; - let events = self.state.ecs().read_resource::().recv_all(); + let events = self.state.ecs().read_resource::>().recv_all(); for event in events { let ecs = self.state.ecs_mut(); let mut todo_remove = None; @@ -231,7 +230,7 @@ impl Server { let mut force_updates = ecs.write_storage::(); match event { - GameEvent::LandOnGround { entity, vel } => { + ServerEvent::LandOnGround { entity, vel } => { if let Some(stats) = stats.get_mut(entity) { let falldmg = (vel.z / 1.5 + 10.0) as i32; if falldmg < 0 { @@ -239,7 +238,7 @@ impl Server { } } } - GameEvent::Explosion { pos, radius } => { + ServerEvent::Explosion { pos, radius } => { const RAYS: usize = 500; for _ in 0..RAYS { @@ -257,13 +256,7 @@ impl Server { .cast(); } } - GameEvent::Jump(entity) => { - if let Some(vel) = velocities.get_mut(entity) { - vel.0.z = HUMANOID_JUMP_ACCEL; - let _ = force_updates.insert(entity, comp::ForceUpdate); - } - } - GameEvent::Die { entity, cause } => { + ServerEvent::Die { entity, cause } => { // Chat message if let Some(player) = ecs.read_storage::().get(entity) { let msg = if let comp::HealthSource::Attack { by } = cause { @@ -308,7 +301,7 @@ impl Server { todo_remove = Some(entity.clone()); } } - GameEvent::Respawn(entity) => { + ServerEvent::Respawn(entity) => { // Only clients can respawn if let Some(client) = clients.get_mut(&entity) { client.allow_state(ClientState::Character); From 3258fa3a3c4185b401c465f58cbad69bef3f6794 Mon Sep 17 00:00:00 2001 From: timokoesters Date: Sun, 25 Aug 2019 14:27:17 +0200 Subject: [PATCH 20/33] Add basis for projectiles But we have no controller action to spawn them yet --- common/src/event.rs | 1 + server/src/lib.rs | 197 ++++++++++++++++++++++++++++---------------- 2 files changed, 125 insertions(+), 73 deletions(-) diff --git a/common/src/event.rs b/common/src/event.rs index a5ed0840fb..b655b645bd 100644 --- a/common/src/event.rs +++ b/common/src/event.rs @@ -22,6 +22,7 @@ pub enum ServerEvent { cause: comp::HealthSource, }, Respawn(EcsEntity), + Shoot(EcsEntity), } pub struct EventBus { diff --git a/server/src/lib.rs b/server/src/lib.rs index 0eba3c5ff5..5cb1b69d43 100644 --- a/server/src/lib.rs +++ b/server/src/lib.rs @@ -87,7 +87,9 @@ impl Server { state .ecs_mut() .add_resource(SpawnPoint(Vec3::new(16_384.0, 16_384.0, 512.0))); - state.ecs_mut().add_resource(EventBus::::default()); + state + .ecs_mut() + .add_resource(EventBus::::default()); // Set starting time for the server. state.ecs_mut().write_resource::().0 = settings.start_time; @@ -176,6 +178,22 @@ impl Server { //.with(comp::LightEmitter::default()) } + /// Build a projectile + pub fn create_projectile( + state: &mut State, + pos: comp::Pos, + vel: comp::Vel, + body: comp::Body, + ) -> EcsEntityBuilder { + state + .ecs_mut() + .create_entity_synced() + .with(pos) + .with(vel) + .with(comp::Ori(Vec3::unit_y())) + .with(body) + } + pub fn create_player_character( state: &mut State, entity: EcsEntity, @@ -215,70 +233,95 @@ impl Server { /// Handle events coming through via the event bus fn handle_events(&mut self) { - let clients = &mut self.clients; - - let events = self.state.ecs().read_resource::>().recv_all(); + let events = self + .state + .ecs() + .read_resource::>() + .recv_all(); for event in events { - let ecs = self.state.ecs_mut(); - let mut todo_remove = None; - { - let terrain = ecs.read_resource::(); - let mut block_change = ecs.write_resource::(); - let mut stats = ecs.write_storage::(); - let mut positions = ecs.write_storage::(); - let mut velocities = ecs.write_storage::(); - let mut force_updates = ecs.write_storage::(); + let state = &mut self.state; + let clients = &mut self.clients; - match event { - ServerEvent::LandOnGround { entity, vel } => { - if let Some(stats) = stats.get_mut(entity) { - let falldmg = (vel.z / 1.5 + 10.0) as i32; - if falldmg < 0 { - stats.health.change_by(falldmg, comp::HealthSource::World); - } + match event { + ServerEvent::LandOnGround { entity, vel } => { + if let Some(stats) = state + .ecs_mut() + .write_storage::() + .get_mut(entity) + { + let falldmg = (vel.z / 1.5 + 10.0) as i32; + if falldmg < 0 { + stats.health.change_by(falldmg, comp::HealthSource::World); } } - ServerEvent::Explosion { pos, radius } => { - const RAYS: usize = 500; + } - for _ in 0..RAYS { - let dir = Vec3::new( - rand::random::() - 0.5, - rand::random::() - 0.5, - rand::random::() - 0.5, - ) - .normalized(); + ServerEvent::Explosion { pos, radius } => { + const RAYS: usize = 500; - let _ = terrain - .ray(pos, pos + dir * radius) - .until(|_| rand::random::() < 0.05) - .for_each(|pos| block_change.set(pos, Block::empty())) - .cast(); - } + for _ in 0..RAYS { + let dir = Vec3::new( + rand::random::() - 0.5, + rand::random::() - 0.5, + rand::random::() - 0.5, + ) + .normalized(); + + let ecs = state.ecs_mut(); + let mut block_change = ecs.write_resource::(); + + let _ = ecs + .read_resource::() + .ray(pos, pos + dir * radius) + .until(|_| rand::random::() < 0.05) + .for_each(|pos| block_change.set(pos, Block::empty())) + .cast(); } - ServerEvent::Die { entity, cause } => { - // Chat message - if let Some(player) = ecs.read_storage::().get(entity) { - let msg = if let comp::HealthSource::Attack { by } = cause { - ecs.entity_from_uid(by.into()).and_then(|attacker| { - ecs.read_storage::().get(attacker).map( - |attacker_alias| { - format!( - "{} was killed by {}", - &player.alias, &attacker_alias.alias - ) - }, - ) - }) - } else { - None - } - .unwrap_or(format!("{} died", &player.alias)); + } - clients.notify_registered(ServerMsg::kill(msg)); + ServerEvent::Shoot(entity) => { + let pos = state + .ecs() + .read_storage::() + .get(entity) + .unwrap() + .0; + Self::create_projectile( + state, + comp::Pos(pos), + comp::Vel(Vec3::new(0.0, 100.0, 3.0)), + comp::Body::Object(comp::object::Body::Bomb), + ) + .build(); + } + + ServerEvent::Die { entity, cause } => { + let ecs = state.ecs_mut(); + // Chat message + if let Some(player) = ecs.read_storage::().get(entity) { + let msg = if let comp::HealthSource::Attack { by } = cause { + ecs.entity_from_uid(by.into()).and_then(|attacker| { + ecs.read_storage::().get(attacker).map( + |attacker_alias| { + format!( + "{} was killed by {}", + &player.alias, &attacker_alias.alias + ) + }, + ) + }) + } else { + None } + .unwrap_or(format!("{} died", &player.alias)); + clients.notify_registered(ServerMsg::kill(msg)); + } + + { // Give EXP to the client + let mut stats = ecs.write_storage::(); + if let Some(entity_stats) = stats.get(entity).cloned() { if let comp::HealthSource::Attack { by } = cause { ecs.entity_from_uid(by.into()).map(|attacker| { @@ -292,29 +335,37 @@ impl Server { }); } } - - if let Some(client) = clients.get_mut(&entity) { - let _ = velocities.insert(entity, comp::Vel(Vec3::zero())); - let _ = force_updates.insert(entity, comp::ForceUpdate); - client.force_state(ClientState::Dead); - } else { - todo_remove = Some(entity.clone()); - } } - ServerEvent::Respawn(entity) => { - // Only clients can respawn - if let Some(client) = clients.get_mut(&entity) { - client.allow_state(ClientState::Character); - stats.get_mut(entity).map(|stats| stats.revive()); - positions.get_mut(entity).map(|pos| pos.0.z += 20.0); - let _ = force_updates.insert(entity, comp::ForceUpdate); - } + + if let Some(client) = clients.get_mut(&entity) { + let _ = ecs.write_storage().insert(entity, comp::Vel(Vec3::zero())); + let _ = ecs.write_storage().insert(entity, comp::ForceUpdate); + client.force_state(ClientState::Dead); + } else { + let _ = state.ecs_mut().delete_entity_synced(entity); } } - } - if let Some(entity) = todo_remove { - let _ = ecs.delete_entity_synced(entity); + ServerEvent::Respawn(entity) => { + // Only clients can respawn + if let Some(client) = clients.get_mut(&entity) { + client.allow_state(ClientState::Character); + state + .ecs_mut() + .write_storage::() + .get_mut(entity) + .map(|stats| stats.revive()); + state + .ecs_mut() + .write_storage::() + .get_mut(entity) + .map(|pos| pos.0.z += 20.0); + let _ = state + .ecs_mut() + .write_storage() + .insert(entity, comp::ForceUpdate); + } + } } } } From 01410569a4124746c3efa1e7ecc5f82ada6d6de2 Mon Sep 17 00:00:00 2001 From: timokoesters Date: Sun, 25 Aug 2019 14:29:36 +0200 Subject: [PATCH 21/33] Use look_dir when blocking --- common/src/sys/movement.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/common/src/sys/movement.rs b/common/src/sys/movement.rs index 99c9bb2d47..6462a2c6c3 100644 --- a/common/src/sys/movement.rs +++ b/common/src/sys/movement.rs @@ -94,7 +94,10 @@ impl<'a> System<'a> for Sys { }; // Set direction based on move direction when on the ground - let ori_dir = if character.action.is_wield() || character.action.is_attack() { + let ori_dir = if character.action.is_wield() + || character.action.is_attack() + || character.action.is_block() + { Vec2::from(controller.look_dir).normalized() } else { Vec2::from(vel.0) From a715a84ea7097e68081807220227421b51dc13f5 Mon Sep 17 00:00:00 2001 From: timokoesters Date: Sun, 25 Aug 2019 18:08:00 +0200 Subject: [PATCH 22/33] Implement unstoppable rolling --- Cargo.lock | 14 +++++------ Cargo.toml | 3 +++ client/Cargo.toml | 2 +- common/src/sys/controller.rs | 9 +++---- common/src/sys/movement.rs | 47 +++++++++++++++++++++--------------- voxygen/Cargo.toml | 2 +- 6 files changed, 41 insertions(+), 36 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 614a386441..ce2fa28742 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -832,7 +832,7 @@ name = "euc" version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "vek 0.9.8 (registry+https://github.com/rust-lang/crates.io-index)", + "vek 0.9.8", ] [[package]] @@ -3026,7 +3026,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "vek" version = "0.9.8" -source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "approx 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "num-integer 0.1.41 (registry+https://github.com/rust-lang/crates.io-index)", @@ -3055,7 +3054,7 @@ dependencies = [ "num_cpus 1.10.1 (registry+https://github.com/rust-lang/crates.io-index)", "specs 0.14.3 (registry+https://github.com/rust-lang/crates.io-index)", "uvth 3.1.1 (registry+https://github.com/rust-lang/crates.io-index)", - "vek 0.9.8 (registry+https://github.com/rust-lang/crates.io-index)", + "vek 0.9.8", "veloren-common 0.3.0", ] @@ -3084,7 +3083,7 @@ dependencies = [ "specs 0.14.3 (registry+https://github.com/rust-lang/crates.io-index)", "specs-idvs 0.1.0 (git+https://gitlab.com/veloren/specs-idvs.git)", "sphynx 0.1.0 (git+https://gitlab.com/veloren/sphynx.git?rev=11cdc7422568aaabd376c87242a60f636e68b40d)", - "vek 0.9.8 (registry+https://github.com/rust-lang/crates.io-index)", + "vek 0.9.8", ] [[package]] @@ -3103,7 +3102,7 @@ dependencies = [ "serde_derive 1.0.98 (registry+https://github.com/rust-lang/crates.io-index)", "specs 0.14.3 (registry+https://github.com/rust-lang/crates.io-index)", "uvth 3.1.1 (registry+https://github.com/rust-lang/crates.io-index)", - "vek 0.9.8 (registry+https://github.com/rust-lang/crates.io-index)", + "vek 0.9.8", "veloren-common 0.3.0", "veloren-world 0.3.0", ] @@ -3155,7 +3154,7 @@ dependencies = [ "serde_derive 1.0.98 (registry+https://github.com/rust-lang/crates.io-index)", "simplelog 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", "specs 0.14.3 (registry+https://github.com/rust-lang/crates.io-index)", - "vek 0.9.8 (registry+https://github.com/rust-lang/crates.io-index)", + "vek 0.9.8", "veloren-client 0.3.0", "veloren-common 0.3.0", "veloren-server 0.3.0", @@ -3172,7 +3171,7 @@ dependencies = [ "noise 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", "rand_chacha 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", - "vek 0.9.8 (registry+https://github.com/rust-lang/crates.io-index)", + "vek 0.9.8", "veloren-common 0.3.0", "zerocopy 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -3722,7 +3721,6 @@ dependencies = [ "checksum utf8-ranges 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "b4ae116fef2b7fea257ed6440d3cfcff7f190865f170cdad00bb6465bf18ecba" "checksum uvth 3.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "e59a167890d173eb0fcd7a1b99b84dc05c521ae8d76599130b8e19bef287abbf" "checksum vec_map 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)" = "05c78687fb1a80548ae3250346c3db86a80a7cdd77bda190189f2d0a0987c81a" -"checksum vek 0.9.8 (registry+https://github.com/rust-lang/crates.io-index)" = "1c95e5c5c123ecdb4a1a27a590f053a6c6de4b6ea696f4f0ef99054ead450258" "checksum version_check 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "914b1a6776c4c929a602fafd8bc742e06365d4bcbe48c30f9cca5824f70dc9dd" "checksum void 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "6a02e4885ed3bc0f2de90ea6dd45ebcbb66dacffe03547fadbb0eeae2770887d" "checksum walkdir 2.2.9 (registry+https://github.com/rust-lang/crates.io-index)" = "9658c94fa8b940eab2250bd5a457f9c48b748420d71293b165c8cdbe2f55f71e" diff --git a/Cargo.toml b/Cargo.toml index 435991041f..1b51b40d34 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -17,3 +17,6 @@ overflow-checks = false debug = true codegen-units = 1 lto = true + +[patch.crates-io] +vek = { path = "../vek" } diff --git a/client/Cargo.toml b/client/Cargo.toml index 1a105b8e4f..02736a0e51 100644 --- a/client/Cargo.toml +++ b/client/Cargo.toml @@ -11,5 +11,5 @@ uvth = "3.1.1" num_cpus = "1.10.1" log = "0.4.8" specs = "0.14.2" -vek = "0.9.8" +vek = { path = "../../vek", features=["serde"] } hashbrown = { version = "0.5.0", features = ["serde", "nightly"] } diff --git a/common/src/sys/controller.rs b/common/src/sys/controller.rs index 79a12d7a17..7d71080db7 100644 --- a/common/src/sys/controller.rs +++ b/common/src/sys/controller.rs @@ -73,13 +73,10 @@ impl<'a> System<'a> for Sys { } // Look - if controller + controller.look_dir = controller .look_dir - .map(|n| !n.is_normal() || n.abs() < std::f32::EPSILON) - .reduce_or() - { - controller.look_dir = controller.move_dir.into(); - } + .try_normalized() + .unwrap_or(controller.move_dir.into()); // Glide if controller.glide diff --git a/common/src/sys/movement.rs b/common/src/sys/movement.rs index 6462a2c6c3..8675470bb2 100644 --- a/common/src/sys/movement.rs +++ b/common/src/sys/movement.rs @@ -17,8 +17,7 @@ const WIELD_ACCEL: f32 = 70.0; const WIELD_SPEED: f32 = 120.0; const HUMANOID_AIR_ACCEL: f32 = 10.0; const HUMANOID_AIR_SPEED: f32 = 100.0; -const ROLL_ACCEL: f32 = 160.0; -const ROLL_SPEED: f32 = 550.0; +const ROLL_SPEED: f32 = 13.0; const GLIDE_ACCEL: f32 = 15.0; const GLIDE_SPEED: f32 = 45.0; // Gravity is 9.81 * 4, so this makes gravity equal to .15 @@ -74,24 +73,32 @@ impl<'a> System<'a> for Sys { continue; } - // Move player according to move_dir - vel.0 += Vec2::broadcast(dt.0) - * controller.move_dir - * match (physics.on_ground, &character.movement) { - (true, Run) if vel.0.magnitude_squared() < HUMANOID_SPEED.powf(2.0) => { - HUMANOID_ACCEL - } - (false, Glide) if vel.0.magnitude_squared() < GLIDE_SPEED.powf(2.0) => { - GLIDE_ACCEL - } - (false, Jump) if vel.0.magnitude_squared() < HUMANOID_AIR_SPEED.powf(2.0) => { - HUMANOID_AIR_ACCEL - } - (true, Roll { .. }) if vel.0.magnitude_squared() < ROLL_SPEED.powf(2.0) => { - ROLL_ACCEL - } - _ => 0.0, - }; + if character.movement.is_roll() { + vel.0 = controller + .move_dir + .try_normalized() + .map(Vec3::from) + .unwrap_or(vel.0.normalized()) + * ROLL_SPEED; + } else { + // Move player according to move_dir + vel.0 += Vec2::broadcast(dt.0) + * controller.move_dir + * match (physics.on_ground, &character.movement) { + (true, Run) if vel.0.magnitude_squared() < HUMANOID_SPEED.powf(2.0) => { + HUMANOID_ACCEL + } + (false, Glide) if vel.0.magnitude_squared() < GLIDE_SPEED.powf(2.0) => { + GLIDE_ACCEL + } + (false, Jump) + if vel.0.magnitude_squared() < HUMANOID_AIR_SPEED.powf(2.0) => + { + HUMANOID_AIR_ACCEL + } + _ => 0.0, + }; + } // Set direction based on move direction when on the ground let ori_dir = if character.action.is_wield() diff --git a/voxygen/Cargo.toml b/voxygen/Cargo.toml index 4d1b597034..92f61204fa 100644 --- a/voxygen/Cargo.toml +++ b/voxygen/Cargo.toml @@ -30,7 +30,7 @@ euc = "0.3.0" specs = "0.14.2" # Mathematics -vek = "0.9.8" +vek = { path = "../../vek", features=["serde"] } # discord discord-rpc-sdk = { git = "https://github.com/Songtronix/rust-discord-rpc.git", optional = true } From b96557d012ea08f23c0ea6b3aff4bea1a3b1782f Mon Sep 17 00:00:00 2001 From: timokoesters Date: Sun, 25 Aug 2019 18:47:45 +0200 Subject: [PATCH 23/33] Fix roll from cliff bug --- common/src/sys/movement.rs | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/common/src/sys/movement.rs b/common/src/sys/movement.rs index 8675470bb2..1819593dd8 100644 --- a/common/src/sys/movement.rs +++ b/common/src/sys/movement.rs @@ -74,12 +74,13 @@ impl<'a> System<'a> for Sys { } if character.movement.is_roll() { - vel.0 = controller - .move_dir - .try_normalized() - .map(Vec3::from) - .unwrap_or(vel.0.normalized()) - * ROLL_SPEED; + vel.0 = Vec3::new(0.0, 0.0, vel.0.z) + + controller + .move_dir + .try_normalized() + .map(|m| m) + .unwrap_or(Vec2::from(vel.0).normalized()) + * ROLL_SPEED } else { // Move player according to move_dir vel.0 += Vec2::broadcast(dt.0) From eb34e5bb273ccfd550a430eba6f0d951464dccba Mon Sep 17 00:00:00 2001 From: timokoesters Date: Sun, 25 Aug 2019 18:48:12 +0200 Subject: [PATCH 24/33] fmt --- common/src/state.rs | 8 ++++---- common/src/sys/controller.rs | 4 ++-- common/src/sys/phys.rs | 2 +- common/src/sys/stats.rs | 2 +- server/src/cmd.rs | 2 +- voxygen/src/anim/character/block.rs | 21 +++++++-------------- voxygen/src/anim/character/mod.rs | 5 ++--- voxygen/src/scene/figure.rs | 14 ++++++-------- 8 files changed, 24 insertions(+), 34 deletions(-) diff --git a/common/src/state.rs b/common/src/state.rs index 179f6ee360..f6d9084ee7 100644 --- a/common/src/state.rs +++ b/common/src/state.rs @@ -314,15 +314,15 @@ impl State { &mut self.ecs.write_resource::().blocks, Default::default(), ); - + // Process local events let events = self.ecs.read_resource::>().recv_all(); for event in events { { let mut velocities = self.ecs.write_storage::(); let mut force_updates = self.ecs.write_storage::(); - - match event { + + match event { LocalEvent::Jump(entity) => { if let Some(vel) = velocities.get_mut(entity) { vel.0.z = HUMANOID_JUMP_ACCEL; @@ -333,7 +333,7 @@ impl State { } } } - + /// Clean up the state after a tick. pub fn cleanup(&mut self) { // Clean up data structures from the last tick. diff --git a/common/src/sys/controller.rs b/common/src/sys/controller.rs index 7d71080db7..f97db742e3 100644 --- a/common/src/sys/controller.rs +++ b/common/src/sys/controller.rs @@ -3,7 +3,7 @@ use crate::{ ActionState::*, Body, CharacterState, Controller, MovementState::*, PhysicsState, Stats, Vel, }, - event::{EventBus, ServerEvent, LocalEvent}, + event::{EventBus, LocalEvent, ServerEvent}, }; use specs::{Entities, Join, Read, ReadStorage, System, WriteStorage}; use std::time::Duration; @@ -140,7 +140,7 @@ impl<'a> System<'a> for Sys { time_left: Duration::from_millis(600), }; } - + // Jump if controller.jump && physics.on_ground && vel.0.z <= 0.0 { local_emitter.emit(LocalEvent::Jump(entity)); diff --git a/common/src/sys/phys.rs b/common/src/sys/phys.rs index ad31ff7188..1d379dbb4c 100644 --- a/common/src/sys/phys.rs +++ b/common/src/sys/phys.rs @@ -1,7 +1,7 @@ use { crate::{ comp::{Body, MovementState::*, Ori, PhysicsState, Pos, Scale, Stats, Vel}, - event::{ServerEvent, EventBus}, + event::{EventBus, ServerEvent}, state::DeltaTime, terrain::TerrainMap, vol::{ReadVol, Vox}, diff --git a/common/src/sys/stats.rs b/common/src/sys/stats.rs index e461a1fad7..3aeb11746d 100644 --- a/common/src/sys/stats.rs +++ b/common/src/sys/stats.rs @@ -1,6 +1,6 @@ use crate::{ comp::{HealthSource, Stats}, - event::{ServerEvent, EventBus}, + event::{EventBus, ServerEvent}, state::DeltaTime, }; use log::warn; diff --git a/server/src/cmd.rs b/server/src/cmd.rs index 675cee77b4..f920f1d0f6 100644 --- a/server/src/cmd.rs +++ b/server/src/cmd.rs @@ -6,7 +6,7 @@ use crate::Server; use chrono::{NaiveTime, Timelike}; use common::{ comp, - event::{ServerEvent, EventBus}, + event::{EventBus, ServerEvent}, msg::ServerMsg, npc::{get_npc_name, NpcKind}, state::TimeOfDay, diff --git a/voxygen/src/anim/character/block.rs b/voxygen/src/anim/character/block.rs index f1b98b7ac0..72e08d2a05 100644 --- a/voxygen/src/anim/character/block.rs +++ b/voxygen/src/anim/character/block.rs @@ -45,16 +45,17 @@ impl Animation for BlockAnimation { 1.0 + skeleton_attr.neck_forward, skeleton_attr.neck_height + 13.5 + wave_ultra_slow * 0.2, ); - next.head.ori = - Quaternion::rotation_x(-0.25); + next.head.ori = Quaternion::rotation_x(-0.25); next.head.scale = Vec3::one() * 1.01 * skeleton_attr.head_scale; next.chest.offset = Vec3::new(0.0 + wave_slow_cos * 0.2, 0.0, 5.0 + wave_ultra_slow * 0.2); - next.chest.ori = Quaternion::rotation_x(-0.15) * Quaternion::rotation_y(wave_ultra_slow_cos * 0.01); + next.chest.ori = + Quaternion::rotation_x(-0.15) * Quaternion::rotation_y(wave_ultra_slow_cos * 0.01); next.chest.scale = Vec3::one(); next.belt.offset = Vec3::new(0.0 + wave_slow_cos * 0.2, 0.0, 3.0 + wave_ultra_slow * 0.2); - next.belt.ori = Quaternion::rotation_x(0.0) * Quaternion::rotation_y(wave_ultra_slow_cos * 0.008); + next.belt.ori = + Quaternion::rotation_x(0.0) * Quaternion::rotation_y(wave_ultra_slow_cos * 0.008); next.belt.scale = Vec3::one() * 1.01; next.shorts.offset = Vec3::new(0.0 + wave_slow_cos * 0.2, 0.0, 1.0 + wave_ultra_slow * 0.2); @@ -64,18 +65,10 @@ impl Animation for BlockAnimation { match Tool::Hammer { //TODO: Inventory Tool::Sword => { - next.l_hand.offset = Vec3::new( - -6.0, - 3.5, - 0.0 + wave_ultra_slow * 1.0, - ); + next.l_hand.offset = Vec3::new(-6.0, 3.5, 0.0 + wave_ultra_slow * 1.0); next.l_hand.ori = Quaternion::rotation_x(-0.3); next.l_hand.scale = Vec3::one() * 1.01; - next.r_hand.offset = Vec3::new( - -6.0, - 3.0, - -2.0, - ); + next.r_hand.offset = Vec3::new(-6.0, 3.0, -2.0); next.r_hand.ori = Quaternion::rotation_x(-0.3); next.r_hand.scale = Vec3::one() * 1.01; next.weapon.offset = Vec3::new( diff --git a/voxygen/src/anim/character/mod.rs b/voxygen/src/anim/character/mod.rs index e497818193..138ca93a2b 100644 --- a/voxygen/src/anim/character/mod.rs +++ b/voxygen/src/anim/character/mod.rs @@ -1,4 +1,5 @@ pub mod attack; +pub mod block; pub mod cidle; pub mod cjump; pub mod crun; @@ -7,10 +8,10 @@ pub mod idle; pub mod jump; pub mod roll; pub mod run; -pub mod block; // Reexports pub use self::attack::AttackAnimation; +pub use self::block::BlockAnimation; pub use self::cidle::CidleAnimation; pub use self::cjump::CjumpAnimation; pub use self::crun::CrunAnimation; @@ -19,8 +20,6 @@ pub use self::idle::IdleAnimation; pub use self::jump::JumpAnimation; pub use self::roll::RollAnimation; pub use self::run::RunAnimation; -pub use self::block::BlockAnimation; - use super::{Bone, Skeleton}; use crate::render::FigureBoneData; diff --git a/voxygen/src/scene/figure.rs b/voxygen/src/scene/figure.rs index 4843d7dd6c..ece30c60ec 100644 --- a/voxygen/src/scene/figure.rs +++ b/voxygen/src/scene/figure.rs @@ -693,14 +693,12 @@ impl FigureMgr { skeleton_attr, ) } - comp::Animation::Block => { - anim::character::BlockAnimation::update_skeleton( - state.skeleton_mut(), - time, - animation_info.time, - skeleton_attr, - ) - } + comp::Animation::Block => anim::character::BlockAnimation::update_skeleton( + state.skeleton_mut(), + time, + animation_info.time, + skeleton_attr, + ), comp::Animation::Cjump => anim::character::CjumpAnimation::update_skeleton( state.skeleton_mut(), time, From 05f2f168fd36ced5f26b9c865f69006d53fc2c15 Mon Sep 17 00:00:00 2001 From: timokoesters Date: Sun, 25 Aug 2019 20:31:56 +0200 Subject: [PATCH 25/33] Make falldamage local, don't use force update for local, cleanup --- common/src/event.rs | 5 +---- common/src/state.rs | 22 +++++++++++++--------- common/src/sys/phys.rs | 6 +++--- server/src/lib.rs | 13 ------------- 4 files changed, 17 insertions(+), 29 deletions(-) diff --git a/common/src/event.rs b/common/src/event.rs index b655b645bd..fc081c3e01 100644 --- a/common/src/event.rs +++ b/common/src/event.rs @@ -6,13 +6,10 @@ use vek::*; pub enum LocalEvent { Jump(EcsEntity), + LandOnGround { entity: EcsEntity, vel: Vec3 }, } pub enum ServerEvent { - LandOnGround { - entity: EcsEntity, - vel: Vec3, - }, Explosion { pos: Vec3, radius: f32, diff --git a/common/src/state.rs b/common/src/state.rs index f6d9084ee7..6d18e06fea 100644 --- a/common/src/state.rs +++ b/common/src/state.rs @@ -318,18 +318,22 @@ impl State { // Process local events let events = self.ecs.read_resource::>().recv_all(); for event in events { - { - let mut velocities = self.ecs.write_storage::(); - let mut force_updates = self.ecs.write_storage::(); - - match event { - LocalEvent::Jump(entity) => { - if let Some(vel) = velocities.get_mut(entity) { - vel.0.z = HUMANOID_JUMP_ACCEL; - let _ = force_updates.insert(entity, comp::ForceUpdate); + let mut velocities = self.ecs.write_storage::(); + match event { + LocalEvent::LandOnGround { entity, vel } => { + if let Some(stats) = self.ecs.write_storage::().get_mut(entity) { + let falldmg = (vel.z / 1.5 + 10.0) as i32; + if falldmg < 0 { + stats.health.change_by(falldmg, comp::HealthSource::World); } } } + + LocalEvent::Jump(entity) => { + if let Some(vel) = velocities.get_mut(entity) { + vel.0.z = HUMANOID_JUMP_ACCEL; + } + } } } } diff --git a/common/src/sys/phys.rs b/common/src/sys/phys.rs index 1d379dbb4c..cd16ee87a3 100644 --- a/common/src/sys/phys.rs +++ b/common/src/sys/phys.rs @@ -1,7 +1,7 @@ use { crate::{ comp::{Body, MovementState::*, Ori, PhysicsState, Pos, Scale, Stats, Vel}, - event::{EventBus, ServerEvent}, + event::{EventBus, LocalEvent}, state::DeltaTime, terrain::TerrainMap, vol::{ReadVol, Vox}, @@ -34,7 +34,7 @@ impl<'a> System<'a> for Sys { Entities<'a>, ReadExpect<'a, TerrainMap>, Read<'a, DeltaTime>, - Read<'a, EventBus>, + Read<'a, EventBus>, ReadStorage<'a, Scale>, ReadStorage<'a, Body>, WriteStorage<'a, PhysicsState>, @@ -211,7 +211,7 @@ impl<'a> System<'a> for Sys { on_ground = true; if !was_on_ground { - event_emitter.emit(ServerEvent::LandOnGround { entity, vel: vel.0 }); + event_emitter.emit(LocalEvent::LandOnGround { entity, vel: vel.0 }); } } diff --git a/server/src/lib.rs b/server/src/lib.rs index 5cb1b69d43..2c4eaf6ef2 100644 --- a/server/src/lib.rs +++ b/server/src/lib.rs @@ -243,19 +243,6 @@ impl Server { let clients = &mut self.clients; match event { - ServerEvent::LandOnGround { entity, vel } => { - if let Some(stats) = state - .ecs_mut() - .write_storage::() - .get_mut(entity) - { - let falldmg = (vel.z / 1.5 + 10.0) as i32; - if falldmg < 0 { - stats.health.change_by(falldmg, comp::HealthSource::World); - } - } - } - ServerEvent::Explosion { pos, radius } => { const RAYS: usize = 500; From 98f8196a169ed1d9aeb007a3179b8a6980751f06 Mon Sep 17 00:00:00 2001 From: timokoesters Date: Sun, 25 Aug 2019 21:09:10 +0200 Subject: [PATCH 26/33] Put combat related values into constants --- common/src/sys/combat.rs | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/common/src/sys/combat.rs b/common/src/sys/combat.rs index a3c4282663..b9e2e12bce 100644 --- a/common/src/sys/combat.rs +++ b/common/src/sys/combat.rs @@ -8,6 +8,15 @@ use specs::{Entities, Join, Read, ReadStorage, System, WriteStorage}; use std::time::Duration; use vek::*; +const BASE_DMG: i32 = 10; +const BLOCK_EFFICIENCY: f32 = 0.9; + +const ATTACK_RANGE: f32 = 4.0; +const BLOCK_ANGLE: f32 = 180.0; + +const KNOCKBACK_XY: f32 = 2.0; +const KNOCKBACK_Z: f32 = 2.0; + /// This system is responsible for handling accepted inputs like moving or attacking pub struct Sys; impl<'a> System<'a> for Sys { @@ -60,6 +69,7 @@ impl<'a> System<'a> for Sys { ) .join() { + // 2D versions let pos2 = Vec2::from(pos.0); let pos_b2: Vec2 = Vec2::from(pos_b.0); let ori2 = Vec2::from(ori.0); @@ -67,24 +77,25 @@ impl<'a> System<'a> for Sys { // Check if it is a hit if entity != b && !stat_b.is_dead - && pos.0.distance_squared(pos_b.0) < 20.0 + && pos.0.distance_squared(pos_b.0) < ATTACK_RANGE.powi(2) // TODO: Use size instead of 1.0 && ori2.angle_between(pos_b2 - pos2) < (1.0 / pos2.distance(pos_b2)).atan() { let dmg = if character_b.action.is_block() - && ori_b.0.angle_between(pos.0 - pos_b.0).to_degrees() < 90.0 + && ori_b.0.angle_between(pos.0 - pos_b.0).to_degrees() + < BLOCK_ANGLE / 2.0 { - 1 + (BASE_DMG as f32 * (1.0 - BLOCK_EFFICIENCY)) as i32 } else { - 10 + BASE_DMG }; // Deal damage stat_b .health .change_by(-dmg, HealthSource::Attack { by: *uid }); // TODO: variable damage and weapon - vel_b.0 += (pos_b.0 - pos.0).normalized() * 2.0; - vel_b.0.z = 2.0; + vel_b.0 += (pos_b.0 - pos.0).normalized() * KNOCKBACK_XY; + vel_b.0.z = KNOCKBACK_Z; let _ = force_updates.insert(b, ForceUpdate); } } From c278ac992768ce8bd0409394ca55e963f411ac2d Mon Sep 17 00:00:00 2001 From: timokoesters Date: Sun, 25 Aug 2019 21:14:10 +0200 Subject: [PATCH 27/33] Add todo making glide an ability/item --- common/src/sys/controller.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common/src/sys/controller.rs b/common/src/sys/controller.rs index f97db742e3..7c445ba9fd 100644 --- a/common/src/sys/controller.rs +++ b/common/src/sys/controller.rs @@ -79,11 +79,11 @@ impl<'a> System<'a> for Sys { .unwrap_or(controller.move_dir.into()); // Glide + // TODO: Check for glide ability/item if controller.glide && !physics.on_ground && (character.action == Idle || character.action.is_wield()) && character.movement == Jump - // TODO: Ask zesterer if we can remove this && body.is_humanoid() { character.movement = Glide; From 08fa6a3414179c298373d3426c5f4adbf84b62ef Mon Sep 17 00:00:00 2001 From: timokoesters Date: Sun, 25 Aug 2019 21:22:56 +0200 Subject: [PATCH 28/33] Prevent problems with no vel while rolling in the future --- common/src/sys/movement.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common/src/sys/movement.rs b/common/src/sys/movement.rs index 1819593dd8..c8d738390e 100644 --- a/common/src/sys/movement.rs +++ b/common/src/sys/movement.rs @@ -79,7 +79,7 @@ impl<'a> System<'a> for Sys { .move_dir .try_normalized() .map(|m| m) - .unwrap_or(Vec2::from(vel.0).normalized()) + .unwrap_or(Vec2::from(vel.0).try_normalized().unwrap_or_default()) * ROLL_SPEED } else { // Move player according to move_dir From b89bfcbfc12d3d80ab198111bd12b63149657529 Mon Sep 17 00:00:00 2001 From: timokoesters Date: Sun, 25 Aug 2019 21:24:02 +0200 Subject: [PATCH 29/33] Remove unnecessary map --- common/src/sys/movement.rs | 1 - 1 file changed, 1 deletion(-) diff --git a/common/src/sys/movement.rs b/common/src/sys/movement.rs index c8d738390e..ef33e2e691 100644 --- a/common/src/sys/movement.rs +++ b/common/src/sys/movement.rs @@ -78,7 +78,6 @@ impl<'a> System<'a> for Sys { + controller .move_dir .try_normalized() - .map(|m| m) .unwrap_or(Vec2::from(vel.0).try_normalized().unwrap_or_default()) * ROLL_SPEED } else { From c4879307af35599cc71ec6e11e74a131bf39fc47 Mon Sep 17 00:00:00 2001 From: timokoesters Date: Sun, 25 Aug 2019 22:37:48 +0200 Subject: [PATCH 30/33] Update to github vek repo --- Cargo.lock | 16 +++++++++------- Cargo.toml | 2 +- client/Cargo.toml | 2 +- common/Cargo.toml | 2 +- server/Cargo.toml | 2 +- voxygen/Cargo.toml | 2 +- world/Cargo.toml | 2 +- 7 files changed, 15 insertions(+), 13 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index ce2fa28742..024da266a6 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -832,7 +832,7 @@ name = "euc" version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "vek 0.9.8", + "vek 0.9.9 (git+https://github.com/timokoesters/vek)", ] [[package]] @@ -3025,7 +3025,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "vek" -version = "0.9.8" +version = "0.9.9" +source = "git+https://github.com/timokoesters/vek#43daee981ef206ce5d8f5933cbb7c0b00b5d5c11" dependencies = [ "approx 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "num-integer 0.1.41 (registry+https://github.com/rust-lang/crates.io-index)", @@ -3054,7 +3055,7 @@ dependencies = [ "num_cpus 1.10.1 (registry+https://github.com/rust-lang/crates.io-index)", "specs 0.14.3 (registry+https://github.com/rust-lang/crates.io-index)", "uvth 3.1.1 (registry+https://github.com/rust-lang/crates.io-index)", - "vek 0.9.8", + "vek 0.9.9 (git+https://github.com/timokoesters/vek)", "veloren-common 0.3.0", ] @@ -3083,7 +3084,7 @@ dependencies = [ "specs 0.14.3 (registry+https://github.com/rust-lang/crates.io-index)", "specs-idvs 0.1.0 (git+https://gitlab.com/veloren/specs-idvs.git)", "sphynx 0.1.0 (git+https://gitlab.com/veloren/sphynx.git?rev=11cdc7422568aaabd376c87242a60f636e68b40d)", - "vek 0.9.8", + "vek 0.9.9 (git+https://github.com/timokoesters/vek)", ] [[package]] @@ -3102,7 +3103,7 @@ dependencies = [ "serde_derive 1.0.98 (registry+https://github.com/rust-lang/crates.io-index)", "specs 0.14.3 (registry+https://github.com/rust-lang/crates.io-index)", "uvth 3.1.1 (registry+https://github.com/rust-lang/crates.io-index)", - "vek 0.9.8", + "vek 0.9.9 (git+https://github.com/timokoesters/vek)", "veloren-common 0.3.0", "veloren-world 0.3.0", ] @@ -3154,7 +3155,7 @@ dependencies = [ "serde_derive 1.0.98 (registry+https://github.com/rust-lang/crates.io-index)", "simplelog 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", "specs 0.14.3 (registry+https://github.com/rust-lang/crates.io-index)", - "vek 0.9.8", + "vek 0.9.9 (git+https://github.com/timokoesters/vek)", "veloren-client 0.3.0", "veloren-common 0.3.0", "veloren-server 0.3.0", @@ -3171,7 +3172,7 @@ dependencies = [ "noise 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", "rand_chacha 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", - "vek 0.9.8", + "vek 0.9.9 (git+https://github.com/timokoesters/vek)", "veloren-common 0.3.0", "zerocopy 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -3721,6 +3722,7 @@ dependencies = [ "checksum utf8-ranges 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "b4ae116fef2b7fea257ed6440d3cfcff7f190865f170cdad00bb6465bf18ecba" "checksum uvth 3.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "e59a167890d173eb0fcd7a1b99b84dc05c521ae8d76599130b8e19bef287abbf" "checksum vec_map 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)" = "05c78687fb1a80548ae3250346c3db86a80a7cdd77bda190189f2d0a0987c81a" +"checksum vek 0.9.9 (git+https://github.com/timokoesters/vek)" = "" "checksum version_check 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "914b1a6776c4c929a602fafd8bc742e06365d4bcbe48c30f9cca5824f70dc9dd" "checksum void 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "6a02e4885ed3bc0f2de90ea6dd45ebcbb66dacffe03547fadbb0eeae2770887d" "checksum walkdir 2.2.9 (registry+https://github.com/rust-lang/crates.io-index)" = "9658c94fa8b940eab2250bd5a457f9c48b748420d71293b165c8cdbe2f55f71e" diff --git a/Cargo.toml b/Cargo.toml index 1b51b40d34..31307b7c04 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -19,4 +19,4 @@ codegen-units = 1 lto = true [patch.crates-io] -vek = { path = "../vek" } +vek = { git = "https://github.com/timokoesters/vek" } diff --git a/client/Cargo.toml b/client/Cargo.toml index 02736a0e51..3a86842939 100644 --- a/client/Cargo.toml +++ b/client/Cargo.toml @@ -11,5 +11,5 @@ uvth = "3.1.1" num_cpus = "1.10.1" log = "0.4.8" specs = "0.14.2" -vek = { path = "../../vek", features=["serde"] } +vek = { version = "0.9.9", features = ["serde"] } hashbrown = { version = "0.5.0", features = ["serde", "nightly"] } diff --git a/common/Cargo.toml b/common/Cargo.toml index f26fde7800..2f6be96e4b 100644 --- a/common/Cargo.toml +++ b/common/Cargo.toml @@ -9,7 +9,7 @@ sphynx = { git = "https://gitlab.com/veloren/sphynx.git", features = ["serde1"], specs-idvs = { git = "https://gitlab.com/veloren/specs-idvs.git" } specs = { version = "0.14.2", features = ["serde", "nightly"] } -vek = { version = "0.9.8", features = ["serde"] } +vek = { version = "0.9.9", features = ["serde"] } dot_vox = "4.0.0" image = "0.22.0" mio = "0.6.19" diff --git a/server/Cargo.toml b/server/Cargo.toml index 2affc8e118..ee4bc0f604 100644 --- a/server/Cargo.toml +++ b/server/Cargo.toml @@ -10,7 +10,7 @@ world = { package = "veloren-world", path = "../world" } log = "0.4.8" specs = "0.14.2" -vek = "0.9.8" +vek = "0.9.9" uvth = "3.1.1" lazy_static = "1.3.0" scan_fmt = "0.2.3" diff --git a/voxygen/Cargo.toml b/voxygen/Cargo.toml index 92f61204fa..67f9008899 100644 --- a/voxygen/Cargo.toml +++ b/voxygen/Cargo.toml @@ -30,7 +30,7 @@ euc = "0.3.0" specs = "0.14.2" # Mathematics -vek = { path = "../../vek", features=["serde"] } +vek = { version = "0.9.8", features = ["serde"] } # discord discord-rpc-sdk = { git = "https://github.com/Songtronix/rust-discord-rpc.git", optional = true } diff --git a/world/Cargo.toml b/world/Cargo.toml index 4c27a4dadf..773a86cb3b 100644 --- a/world/Cargo.toml +++ b/world/Cargo.toml @@ -6,7 +6,7 @@ edition = "2018" [dependencies] common = { package = "veloren-common", path = "../common" } -vek = "0.9.8" +vek = "0.9.9" noise = "0.5.1" hashbrown = { version = "0.5.0", features = ["serde", "nightly"] } lazy_static = "1.3.0" From a7747fe9650c4a47a2dd9f90b1d84237990b5fdb Mon Sep 17 00:00:00 2001 From: timokoesters Date: Sun, 25 Aug 2019 22:40:59 +0200 Subject: [PATCH 31/33] Simplify code --- common/src/sys/combat.rs | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/common/src/sys/combat.rs b/common/src/sys/combat.rs index b9e2e12bce..9b2b74f278 100644 --- a/common/src/sys/combat.rs +++ b/common/src/sys/combat.rs @@ -52,8 +52,6 @@ impl<'a> System<'a> for Sys { for (entity, uid, pos, ori, controller) in (&entities, &uids, &positions, &orientations, &controllers).join() { - let mut todo_end = false; - // Go through all other entities if let Some(Attack { time_left, applied }) = &mut character_states.get(entity).map(|c| c.action) @@ -108,7 +106,11 @@ impl<'a> System<'a> for Sys { *applied = true; if *time_left == Duration::default() { - todo_end = true; + if let Some(character) = &mut character_states.get_mut(entity) { + character.action = Wield { + time_left: Duration::default(), + }; + } } else { *time_left = time_left .checked_sub(Duration::from_secs_f32(dt.0)) @@ -116,13 +118,6 @@ impl<'a> System<'a> for Sys { } } } - if todo_end { - if let Some(character) = &mut character_states.get_mut(entity) { - character.action = Wield { - time_left: Duration::default(), - }; - } - } if let Some(Wield { time_left }) = &mut character_states.get_mut(entity).map(|c| &mut c.action) From 84d0f61596ba59c342a4df81a36f323bc4263f9e Mon Sep 17 00:00:00 2001 From: timokoesters Date: Mon, 26 Aug 2019 13:11:37 +0200 Subject: [PATCH 32/33] Make pipeline succeed --- voxygen/src/anim/character/block.rs | 4 ++-- voxygen/src/session.rs | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/voxygen/src/anim/character/block.rs b/voxygen/src/anim/character/block.rs index 72e08d2a05..e62654ec0e 100644 --- a/voxygen/src/anim/character/block.rs +++ b/voxygen/src/anim/character/block.rs @@ -26,9 +26,9 @@ impl Animation for BlockAnimation { let wave_ultra_slow = (anim_time as f32 * 3.0 + PI).sin(); let wave_ultra_slow_cos = (anim_time as f32 * 3.0 + PI).cos(); let wave_slow_cos = (anim_time as f32 * 6.0 + PI).cos(); - let wave_slow = (anim_time as f32 * 6.0 + PI).sin(); + let _wave_slow = (anim_time as f32 * 6.0 + PI).sin(); - let head_look = Vec2::new( + let _head_look = Vec2::new( ((global_time + anim_time) as f32 / 1.5) .floor() .mul(7331.0) diff --git a/voxygen/src/session.rs b/voxygen/src/session.rs index 1bbfad91e6..854f1674b8 100644 --- a/voxygen/src/session.rs +++ b/voxygen/src/session.rs @@ -2,7 +2,7 @@ use crate::{ hud::{DebugInfo, Event as HudEvent, Hud}, key_state::KeyState, render::Renderer, - scene::{camera::Camera, Scene}, + scene::Scene, window::{Event, GameInput}, Direction, Error, GlobalState, PlayState, PlayStateResult, }; From 269d179243b9aea6c685c65ed99dcc1e1cfbcb2d Mon Sep 17 00:00:00 2001 From: timokoesters Date: Mon, 26 Aug 2019 14:21:04 +0200 Subject: [PATCH 33/33] Remove vek patch, it's on crates.io now --- Cargo.lock | 251 ++++++++++++++++++++++++++++++----------------------- Cargo.toml | 3 - 2 files changed, 143 insertions(+), 111 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 024da266a6..51d992a1dc 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -123,12 +123,12 @@ dependencies = [ [[package]] name = "autocfg" -version = "0.1.5" +version = "0.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "backtrace" -version = "0.3.34" +version = "0.3.35" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "backtrace-sys 0.1.31 (registry+https://github.com/rust-lang/crates.io-index)", @@ -159,9 +159,9 @@ name = "bincode" version = "1.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "autocfg 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", + "autocfg 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", "byteorder 1.3.2 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.98 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.99 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -194,7 +194,7 @@ dependencies = [ "clang-sys 0.21.2 (registry+https://github.com/rust-lang/crates.io-index)", "clap 2.33.0 (registry+https://github.com/rust-lang/crates.io-index)", "env_logger 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)", - "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", "peeking_take_while 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "proc-macro2 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", @@ -220,12 +220,12 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "blake2b_simd" -version = "0.5.6" +version = "0.5.7" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "arrayref 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)", "arrayvec 0.4.11 (registry+https://github.com/rust-lang/crates.io-index)", - "constant_time_eq 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", + "constant_time_eq 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -248,7 +248,7 @@ name = "c2-chacha" version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "ppv-lite86 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -372,7 +372,7 @@ dependencies = [ "bitflags 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "strsim 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", "textwrap 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", - "unicode-width 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", + "unicode-width 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", "vec_map 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -459,7 +459,7 @@ source = "git+https://gitlab.com/veloren/conrod.git#d603363488870eae9df91ba45ba7 [[package]] name = "constant_time_eq" -version = "0.1.3" +version = "0.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] @@ -540,7 +540,7 @@ dependencies = [ "alsa-sys 0.1.1 (git+https://github.com/desttinghim/cpal?rev=e7c086d0afc368a888ad133c3b1d928b16986130)", "core-foundation-sys 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", "coreaudio-rs 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)", - "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.62 (registry+https://github.com/rust-lang/crates.io-index)", "stdweb 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", @@ -633,7 +633,7 @@ dependencies = [ "arrayvec 0.4.11 (registry+https://github.com/rust-lang/crates.io-index)", "cfg-if 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", "crossbeam-utils 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", - "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "memoffset 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", "scopeguard 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -646,7 +646,7 @@ dependencies = [ "arrayvec 0.4.11 (registry+https://github.com/rust-lang/crates.io-index)", "cfg-if 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", "crossbeam-utils 0.6.6 (registry+https://github.com/rust-lang/crates.io-index)", - "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "memoffset 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", "scopeguard 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -659,7 +659,7 @@ dependencies = [ "arrayvec 0.4.11 (registry+https://github.com/rust-lang/crates.io-index)", "cfg-if 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", "crossbeam-utils 0.6.6 (registry+https://github.com/rust-lang/crates.io-index)", - "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "memoffset 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", "scopeguard 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -683,7 +683,7 @@ version = "0.6.6" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "cfg-if 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", - "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -775,7 +775,7 @@ version = "4.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "byteorder 1.3.2 (registry+https://github.com/rust-lang/crates.io-index)", - "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", "nom 4.2.3 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -832,7 +832,7 @@ name = "euc" version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "vek 0.9.9 (git+https://github.com/timokoesters/vek)", + "vek 0.9.9 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -859,7 +859,7 @@ name = "failure" version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "backtrace 0.3.34 (registry+https://github.com/rust-lang/crates.io-index)", + "backtrace 0.3.35 (registry+https://github.com/rust-lang/crates.io-index)", "failure_derive 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1025,7 +1025,7 @@ dependencies = [ [[package]] name = "getrandom" -version = "0.1.9" +version = "0.1.11" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "cfg-if 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1111,7 +1111,7 @@ dependencies = [ "glib 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", "glib-sys 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", "gobject-sys 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", - "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.62 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1139,7 +1139,7 @@ dependencies = [ [[package]] name = "gl_generator" -version = "0.13.0" +version = "0.13.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "khronos_api 3.1.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1152,7 +1152,7 @@ name = "gleam" version = "0.6.19" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "gl_generator 0.13.0 (registry+https://github.com/rust-lang/crates.io-index)", + "gl_generator 0.13.1 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1163,7 +1163,7 @@ dependencies = [ "bitflags 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "glib-sys 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", "gobject-sys 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", - "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.62 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1187,7 +1187,7 @@ name = "glsl-include" version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "regex 1.1.9 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1207,7 +1207,7 @@ dependencies = [ "glutin_gles2_sys 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", "glutin_glx_sys 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", "glutin_wgl_sys 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", - "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "libloading 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)", "objc 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)", "osmesa-sys 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1287,7 +1287,7 @@ dependencies = [ "glib-sys 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", "gobject-sys 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", "gtk-sys 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", - "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.62 (registry+https://github.com/rust-lang/crates.io-index)", "pango 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1324,7 +1324,7 @@ name = "hashbrown" version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "serde 1.0.98 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.99 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1362,7 +1362,7 @@ dependencies = [ "byteorder 1.3.2 (registry+https://github.com/rust-lang/crates.io-index)", "enum_primitive 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "gif 0.9.2 (registry+https://github.com/rust-lang/crates.io-index)", - "jpeg-decoder 0.1.15 (registry+https://github.com/rust-lang/crates.io-index)", + "jpeg-decoder 0.1.16 (registry+https://github.com/rust-lang/crates.io-index)", "num-iter 0.1.39 (registry+https://github.com/rust-lang/crates.io-index)", "num-rational 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)", "num-traits 0.1.43 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1377,7 +1377,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "byteorder 1.3.2 (registry+https://github.com/rust-lang/crates.io-index)", "gif 0.10.2 (registry+https://github.com/rust-lang/crates.io-index)", - "jpeg-decoder 0.1.15 (registry+https://github.com/rust-lang/crates.io-index)", + "jpeg-decoder 0.1.16 (registry+https://github.com/rust-lang/crates.io-index)", "lzw 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)", "num-iter 0.1.39 (registry+https://github.com/rust-lang/crates.io-index)", "num-rational 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1442,7 +1442,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "jpeg-decoder" -version = "0.1.15" +version = "0.1.16" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "byteorder 1.3.2 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1470,7 +1470,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "lazy_static" -version = "1.3.0" +version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] @@ -1499,7 +1499,7 @@ version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", - "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1639,7 +1639,7 @@ dependencies = [ [[package]] name = "minifb" version = "0.12.0" -source = "git+https://github.com/emoon/rust_minifb.git#85459c8b437568e56331378532aa706fbbb5343d" +source = "git+https://github.com/emoon/rust_minifb.git#e20257db793bef59d62abe29dcd9b5408dd1f20d" dependencies = [ "cast 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", "cc 1.0.40 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1713,7 +1713,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "msgbox" version = "0.1.1" -source = "git+https://github.com/bekker/msgbox-rs.git#cff1e50e6e2de971a6995d9ce062d5e394a45d45" +source = "git+https://github.com/bekker/msgbox-rs.git#3310a258ac49d6c0b6eb1a6c71a6361eddb28a57" dependencies = [ "cocoa 0.14.0 (registry+https://github.com/rust-lang/crates.io-index)", "gtk 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1838,7 +1838,7 @@ name = "num-complex" version = "0.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "autocfg 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", + "autocfg 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", "num-traits 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1857,7 +1857,7 @@ name = "num-integer" version = "0.1.41" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "autocfg 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", + "autocfg 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", "num-traits 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1866,7 +1866,7 @@ name = "num-iter" version = "0.1.39" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "autocfg 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", + "autocfg 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", "num-integer 0.1.41 (registry+https://github.com/rust-lang/crates.io-index)", "num-traits 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1885,7 +1885,7 @@ name = "num-rational" version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "autocfg 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", + "autocfg 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", "num-bigint 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", "num-integer 0.1.41 (registry+https://github.com/rust-lang/crates.io-index)", "num-traits 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1904,7 +1904,7 @@ name = "num-traits" version = "0.2.8" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "autocfg 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", + "autocfg 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -2146,8 +2146,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "bitflags 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "piston-viewport 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.98 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_derive 1.0.98 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.99 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_derive 1.0.99 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -2192,7 +2192,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "pretty_env_logger" -version = "0.3.0" +version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "chrono 0.4.7 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2216,6 +2216,14 @@ dependencies = [ "unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "proc-macro2" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "unicode-xid 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "quasi" version = "0.32.0" @@ -2257,6 +2265,14 @@ dependencies = [ "proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "quote" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "proc-macro2 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "rand" version = "0.3.23" @@ -2295,7 +2311,7 @@ name = "rand" version = "0.6.5" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "autocfg 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", + "autocfg 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.62 (registry+https://github.com/rust-lang/crates.io-index)", "rand_chacha 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "rand_core 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2313,7 +2329,7 @@ name = "rand" version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "getrandom 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", + "getrandom 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.62 (registry+https://github.com/rust-lang/crates.io-index)", "rand_chacha 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", "rand_core 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2325,7 +2341,7 @@ name = "rand_chacha" version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "autocfg 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", + "autocfg 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", "rand_core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -2356,7 +2372,7 @@ name = "rand_core" version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "getrandom 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", + "getrandom 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -2411,7 +2427,7 @@ name = "rand_pcg" version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "autocfg 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", + "autocfg 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", "rand_core 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -2441,7 +2457,7 @@ dependencies = [ "crossbeam-deque 0.6.3 (registry+https://github.com/rust-lang/crates.io-index)", "crossbeam-queue 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "crossbeam-utils 0.6.6 (registry+https://github.com/rust-lang/crates.io-index)", - "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "num_cpus 1.10.1 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -2515,7 +2531,7 @@ dependencies = [ "claxon 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", "cpal 0.8.2 (git+https://github.com/desttinghim/cpal?rev=e7c086d0afc368a888ad133c3b1d928b16986130)", "hound 3.4.0 (registry+https://github.com/rust-lang/crates.io-index)", - "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "lewton 0.9.4 (registry+https://github.com/rust-lang/crates.io-index)", "minimp3 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -2527,7 +2543,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "base64 0.10.1 (registry+https://github.com/rust-lang/crates.io-index)", "bitflags 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.98 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.99 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -2536,7 +2552,7 @@ version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "base64 0.10.1 (registry+https://github.com/rust-lang/crates.io-index)", - "blake2b_simd 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)", + "blake2b_simd 0.5.7 (registry+https://github.com/rust-lang/crates.io-index)", "crossbeam-utils 0.6.6 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -2624,7 +2640,7 @@ version = "0.32.2" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "bitflags 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", - "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.62 (registry+https://github.com/rust-lang/crates.io-index)", "num 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2655,20 +2671,20 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "serde" -version = "1.0.98" +version = "1.0.99" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "serde_derive 1.0.98 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_derive 1.0.99 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "serde_derive" -version = "1.0.98" +version = "1.0.99" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)", - "quote 0.6.13 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 0.15.44 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -2678,7 +2694,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "itoa 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)", "ryu 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.98 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.99 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -2686,7 +2702,7 @@ name = "shared_library" version = "0.1.9" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.62 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -2755,7 +2771,7 @@ dependencies = [ "andrew 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", "bitflags 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "dlib 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)", - "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "memmap 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", "nix 0.14.1 (registry+https://github.com/rust-lang/crates.io-index)", "wayland-client 0.21.13 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2776,7 +2792,7 @@ dependencies = [ "mopa 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", "nonzero_signed 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)", "rayon 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.98 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.99 (registry+https://github.com/rust-lang/crates.io-index)", "shred 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)", "shred-derive 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", "shrev 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2797,8 +2813,8 @@ name = "sphynx" version = "0.1.0" source = "git+https://gitlab.com/veloren/sphynx.git?rev=11cdc7422568aaabd376c87242a60f636e68b40d#11cdc7422568aaabd376c87242a60f636e68b40d" dependencies = [ - "serde 1.0.98 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_derive 1.0.98 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.99 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_derive 1.0.99 (registry+https://github.com/rust-lang/crates.io-index)", "shred 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)", "specs 0.14.3 (registry+https://github.com/rust-lang/crates.io-index)", "sum_type 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2852,6 +2868,16 @@ dependencies = [ "unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "syn" +version = "1.0.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "proc-macro2 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", + "unicode-xid 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "synstructure" version = "0.10.2" @@ -2929,7 +2955,7 @@ name = "termcolor" version = "1.0.5" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "wincolor 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", + "wincolor 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -2937,7 +2963,7 @@ name = "textwrap" version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "unicode-width 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", + "unicode-width 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -2945,7 +2971,7 @@ name = "thread_local" version = "0.3.6" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -2981,7 +3007,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "unicode-width" -version = "0.1.5" +version = "0.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] @@ -2994,6 +3020,11 @@ name = "unicode-xid" version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" +[[package]] +name = "unicode-xid" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" + [[package]] name = "user32-sys" version = "0.2.0" @@ -3026,13 +3057,13 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "vek" version = "0.9.9" -source = "git+https://github.com/timokoesters/vek#43daee981ef206ce5d8f5933cbb7c0b00b5d5c11" +source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "approx 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "num-integer 0.1.41 (registry+https://github.com/rust-lang/crates.io-index)", "num-traits 0.1.43 (registry+https://github.com/rust-lang/crates.io-index)", "rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.98 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.99 (registry+https://github.com/rust-lang/crates.io-index)", "static_assertions 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -3041,7 +3072,7 @@ name = "veloren-chat-cli" version = "0.3.0" dependencies = [ "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", - "pretty_env_logger 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "pretty_env_logger 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", "veloren-client 0.3.0", "veloren-common 0.3.0", ] @@ -3055,7 +3086,7 @@ dependencies = [ "num_cpus 1.10.1 (registry+https://github.com/rust-lang/crates.io-index)", "specs 0.14.3 (registry+https://github.com/rust-lang/crates.io-index)", "uvth 3.1.1 (registry+https://github.com/rust-lang/crates.io-index)", - "vek 0.9.9 (git+https://github.com/timokoesters/vek)", + "vek 0.9.9 (registry+https://github.com/rust-lang/crates.io-index)", "veloren-common 0.3.0", ] @@ -3069,7 +3100,7 @@ dependencies = [ "find_folder 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "hashbrown 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", "image 0.22.1 (registry+https://github.com/rust-lang/crates.io-index)", - "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", "lz4-compress 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "mio 0.6.19 (registry+https://github.com/rust-lang/crates.io-index)", @@ -3078,13 +3109,13 @@ dependencies = [ "parking_lot 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", "rayon 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.98 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_derive 1.0.98 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.99 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_derive 1.0.99 (registry+https://github.com/rust-lang/crates.io-index)", "serde_json 1.0.40 (registry+https://github.com/rust-lang/crates.io-index)", "specs 0.14.3 (registry+https://github.com/rust-lang/crates.io-index)", "specs-idvs 0.1.0 (git+https://gitlab.com/veloren/specs-idvs.git)", "sphynx 0.1.0 (git+https://gitlab.com/veloren/sphynx.git?rev=11cdc7422568aaabd376c87242a60f636e68b40d)", - "vek 0.9.9 (git+https://github.com/timokoesters/vek)", + "vek 0.9.9 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -3094,16 +3125,16 @@ dependencies = [ "chrono 0.4.7 (registry+https://github.com/rust-lang/crates.io-index)", "crossbeam 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)", "hashbrown 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", - "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", "ron 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", "scan_fmt 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.98 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_derive 1.0.98 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.99 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_derive 1.0.99 (registry+https://github.com/rust-lang/crates.io-index)", "specs 0.14.3 (registry+https://github.com/rust-lang/crates.io-index)", "uvth 3.1.1 (registry+https://github.com/rust-lang/crates.io-index)", - "vek 0.9.9 (git+https://github.com/timokoesters/vek)", + "vek 0.9.9 (registry+https://github.com/rust-lang/crates.io-index)", "veloren-common 0.3.0", "veloren-world 0.3.0", ] @@ -3114,7 +3145,7 @@ version = "0.3.0" dependencies = [ "heaptrack 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", - "pretty_env_logger 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "pretty_env_logger 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", "veloren-common 0.3.0", "veloren-server 0.3.0", ] @@ -3123,7 +3154,7 @@ dependencies = [ name = "veloren-voxygen" version = "0.3.0" dependencies = [ - "backtrace 0.3.34 (registry+https://github.com/rust-lang/crates.io-index)", + "backtrace 0.3.35 (registry+https://github.com/rust-lang/crates.io-index)", "conrod_core 0.63.0 (git+https://gitlab.com/veloren/conrod.git)", "conrod_winit 0.63.0 (git+https://gitlab.com/veloren/conrod.git)", "crossbeam 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)", @@ -3142,7 +3173,7 @@ dependencies = [ "hashbrown 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", "heaptrack 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "image 0.22.1 (registry+https://github.com/rust-lang/crates.io-index)", - "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", "msgbox 0.1.1 (git+https://github.com/bekker/msgbox-rs.git)", "num 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -3151,11 +3182,11 @@ dependencies = [ "rand 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", "rodio 0.8.1 (git+https://github.com/desttinghim/rodio.git?rev=dd93f905c1afefaac03c496a666ecab27d3e391b)", "ron 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.98 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_derive 1.0.98 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.99 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_derive 1.0.99 (registry+https://github.com/rust-lang/crates.io-index)", "simplelog 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", "specs 0.14.3 (registry+https://github.com/rust-lang/crates.io-index)", - "vek 0.9.9 (git+https://github.com/timokoesters/vek)", + "vek 0.9.9 (registry+https://github.com/rust-lang/crates.io-index)", "veloren-client 0.3.0", "veloren-common 0.3.0", "veloren-server 0.3.0", @@ -3167,12 +3198,12 @@ name = "veloren-world" version = "0.3.0" dependencies = [ "hashbrown 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", - "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "minifb 0.12.0 (git+https://github.com/emoon/rust_minifb.git)", "noise 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", "rand_chacha 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", - "vek 0.9.9 (git+https://github.com/timokoesters/vek)", + "vek 0.9.9 (registry+https://github.com/rust-lang/crates.io-index)", "veloren-common 0.3.0", "zerocopy 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -3253,7 +3284,7 @@ version = "0.21.13" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "dlib 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)", - "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -3303,7 +3334,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "wincolor" -version = "1.0.1" +version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", @@ -3316,18 +3347,18 @@ version = "0.19.2" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "android_glue 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", - "backtrace 0.3.34 (registry+https://github.com/rust-lang/crates.io-index)", + "backtrace 0.3.35 (registry+https://github.com/rust-lang/crates.io-index)", "bitflags 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "cocoa 0.18.4 (registry+https://github.com/rust-lang/crates.io-index)", "core-foundation 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)", "core-graphics 0.17.3 (registry+https://github.com/rust-lang/crates.io-index)", - "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.62 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", "objc 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)", "parking_lot 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", "percent-encoding 2.1.0 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.98 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.99 (registry+https://github.com/rust-lang/crates.io-index)", "smithay-client-toolkit 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "wayland-client 0.21.13 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", @@ -3348,7 +3379,7 @@ name = "x11-dl" version = "2.18.4" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.62 (registry+https://github.com/rust-lang/crates.io-index)", "maybe-uninit 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "pkg-config 0.3.15 (registry+https://github.com/rust-lang/crates.io-index)", @@ -3400,8 +3431,8 @@ dependencies = [ "checksum atk-sys 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "f8dc233521f7bffd3042c31082ea71bd08820abf44bac938fb36591e20f76f39" "checksum atom 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)" = "3c86699c3f02778ec07158376991c8f783dd1f2f95c579ffaf0738dc984b2fe2" "checksum atty 0.2.13 (registry+https://github.com/rust-lang/crates.io-index)" = "1803c647a3ec87095e7ae7acfca019e98de5ec9a7d01343f611cf3152ed71a90" -"checksum autocfg 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "22130e92352b948e7e82a49cdb0aa94f2211761117f29e052dd397c1ac33542b" -"checksum backtrace 0.3.34 (registry+https://github.com/rust-lang/crates.io-index)" = "b5164d292487f037ece34ec0de2fcede2faa162f085dd96d2385ab81b12765ba" +"checksum autocfg 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "b671c8fb71b457dd4ae18c4ba1e59aa81793daacc361d82fcd410cef0d491875" +"checksum backtrace 0.3.35 (registry+https://github.com/rust-lang/crates.io-index)" = "1371048253fa3bac6704bfd6bbfc922ee9bdcee8881330d40f308b81cc5adc55" "checksum backtrace-sys 0.1.31 (registry+https://github.com/rust-lang/crates.io-index)" = "82a830b4ef2d1124a711c71d263c5abdc710ef8e907bd508c88be475cebc422b" "checksum base64 0.10.1 (registry+https://github.com/rust-lang/crates.io-index)" = "0b25d992356d2eb0ed82172f5248873db5560c4721f564b13cb5193bda5e668e" "checksum bincode 1.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "9f04a5e50dc80b3d5d35320889053637d15011aed5e66b66b37ae798c65da6f7" @@ -3410,7 +3441,7 @@ dependencies = [ "checksum bitflags 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)" = "1370e9fc2a6ae53aea8b7a5110edbd08836ed87c88736dfabccade1c2b44bff4" "checksum bitflags 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)" = "4efd02e230a02e18f92fc2735f44597385ed02ad8f831e7c1c1156ee5e1ab3a5" "checksum bitflags 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3d155346769a6855b86399e9bc3814ab343cd3d62c7e985113d46a0ec3c281fd" -"checksum blake2b_simd 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)" = "461f4b879a8eb70c1debf7d0788a9a5ff15f1ea9d25925fea264ef4258bed6b2" +"checksum blake2b_simd 0.5.7 (registry+https://github.com/rust-lang/crates.io-index)" = "bf775a81bb2d464e20ff170ac20316c7b08a43d11dbc72f0f82e8e8d3d6d0499" "checksum block 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "0d8c1fef690941d3e7788d328517591fecc684c084084702d6ff1641e993699a" "checksum byteorder 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)" = "0fc10e8cc6b2580fda3f36eb6dc5316657f812a3df879a44a66fc9f0fdbc4855" "checksum byteorder 1.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "a7c3dd8985a7111efc5c80b44e23ecdd8c007de8ade3b96595387e812b957cf5" @@ -3438,7 +3469,7 @@ dependencies = [ "checksum conrod_core 0.63.0 (git+https://gitlab.com/veloren/conrod.git)" = "" "checksum conrod_derive 0.63.0 (git+https://gitlab.com/veloren/conrod.git)" = "" "checksum conrod_winit 0.63.0 (git+https://gitlab.com/veloren/conrod.git)" = "" -"checksum constant_time_eq 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "8ff012e225ce166d4422e0e78419d901719760f62ae2b7969ca6b564d1b54a9e" +"checksum constant_time_eq 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "995a44c877f9212528ccc74b21a232f66ad69001e40ede5bcee2ac9ef2657120" "checksum core-foundation 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "286e0b41c3a20da26536c6000a280585d519fd07b3956b43aed8a79e9edce980" "checksum core-foundation 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)" = "25b9e03f145fd4f2bf705e07b900cd41fc636598fe5dc452fd0db1441c3f496d" "checksum core-foundation-sys 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "716c271e8613ace48344f723b60b900a93150271e5be206212d052bbc0883efa" @@ -3500,7 +3531,7 @@ dependencies = [ "checksum gdk-pixbuf 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "c2d2199eba47ebcb9977ce28179649bdd59305ef465c4e6f9b65aaa41c24e6b5" "checksum gdk-pixbuf-sys 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "df6a3b73e04fafc07f5ebc083f1096a773412e627828e1103a55e921f81187d8" "checksum gdk-sys 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3162ff940526ddff71bf1f630facee6b5e05d282d125ba0c4c803842819b80c3" -"checksum getrandom 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)" = "2512b3191f22e2763a5db387f1c9409379772e2050841722eb4a8c4f497bf096" +"checksum getrandom 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)" = "fc344b02d3868feb131e8b5fe2b9b0a1cc42942679af493061fc13b853243872" "checksum gfx 0.18.1 (registry+https://github.com/rust-lang/crates.io-index)" = "619e38a31e275efaf92c6a94f977db8aac396e3cb6998c176cfde32ce3239b69" "checksum gfx_core 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)" = "4e1127b02a9d4fcc880091d8a0f4419efd598de4f1649edcd005c76e5792176f" "checksum gfx_device_gl 0.16.1 (registry+https://github.com/rust-lang/crates.io-index)" = "3fdb9c21d057f32d5a9fc7b8737a28e09a93006a095e0a129723b424cffd2003" @@ -3511,7 +3542,7 @@ dependencies = [ "checksum gio 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)" = "2db9fad8f1b0d4c7338a210a6cbdf081dcc1a3c223718c698c4f313f6c288acb" "checksum gio-sys 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "2a57872499171d279f8577ce83837da4cae62b08dd32892236ed67ab7ea61030" "checksum gl_generator 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "39a23d5e872a275135d66895d954269cf5e8661d234eb1c2480f4ce0d586acbd" -"checksum gl_generator 0.13.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1c08ca9be9c177722189cd6a956c9e604563a9c689587b548a8cd7d1d865b022" +"checksum gl_generator 0.13.1 (registry+https://github.com/rust-lang/crates.io-index)" = "ca98bbde17256e02d17336a6bdb5a50f7d0ccacee502e191d3e3d0ec2f96f84a" "checksum gleam 0.6.19 (registry+https://github.com/rust-lang/crates.io-index)" = "cae10d7c99d0e77b4766e850a60898a17c1abaf01075531f1066f03dc7dc5fc5" "checksum glib 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "5e0be1b1432e227bcd1a9b28db9dc1474a7e7fd4227e08e16f35304f32d09b61" "checksum glib-sys 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "615bef979b5838526aee99241afc80cfb2e34a8735d4bcb8ec6072598c18a408" @@ -3541,11 +3572,11 @@ dependencies = [ "checksum instant 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "d6706e8fb9de9be6143801a75747fa2209855b13d74ee994e30d86b38afdf77f" "checksum iovec 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "dbe6e417e7d0975db6512b90796e8ce223145ac4e33c377e4a42882a0e88bb08" "checksum itoa 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)" = "501266b7edd0174f8530248f87f99c88fbe60ca4ef3dd486835b8d8d53136f7f" -"checksum jpeg-decoder 0.1.15 (registry+https://github.com/rust-lang/crates.io-index)" = "c8b7d43206b34b3f94ea9445174bda196e772049b9bddbc620c9d29b2d20110d" +"checksum jpeg-decoder 0.1.16 (registry+https://github.com/rust-lang/crates.io-index)" = "c1aae18ffeeae409c6622c3b6a7ee49792a7e5a062eea1b135fbb74e301792ba" "checksum kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7507624b29483431c0ba2d82aece8ca6cdba9382bff4ddd0f7490560c056098d" "checksum khronos_api 3.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e2db585e1d738fc771bf08a151420d3ed193d9d895a36df7f6f8a9456b911ddc" "checksum lazy_static 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)" = "76f033c7ad61445c5b347c7382dd1237847eb1bce590fe50365dcb33d546be73" -"checksum lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "bc5729f27f159ddd61f4df6228e827e86643d4d3e7c32183cb30a1c08f604a14" +"checksum lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" "checksum lazycell 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "b294d6fa9ee409a054354afc4352b0b9ef7ca222c69b8812cbea9e7d2bf3783f" "checksum lewton 0.9.4 (registry+https://github.com/rust-lang/crates.io-index)" = "8d542c1a317036c45c2aa1cf10cc9d403ca91eb2d333ef1a4917e5cb10628bd0" "checksum libc 0.2.62 (registry+https://github.com/rust-lang/crates.io-index)" = "34fcd2c08d2f832f376f4173a231990fa5aef4e99fb569867318a227ef4c06ba" @@ -3626,14 +3657,16 @@ dependencies = [ "checksum png 0.15.0 (registry+https://github.com/rust-lang/crates.io-index)" = "8422b27bb2c013dd97b9aef69e161ce262236f49aaf46a0489011c8ff0264602" "checksum portpicker 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "5b497d05c16fe00939445c00a4fe2fa4f3d3dfc9c0401a3ab5c577afda2debb9" "checksum ppv-lite86 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)" = "e3cbf9f658cdb5000fcf6f362b8ea2ba154b9f146a61c7a20d647034c6b6561b" -"checksum pretty_env_logger 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "df8b3f4e0475def7d9c2e5de8e5a1306949849761e107b360d03e98eafaffd61" +"checksum pretty_env_logger 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "717ee476b1690853d222af4634056d830b5197ffd747726a9a1eee6da9f49074" "checksum proc-macro2 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "cd07deb3c6d1d9ff827999c7f9b04cdfd66b1b17ae508e14fe47b620f2282ae0" "checksum proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)" = "cf3d2011ab5c909338f7887f4fc896d35932e29146c12c8d01da6b22a80ba759" +"checksum proc-macro2 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "4c5c2380ae88876faae57698be9e9775e3544decad214599c3a6266cca6ac802" "checksum quasi 0.32.0 (registry+https://github.com/rust-lang/crates.io-index)" = "18c45c4854d6d1cf5d531db97c75880feb91c958b0720f4ec1057135fec358b3" "checksum quasi_codegen 0.32.0 (registry+https://github.com/rust-lang/crates.io-index)" = "51b9e25fa23c044c1803f43ca59c98dac608976dd04ce799411edd58ece776d4" "checksum quick-error 1.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "9274b940887ce9addde99c4eee6b5c44cc494b182b97e73dc8ffdcb3397fd3f0" "checksum quote 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "1eca14c727ad12702eb4b6bfb5a232287dcf8385cb8ca83a3eeaf6519c44c408" "checksum quote 0.6.13 (registry+https://github.com/rust-lang/crates.io-index)" = "6ce23b6b870e8f94f81fb0a363d65d86675884b34a09043c81e5562f11c1f8e1" +"checksum quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "053a8c8bcc71fcce321828dc897a98ab9760bef03a4fc36693c231e5b3216cfe" "checksum rand 0.3.23 (registry+https://github.com/rust-lang/crates.io-index)" = "64ac302d8f83c0c1974bf758f6b041c6c8ada916fbb44a609158ca8b064cc76c" "checksum rand 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)" = "552840b97013b1a26992c11eac34bdd778e464601a4c2054b5f0bff7c6761293" "checksum rand 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)" = "c618c47cd3ebd209790115ab837de41425723956ad3ce2e6a7f09890947cacb9" @@ -3678,8 +3711,8 @@ dependencies = [ "checksum sdl2-sys 0.32.6 (registry+https://github.com/rust-lang/crates.io-index)" = "34e71125077d297d57e4c1acfe8981b5bdfbf5a20e7b589abfdcb33bf1127f86" "checksum semver 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1d7eb9ef2c18661902cc47e535f9bc51b78acd254da71d375c2f6720d9a40403" "checksum semver-parser 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3" -"checksum serde 1.0.98 (registry+https://github.com/rust-lang/crates.io-index)" = "7fe5626ac617da2f2d9c48af5515a21d5a480dbd151e01bb1c355e26a3e68113" -"checksum serde_derive 1.0.98 (registry+https://github.com/rust-lang/crates.io-index)" = "01e69e1b8a631f245467ee275b8c757b818653c6d704cdbcaeb56b56767b529c" +"checksum serde 1.0.99 (registry+https://github.com/rust-lang/crates.io-index)" = "fec2851eb56d010dc9a21b89ca53ee75e6528bab60c11e89d38390904982da9f" +"checksum serde_derive 1.0.99 (registry+https://github.com/rust-lang/crates.io-index)" = "cb4dc18c61206b08dc98216c98faa0232f4337e1e1b8574551d5bad29ea1b425" "checksum serde_json 1.0.40 (registry+https://github.com/rust-lang/crates.io-index)" = "051c49229f282f7c6f3813f8286cc1e3323e8051823fce42c7ea80fe13521704" "checksum shared_library 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)" = "5a9e7e0f2bfae24d8a5b5a66c5b257a83c7412304311512a0c054cd5e619da11" "checksum shred 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)" = "6ea122e6133568144fcfb5888737d4ac776ebc959f989dd65b907136ac22bfed" @@ -3701,6 +3734,7 @@ dependencies = [ "checksum sum_type 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "da5b4a0c9f3c7c8e891e445a7c776627e208e8bba23ab680798066dd283e6a15" "checksum svg_fmt 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "20e5f95e89d737f30cd1f98a9af9a85c2a1cc162cfedfba5a0c54cf92d7206fc" "checksum syn 0.15.44 (registry+https://github.com/rust-lang/crates.io-index)" = "9ca4b3b69a77cbe1ffc9e198781b7acb0c7365a883670e8f1c1bc66fba79a5c5" +"checksum syn 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)" = "66850e97125af79138385e9b88339cbcd037e3f28ceab8c5ad98e64f0f1f80bf" "checksum synstructure 0.10.2 (registry+https://github.com/rust-lang/crates.io-index)" = "02353edf96d6e4dc81aea2d8490a7e9db177bf8acb0e951c24940bf866cb313f" "checksum syntex 0.58.1 (registry+https://github.com/rust-lang/crates.io-index)" = "a8f5e3aaa79319573d19938ea38d068056b826db9883a5d47f86c1cecc688f0e" "checksum syntex_errors 0.58.1 (registry+https://github.com/rust-lang/crates.io-index)" = "867cc5c2d7140ae7eaad2ae9e8bf39cb18a67ca651b7834f88d46ca98faadb9c" @@ -3715,14 +3749,15 @@ dependencies = [ "checksum time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)" = "db8dcfca086c1143c9270ac42a2bbd8a7ee477b78ac8e45b19abfb0cbede4b6f" "checksum tuple_utils 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "cbfecd7bb8f0a3e96b3b31c46af2677a55a588767c0091f484601424fcb20e7e" "checksum ucd-util 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "fa9b3b49edd3468c0e6565d85783f51af95212b6fa3986a5500954f00b460874" -"checksum unicode-width 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "882386231c45df4700b275c7ff55b6f3698780a650026380e72dabe76fa46526" +"checksum unicode-width 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "7007dbd421b92cc6e28410fe7362e2e0a2503394908f417b68ec8d1c364c4e20" "checksum unicode-xid 0.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "8c1f860d7d29cf02cb2f3f359fd35991af3d30bac52c57d265a3c461074cb4dc" "checksum unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "fc72304796d0818e357ead4e000d19c9c174ab23dc11093ac919054d20a6a7fc" +"checksum unicode-xid 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "826e7639553986605ec5979c7dd957c7895e93eabed50ab2ffa7f6128a75097c" "checksum user32-sys 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "4ef4711d107b21b410a3a974b1204d9accc8b10dad75d8324b5d755de1617d47" "checksum utf8-ranges 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "b4ae116fef2b7fea257ed6440d3cfcff7f190865f170cdad00bb6465bf18ecba" "checksum uvth 3.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "e59a167890d173eb0fcd7a1b99b84dc05c521ae8d76599130b8e19bef287abbf" "checksum vec_map 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)" = "05c78687fb1a80548ae3250346c3db86a80a7cdd77bda190189f2d0a0987c81a" -"checksum vek 0.9.9 (git+https://github.com/timokoesters/vek)" = "" +"checksum vek 0.9.9 (registry+https://github.com/rust-lang/crates.io-index)" = "144a7f53d9cd7d544beba89cf08eaaffd8c22ed24cc92ada7fd04ef904dcdc40" "checksum version_check 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "914b1a6776c4c929a602fafd8bc742e06365d4bcbe48c30f9cca5824f70dc9dd" "checksum void 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "6a02e4885ed3bc0f2de90ea6dd45ebcbb66dacffe03547fadbb0eeae2770887d" "checksum walkdir 2.2.9 (registry+https://github.com/rust-lang/crates.io-index)" = "9658c94fa8b940eab2250bd5a457f9c48b748420d71293b165c8cdbe2f55f71e" @@ -3739,7 +3774,7 @@ dependencies = [ "checksum winapi-i686-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" "checksum winapi-util 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7168bab6e1daee33b4557efd0e95d5ca70a03706d39fa5f3fe7a236f584b03c9" "checksum winapi-x86_64-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" -"checksum wincolor 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "561ed901ae465d6185fa7864d63fbd5720d0ef718366c9a4dc83cf6170d7e9ba" +"checksum wincolor 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "96f5016b18804d24db43cebf3c77269e7569b8954a8464501c216cc5e070eaa9" "checksum winit 0.19.2 (registry+https://github.com/rust-lang/crates.io-index)" = "dd67dc9e0f9e13da393d9b6fa13042f3aed9b2bb2db6717d72d4cc271970c415" "checksum ws2_32-sys 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "d59cefebd0c892fa2dd6de581e937301d8552cb44489cdff035c6187cb63fa5e" "checksum x11-dl 2.18.4 (registry+https://github.com/rust-lang/crates.io-index)" = "be65e1342a3baae65439cd03306778831a3d133b0d20243a7fb83fd5cf403c58" diff --git a/Cargo.toml b/Cargo.toml index 31307b7c04..435991041f 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -17,6 +17,3 @@ overflow-checks = false debug = true codegen-units = 1 lto = true - -[patch.crates-io] -vek = { git = "https://github.com/timokoesters/vek" }