mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
Rename animationHistory to animation_history
Former-commit-id: bb2c882332fa9c3fd7f2c7fbd6143cd5f85153d8
This commit is contained in:
parent
61578b238e
commit
ec16153164
@ -168,9 +168,9 @@ impl Client {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Update the server about the player's currently playing animation and the previous one
|
// Update the server about the player's currently playing animation and the previous one
|
||||||
if let Some(animationHistory) = self.state.read_storage::<comp::AnimationHistory>().get(self.player).cloned() {
|
if let Some(animation_history) = self.state.read_storage::<comp::AnimationHistory>().get(self.player).cloned() {
|
||||||
if Some(animationHistory.current) != animationHistory.last {
|
if Some(animation_history.current) != animation_history.last {
|
||||||
self.postbox.send_message(ClientMsg::PlayerAnimation(animationHistory));
|
self.postbox.send_message(ClientMsg::PlayerAnimation(animation_history));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -230,9 +230,9 @@ impl Client {
|
|||||||
},
|
},
|
||||||
None => {},
|
None => {},
|
||||||
},
|
},
|
||||||
ServerMsg::EntityAnimation { entity, animationHistory } => match self.state.ecs().entity_from_uid(entity) {
|
ServerMsg::EntityAnimation { entity, animation_history } => match self.state.ecs().entity_from_uid(entity) {
|
||||||
Some(entity) => {
|
Some(entity) => {
|
||||||
self.state.write_component(entity, animationHistory);
|
self.state.write_component(entity, animation_history);
|
||||||
},
|
},
|
||||||
None => {},
|
None => {},
|
||||||
},
|
},
|
||||||
|
@ -25,7 +25,7 @@ pub enum ServerMsg {
|
|||||||
},
|
},
|
||||||
EntityAnimation {
|
EntityAnimation {
|
||||||
entity: u64,
|
entity: u64,
|
||||||
animationHistory: comp::AnimationHistory,
|
animation_history: comp::AnimationHistory,
|
||||||
},
|
},
|
||||||
TerrainChunkUpdate {
|
TerrainChunkUpdate {
|
||||||
key: Vec3<i32>,
|
key: Vec3<i32>,
|
||||||
|
@ -246,7 +246,7 @@ impl Server {
|
|||||||
ClientMsg::Ping => client.postbox.send_message(ServerMsg::Pong),
|
ClientMsg::Ping => client.postbox.send_message(ServerMsg::Pong),
|
||||||
ClientMsg::Pong => {}
|
ClientMsg::Pong => {}
|
||||||
ClientMsg::Chat(msg) => new_chat_msgs.push((entity, msg)),
|
ClientMsg::Chat(msg) => new_chat_msgs.push((entity, msg)),
|
||||||
ClientMsg::PlayerAnimation(animationHistory) => state.write_component(entity, animationHistory),
|
ClientMsg::PlayerAnimation(animation_history) => state.write_component(entity, animation_history),
|
||||||
ClientMsg::PlayerPhysics { pos, vel, dir } => {
|
ClientMsg::PlayerPhysics { pos, vel, dir } => {
|
||||||
state.write_component(entity, pos);
|
state.write_component(entity, pos);
|
||||||
state.write_component(entity, vel);
|
state.write_component(entity, vel);
|
||||||
@ -365,7 +365,7 @@ impl Server {
|
|||||||
});
|
});
|
||||||
|
|
||||||
// Sync logical information other players have authority over, not the server
|
// Sync logical information other players have authority over, not the server
|
||||||
for (other_entity, &uid, &animationHistory) in (
|
for (other_entity, &uid, &animation_history) in (
|
||||||
&state.ecs().internal().entities(),
|
&state.ecs().internal().entities(),
|
||||||
&state.ecs().internal().read_storage::<common::state::Uid>(),
|
&state.ecs().internal().read_storage::<common::state::Uid>(),
|
||||||
&state.ecs().internal().read_storage::<comp::AnimationHistory>(),
|
&state.ecs().internal().read_storage::<comp::AnimationHistory>(),
|
||||||
@ -373,7 +373,7 @@ impl Server {
|
|||||||
// AnimationHistory
|
// AnimationHistory
|
||||||
client.postbox.send_message(ServerMsg::EntityAnimation {
|
client.postbox.send_message(ServerMsg::EntityAnimation {
|
||||||
entity: uid.into(),
|
entity: uid.into(),
|
||||||
animationHistory: animationHistory,
|
animation_history: animation_history,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -406,28 +406,28 @@ impl Server {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Sync animation states
|
// Sync animation states
|
||||||
for (entity, &uid, &animationHistory) in (
|
for (entity, &uid, &animation_history) in (
|
||||||
&self.state.ecs().internal().entities(),
|
&self.state.ecs().internal().entities(),
|
||||||
&self.state.ecs().internal().read_storage::<Uid>(),
|
&self.state.ecs().internal().read_storage::<Uid>(),
|
||||||
&self.state.ecs().internal().read_storage::<comp::AnimationHistory>(),
|
&self.state.ecs().internal().read_storage::<comp::AnimationHistory>(),
|
||||||
).join() {
|
).join() {
|
||||||
// Check if we need to sync
|
// Check if we need to sync
|
||||||
if Some(animationHistory.current) == animationHistory.last {
|
if Some(animation_history.current) == animation_history.last {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
self.clients.notify_connected_except(entity, ServerMsg::EntityAnimation {
|
self.clients.notify_connected_except(entity, ServerMsg::EntityAnimation {
|
||||||
entity: uid.into(),
|
entity: uid.into(),
|
||||||
animationHistory,
|
animation_history,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update animation last/current state
|
// Update animation last/current state
|
||||||
for (entity, mut animationHistory) in (
|
for (entity, mut animation_history) in (
|
||||||
&self.state.ecs().internal().entities(),
|
&self.state.ecs().internal().entities(),
|
||||||
&mut self.state.ecs().internal().write_storage::<comp::AnimationHistory>()
|
&mut self.state.ecs().internal().write_storage::<comp::AnimationHistory>()
|
||||||
).join() {
|
).join() {
|
||||||
animationHistory.last = Some(animationHistory.current);
|
animation_history.last = Some(animation_history.current);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Remove all force flags
|
// Remove all force flags
|
||||||
|
@ -83,7 +83,7 @@ impl Figures {
|
|||||||
pub fn maintain(&mut self, renderer: &mut Renderer, client: &mut Client) {
|
pub fn maintain(&mut self, renderer: &mut Renderer, client: &mut Client) {
|
||||||
let time = client.state().get_time();
|
let time = client.state().get_time();
|
||||||
let ecs = client.state_mut().ecs_mut().internal_mut();
|
let ecs = client.state_mut().ecs_mut().internal_mut();
|
||||||
for (entity, pos, dir, character, animationHistory) in (
|
for (entity, pos, dir, character, animation_history) in (
|
||||||
&ecs.entities(),
|
&ecs.entities(),
|
||||||
&ecs.read_storage::<comp::phys::Pos>(),
|
&ecs.read_storage::<comp::phys::Pos>(),
|
||||||
&ecs.read_storage::<comp::phys::Dir>(),
|
&ecs.read_storage::<comp::phys::Dir>(),
|
||||||
@ -94,7 +94,7 @@ impl Figures {
|
|||||||
.entry(entity)
|
.entry(entity)
|
||||||
.or_insert_with(|| FigureState::new(renderer, CharacterSkeleton::new()));
|
.or_insert_with(|| FigureState::new(renderer, CharacterSkeleton::new()));
|
||||||
|
|
||||||
let target_skeleton = match animationHistory.current {
|
let target_skeleton = match animation_history.current {
|
||||||
comp::character::Animation::Idle => IdleAnimation::update_skeleton(&mut state.skeleton, time),
|
comp::character::Animation::Idle => IdleAnimation::update_skeleton(&mut state.skeleton, time),
|
||||||
comp::character::Animation::Run => RunAnimation::update_skeleton(&mut state.skeleton, time),
|
comp::character::Animation::Run => RunAnimation::update_skeleton(&mut state.skeleton, time),
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user