This commit is contained in:
timokoesters 2019-08-25 18:48:12 +02:00
parent b96557d012
commit eb34e5bb27
No known key found for this signature in database
GPG Key ID: CD80BE9AAEE78097
8 changed files with 24 additions and 34 deletions

View File

@ -314,15 +314,15 @@ impl State {
&mut self.ecs.write_resource::<BlockChange>().blocks,
Default::default(),
);
// Process local events
let events = self.ecs.read_resource::<EventBus<LocalEvent>>().recv_all();
for event in events {
{
let mut velocities = self.ecs.write_storage::<comp::Vel>();
let mut force_updates = self.ecs.write_storage::<comp::ForceUpdate>();
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.

View File

@ -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));

View File

@ -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},

View File

@ -1,6 +1,6 @@
use crate::{
comp::{HealthSource, Stats},
event::{ServerEvent, EventBus},
event::{EventBus, ServerEvent},
state::DeltaTime,
};
use log::warn;

View File

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

View File

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

View File

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

View File

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