mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
Fix npc and death bug
This commit is contained in:
parent
5fcf6ededa
commit
d235374d8e
@ -310,16 +310,18 @@ impl Client {
|
||||
}
|
||||
|
||||
// 6) Update the server about the player's physics attributes.
|
||||
match (
|
||||
self.state.read_storage().get(self.entity).cloned(),
|
||||
self.state.read_storage().get(self.entity).cloned(),
|
||||
self.state.read_storage().get(self.entity).cloned(),
|
||||
) {
|
||||
(Some(pos), Some(vel), Some(ori)) => {
|
||||
self.postbox
|
||||
.send_message(ClientMsg::PlayerPhysics { pos, vel, ori });
|
||||
if let ClientState::Character = self.client_state {
|
||||
match (
|
||||
self.state.read_storage().get(self.entity).cloned(),
|
||||
self.state.read_storage().get(self.entity).cloned(),
|
||||
self.state.read_storage().get(self.entity).cloned(),
|
||||
) {
|
||||
(Some(pos), Some(vel), Some(ori)) => {
|
||||
self.postbox
|
||||
.send_message(ClientMsg::PlayerPhysics { pos, vel, ori });
|
||||
}
|
||||
_ => {}
|
||||
}
|
||||
_ => {}
|
||||
}
|
||||
|
||||
// Output debug metrics
|
||||
@ -392,7 +394,7 @@ impl Client {
|
||||
self.client_state = state;
|
||||
}
|
||||
ServerMsg::StateAnswer(Err((error, state))) => {
|
||||
warn!("{:?}", error);
|
||||
warn!("StateAnswer: {:?}", error);
|
||||
}
|
||||
ServerMsg::ForceState(state) => {
|
||||
self.client_state = state;
|
||||
|
@ -95,7 +95,13 @@ impl<'a> System<'a> for Sys {
|
||||
}
|
||||
|
||||
// Roll
|
||||
if controller.roll && !a.rolling && a.on_ground && a.moving && !a.attacking && !a.gliding {
|
||||
if controller.roll
|
||||
&& !a.rolling
|
||||
&& a.on_ground
|
||||
&& a.moving
|
||||
&& !a.attacking
|
||||
&& !a.gliding
|
||||
{
|
||||
rollings.insert(entity, Rolling::start());
|
||||
}
|
||||
}
|
||||
|
@ -126,10 +126,7 @@ impl<'a> System<'a> for Sys {
|
||||
}
|
||||
|
||||
// Glide
|
||||
if a.gliding
|
||||
&& vel.0.magnitude_squared() < GLIDE_SPEED.powf(2.0)
|
||||
&& vel.0.z < 0.0
|
||||
{
|
||||
if a.gliding && vel.0.magnitude_squared() < GLIDE_SPEED.powf(2.0) && vel.0.z < 0.0 {
|
||||
let lift = GLIDE_ANTIGRAV + vel.0.z.powf(2.0) * 0.2;
|
||||
vel.0.z += dt.0 * lift * Vec2::<f32>::from(vel.0 * 0.15).magnitude().min(1.0);
|
||||
}
|
||||
|
@ -20,7 +20,7 @@ use common::{
|
||||
terrain::{TerrainChunk, TerrainChunkSize},
|
||||
vol::VolSize,
|
||||
};
|
||||
use log::warn;
|
||||
use log::{debug, warn};
|
||||
use specs::{join::Join, world::EntityBuilder as EcsEntityBuilder, Builder, Entity as EcsEntity};
|
||||
use std::{
|
||||
collections::HashSet,
|
||||
@ -148,6 +148,7 @@ impl Server {
|
||||
.with(comp::Controller::default())
|
||||
.with(comp::Actor::Character { name, body })
|
||||
.with(comp::Stats::default())
|
||||
.with(comp::ActionState::default())
|
||||
.with(comp::ForceUpdate)
|
||||
}
|
||||
|
||||
@ -526,7 +527,7 @@ impl Server {
|
||||
// Handle client disconnects.
|
||||
for entity in disconnected_clients {
|
||||
if let Err(err) = self.state.ecs_mut().delete_entity_synced(entity) {
|
||||
warn!("Failed to delete disconnected client: {:?}", err);
|
||||
debug!("Failed to delete disconnected client: {:?}", err);
|
||||
}
|
||||
|
||||
frontend_events.push(Event::ClientDisconnected { entity });
|
||||
|
@ -439,7 +439,7 @@ impl FigureModelCache {
|
||||
fn load_wolf_head_lower(head_lower: quadruped_medium::HeadLower) -> Mesh<FigurePipeline> {
|
||||
Self::load_mesh(
|
||||
match head_lower {
|
||||
quadruped_medium::HeadLower::Default => "npc/wolf/head_lower.vox",
|
||||
quadruped_medium::HeadLower::Default => "npc/wolf/wolf_head_lower.vox",
|
||||
},
|
||||
Vec3::new(-7.0, -6.0, -5.5),
|
||||
)
|
||||
|
Loading…
Reference in New Issue
Block a user