mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
Remove crun and cidle components and inputs
This commit is contained in:
parent
e2c81dd036
commit
955c20fa61
@ -7,8 +7,6 @@ pub struct Controller {
|
||||
pub jump: bool,
|
||||
pub attack: bool,
|
||||
pub roll: bool,
|
||||
pub crun: bool,
|
||||
pub cidle: bool,
|
||||
pub glide: bool,
|
||||
pub respawn: bool,
|
||||
}
|
||||
|
@ -19,18 +19,6 @@ pub struct Rolling {
|
||||
pub applied: bool,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)]
|
||||
pub struct Crunning {
|
||||
pub time: f32,
|
||||
pub applied: bool,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)]
|
||||
pub struct Cidling {
|
||||
pub time: f32,
|
||||
pub applied: bool,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)]
|
||||
pub struct OnGround;
|
||||
|
||||
@ -62,23 +50,6 @@ impl Rolling {
|
||||
}
|
||||
}
|
||||
|
||||
impl Crunning {
|
||||
pub fn start() -> Self {
|
||||
Self {
|
||||
time: 0.0,
|
||||
applied: false,
|
||||
}
|
||||
}
|
||||
}
|
||||
impl Cidling {
|
||||
pub fn start() -> Self {
|
||||
Self {
|
||||
time: 0.0,
|
||||
applied: false,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl Component for MoveDir {
|
||||
type Storage = VecStorage<Self>;
|
||||
}
|
||||
@ -90,12 +61,7 @@ impl Component for Attacking {
|
||||
impl Component for Rolling {
|
||||
type Storage = FlaggedStorage<Self, VecStorage<Self>>;
|
||||
}
|
||||
impl Component for Crunning {
|
||||
type Storage = FlaggedStorage<Self, VecStorage<Self>>;
|
||||
}
|
||||
impl Component for Cidling {
|
||||
type Storage = FlaggedStorage<Self, VecStorage<Self>>;
|
||||
}
|
||||
|
||||
impl Component for OnGround {
|
||||
type Storage = NullStorage<Self>;
|
||||
}
|
||||
|
@ -18,8 +18,6 @@ pub use animation::Animation;
|
||||
pub use animation::AnimationInfo;
|
||||
pub use controller::Controller;
|
||||
pub use inputs::Attacking;
|
||||
pub use inputs::Cidling;
|
||||
pub use inputs::Crunning;
|
||||
pub use inputs::Gliding;
|
||||
pub use inputs::Jumping;
|
||||
pub use inputs::MoveDir;
|
||||
|
@ -25,8 +25,6 @@ sphynx::sum_type! {
|
||||
Stats(comp::Stats),
|
||||
Attacking(comp::Attacking),
|
||||
Rolling(comp::Rolling),
|
||||
Crunning(comp::Crunning),
|
||||
Cidling(comp::Cidling),
|
||||
|
||||
}
|
||||
}
|
||||
@ -43,8 +41,6 @@ sphynx::sum_type! {
|
||||
Stats(PhantomData<comp::Stats>),
|
||||
Attacking(PhantomData<comp::Attacking>),
|
||||
Rolling(PhantomData<comp::Rolling>),
|
||||
Crunning(PhantomData<comp::Crunning>),
|
||||
Cidling(PhantomData<comp::Cidling>),
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -104,8 +104,6 @@ impl State {
|
||||
ecs.register_synced::<comp::Stats>();
|
||||
ecs.register_synced::<comp::Attacking>(); // TODO: Don't send this to the client?
|
||||
ecs.register_synced::<comp::Rolling>(); // TODO: Don't send this to the client?
|
||||
ecs.register_synced::<comp::Crunning>(); // TODO: Don't send this to the client?
|
||||
ecs.register_synced::<comp::Cidling>(); // TODO: Don't send this to the client?
|
||||
ecs.register::<comp::phys::ForceUpdate>();
|
||||
|
||||
// Register components synced by other means
|
||||
|
@ -1,8 +1,5 @@
|
||||
use crate::{
|
||||
comp::{
|
||||
phys, Animation, AnimationInfo, Attacking, Cidling, Crunning, Gliding, Jumping, OnGround,
|
||||
Rolling,
|
||||
},
|
||||
comp::{phys, Animation, AnimationInfo, Attacking, Gliding, Jumping, OnGround, Rolling},
|
||||
state::DeltaTime,
|
||||
};
|
||||
use specs::{Entities, Join, Read, ReadStorage, System, WriteStorage};
|
||||
@ -19,8 +16,6 @@ impl<'a> System<'a> for Sys {
|
||||
ReadStorage<'a, Gliding>,
|
||||
ReadStorage<'a, Attacking>,
|
||||
ReadStorage<'a, Rolling>,
|
||||
ReadStorage<'a, Crunning>,
|
||||
ReadStorage<'a, Cidling>,
|
||||
WriteStorage<'a, AnimationInfo>,
|
||||
);
|
||||
|
||||
@ -35,23 +30,10 @@ impl<'a> System<'a> for Sys {
|
||||
glidings,
|
||||
attackings,
|
||||
rollings,
|
||||
crunnings,
|
||||
cidlings,
|
||||
mut animation_infos,
|
||||
): Self::SystemData,
|
||||
) {
|
||||
for (
|
||||
entity,
|
||||
vel,
|
||||
on_ground,
|
||||
jumping,
|
||||
gliding,
|
||||
attacking,
|
||||
rolling,
|
||||
crunning,
|
||||
cidling,
|
||||
mut animation_info,
|
||||
) in (
|
||||
for (entity, vel, on_ground, jumping, gliding, attacking, rolling, mut animation_info) in (
|
||||
&entities,
|
||||
&velocities,
|
||||
on_grounds.maybe(),
|
||||
@ -59,8 +41,6 @@ impl<'a> System<'a> for Sys {
|
||||
glidings.maybe(),
|
||||
attackings.maybe(),
|
||||
rollings.maybe(),
|
||||
crunnings.maybe(),
|
||||
cidlings.maybe(),
|
||||
&mut animation_infos,
|
||||
)
|
||||
.join()
|
||||
@ -68,8 +48,8 @@ impl<'a> System<'a> for Sys {
|
||||
animation_info.time += dt.0 as f64;
|
||||
let moving = vel.0.magnitude() > 3.0;
|
||||
|
||||
fn impossible_animation() -> Animation {
|
||||
warn!("Impossible animation");
|
||||
fn impossible_animation(message: &str) -> Animation {
|
||||
warn!("{}", message);
|
||||
Animation::Idle
|
||||
}
|
||||
|
||||
@ -80,21 +60,16 @@ impl<'a> System<'a> for Sys {
|
||||
gliding.is_some(),
|
||||
rolling.is_some(),
|
||||
) {
|
||||
(_, _, 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) => Animation::Idle,
|
||||
(true, true, false, false, false) => Animation::Run,
|
||||
(false, _, false, false, false) => Animation::Jump,
|
||||
(_, _, false, true, false) => Animation::Gliding,
|
||||
(_, _, true, false, false) => Animation::Attack,
|
||||
(_, true, false, false, true) => {
|
||||
dbg!("roll");
|
||||
Animation::Roll
|
||||
}
|
||||
//(_, true, false, false, false) => Animation::Crun,
|
||||
//(true, false, false, false, false) => Animation::Cidle,
|
||||
(_, _, 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
|
||||
};
|
||||
|
||||
let last = animation_info.clone();
|
||||
|
@ -1,8 +1,8 @@
|
||||
use crate::{
|
||||
comp::{
|
||||
phys::{ForceUpdate, Ori, Pos, Vel},
|
||||
Animation, AnimationInfo, Attacking, Cidling, Controller, Crunning, Gliding, HealthSource,
|
||||
Jumping, MoveDir, OnGround, Respawning, Rolling, Stats,
|
||||
Animation, AnimationInfo, Attacking, Controller, Gliding, HealthSource, Jumping, MoveDir,
|
||||
OnGround, Respawning, Rolling, Stats,
|
||||
},
|
||||
state::DeltaTime,
|
||||
};
|
||||
@ -24,8 +24,6 @@ impl<'a> System<'a> for Sys {
|
||||
WriteStorage<'a, Jumping>,
|
||||
WriteStorage<'a, Attacking>,
|
||||
WriteStorage<'a, Rolling>,
|
||||
WriteStorage<'a, Crunning>,
|
||||
WriteStorage<'a, Cidling>,
|
||||
WriteStorage<'a, Respawning>,
|
||||
WriteStorage<'a, Gliding>,
|
||||
);
|
||||
@ -45,8 +43,6 @@ impl<'a> System<'a> for Sys {
|
||||
mut jumpings,
|
||||
mut attackings,
|
||||
mut rollings,
|
||||
mut crunnings,
|
||||
mut cidlings,
|
||||
mut respawns,
|
||||
mut glidings,
|
||||
): Self::SystemData,
|
||||
|
@ -1,7 +1,7 @@
|
||||
use crate::{
|
||||
comp::{
|
||||
phys::{Ori, Pos, Vel},
|
||||
Cidling, Crunning, Gliding, Jumping, MoveDir, OnGround, Rolling, Stats,
|
||||
Gliding, Jumping, MoveDir, OnGround, Rolling, Stats,
|
||||
},
|
||||
state::DeltaTime,
|
||||
terrain::TerrainMap,
|
||||
@ -55,8 +55,6 @@ impl<'a> System<'a> for Sys {
|
||||
ReadStorage<'a, Jumping>,
|
||||
ReadStorage<'a, Gliding>,
|
||||
ReadStorage<'a, Rolling>,
|
||||
ReadStorage<'a, Crunning>,
|
||||
ReadStorage<'a, Cidling>,
|
||||
ReadStorage<'a, Stats>,
|
||||
WriteStorage<'a, OnGround>,
|
||||
WriteStorage<'a, Pos>,
|
||||
@ -74,8 +72,6 @@ impl<'a> System<'a> for Sys {
|
||||
jumpings,
|
||||
glidings,
|
||||
rollings,
|
||||
crunnings,
|
||||
cidlings,
|
||||
stats,
|
||||
mut on_grounds,
|
||||
mut positions,
|
||||
@ -84,27 +80,13 @@ impl<'a> System<'a> for Sys {
|
||||
): Self::SystemData,
|
||||
) {
|
||||
// Apply movement inputs
|
||||
for (
|
||||
entity,
|
||||
stats,
|
||||
move_dir,
|
||||
jumping,
|
||||
gliding,
|
||||
rolling,
|
||||
crunning,
|
||||
cidling,
|
||||
mut pos,
|
||||
mut vel,
|
||||
mut ori,
|
||||
) in (
|
||||
for (entity, stats, move_dir, jumping, gliding, rolling, mut pos, mut vel, mut ori) in (
|
||||
&entities,
|
||||
&stats,
|
||||
move_dirs.maybe(),
|
||||
jumpings.maybe(),
|
||||
glidings.maybe(),
|
||||
rollings.maybe(),
|
||||
crunnings.maybe(),
|
||||
cidlings.maybe(),
|
||||
&mut positions,
|
||||
&mut velocities,
|
||||
&mut orientations,
|
||||
@ -146,8 +128,6 @@ impl<'a> System<'a> for Sys {
|
||||
|
||||
// TODO:
|
||||
if rolling.is_some() {}
|
||||
if crunning.is_some() {}
|
||||
if cidling.is_some() {}
|
||||
|
||||
// Set direction based on velocity
|
||||
if vel.0.magnitude_squared() != 0.0 {
|
||||
|
@ -122,12 +122,6 @@ impl PlayState for SessionState {
|
||||
Event::InputUpdate(GameInput::Roll, state) => {
|
||||
self.controller.roll = state;
|
||||
}
|
||||
Event::InputUpdate(GameInput::Crun, state) => {
|
||||
self.controller.crun = state;
|
||||
}
|
||||
Event::InputUpdate(GameInput::Cidle, state) => {
|
||||
self.controller.cidle = state;
|
||||
}
|
||||
Event::InputUpdate(GameInput::Jump, state) => {
|
||||
self.controller.jump = state;
|
||||
}
|
||||
|
@ -32,8 +32,6 @@ pub struct ControlSettings {
|
||||
pub toggle_ingame_ui: KeyMouse,
|
||||
pub attack: KeyMouse,
|
||||
pub roll: KeyMouse,
|
||||
pub crun: KeyMouse,
|
||||
pub cidle: KeyMouse,
|
||||
}
|
||||
|
||||
impl Default for ControlSettings {
|
||||
@ -63,8 +61,6 @@ impl Default for ControlSettings {
|
||||
toggle_ingame_ui: KeyMouse::Key(VirtualKeyCode::F6),
|
||||
attack: KeyMouse::Mouse(MouseButton::Left),
|
||||
roll: KeyMouse::Mouse(MouseButton::Middle),
|
||||
crun: KeyMouse::Key(VirtualKeyCode::K),
|
||||
cidle: KeyMouse::Key(VirtualKeyCode::J),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -35,8 +35,6 @@ pub enum GameInput {
|
||||
ToggleIngameUi,
|
||||
Attack,
|
||||
Roll,
|
||||
Crun,
|
||||
Cidle,
|
||||
Respawn,
|
||||
}
|
||||
|
||||
@ -138,8 +136,6 @@ impl Window {
|
||||
);
|
||||
key_map.insert(settings.controls.attack, GameInput::Attack);
|
||||
key_map.insert(settings.controls.roll, GameInput::Roll);
|
||||
key_map.insert(settings.controls.crun, GameInput::Crun);
|
||||
key_map.insert(settings.controls.cidle, GameInput::Cidle);
|
||||
|
||||
Ok(Self {
|
||||
events_loop,
|
||||
|
Loading…
Reference in New Issue
Block a user