Add pub use phys:: and remove most pub mods

This commit is contained in:
timokoesters
2019-06-14 17:27:05 +02:00
parent d8510274be
commit 80e95e2e6c
18 changed files with 86 additions and 128 deletions

View File

@ -153,7 +153,7 @@ impl Client {
pub fn current_chunk(&self) -> Option<Arc<TerrainChunk>> { pub fn current_chunk(&self) -> Option<Arc<TerrainChunk>> {
let chunk_pos = Vec2::from( let chunk_pos = Vec2::from(
self.state self.state
.read_storage::<comp::phys::Pos>() .read_storage::<comp::Pos>()
.get(self.entity) .get(self.entity)
.cloned()? .cloned()?
.0, .0,
@ -218,7 +218,7 @@ impl Client {
// 5) Terrain // 5) Terrain
let pos = self let pos = self
.state .state
.read_storage::<comp::phys::Pos>() .read_storage::<comp::Pos>()
.get(self.entity) .get(self.entity)
.cloned(); .cloned();
if let (Some(pos), Some(view_distance)) = (pos, self.view_distance) { if let (Some(pos), Some(view_distance)) = (pos, self.view_distance) {

View File

@ -1,30 +1,18 @@
pub mod actor; pub mod actor;
pub mod agent; mod agent;
pub mod animation; mod animation;
pub mod controller; mod controller;
pub mod inputs; mod inputs;
pub mod phys; mod phys;
pub mod player; mod player;
pub mod stats; mod stats;
// Reexports // Reexports
pub use actor::Actor; pub use actor::{Actor, Body, HumanoidBody, QuadrupedBody, QuadrupedMediumBody};
pub use actor::Body;
pub use actor::HumanoidBody;
pub use actor::QuadrupedBody;
pub use actor::QuadrupedMediumBody;
pub use agent::Agent; pub use agent::Agent;
pub use animation::Animation; pub use animation::{Animation, AnimationInfo};
pub use animation::AnimationInfo;
pub use controller::Controller; pub use controller::Controller;
pub use inputs::Attacking; pub use inputs::{Attacking, Gliding, Jumping, MoveDir, OnGround, Respawning, Rolling};
pub use inputs::Gliding; pub use phys::{ForceUpdate, Ori, Pos, Vel};
pub use inputs::Jumping;
pub use inputs::MoveDir;
pub use inputs::OnGround;
pub use inputs::Respawning;
pub use inputs::Rolling;
pub use player::Player; pub use player::Player;
pub use stats::Dying; pub use stats::{Dying, HealthSource, Stats};
pub use stats::HealthSource;
pub use stats::Stats;

View File

@ -2,7 +2,6 @@ use specs::{Component, NullStorage, VecStorage};
use vek::*; use vek::*;
// Position // Position
#[derive(Copy, Clone, Debug, Serialize, Deserialize)] #[derive(Copy, Clone, Debug, Serialize, Deserialize)]
pub struct Pos(pub Vec3<f32>); pub struct Pos(pub Vec3<f32>);
@ -11,7 +10,6 @@ impl Component for Pos {
} }
// Velocity // Velocity
#[derive(Copy, Clone, Debug, Serialize, Deserialize)] #[derive(Copy, Clone, Debug, Serialize, Deserialize)]
pub struct Vel(pub Vec3<f32>); pub struct Vel(pub Vec3<f32>);
@ -20,7 +18,6 @@ impl Component for Vel {
} }
// Orientation // Orientation
#[derive(Copy, Clone, Debug, Serialize, Deserialize)] #[derive(Copy, Clone, Debug, Serialize, Deserialize)]
pub struct Ori(pub Vec3<f32>); pub struct Ori(pub Vec3<f32>);
@ -29,7 +26,6 @@ impl Component for Ori {
} }
// ForceUpdate // ForceUpdate
#[derive(Copy, Clone, Debug, Default, Serialize, Deserialize)] #[derive(Copy, Clone, Debug, Default, Serialize, Deserialize)]
pub struct ForceUpdate; pub struct ForceUpdate;

View File

@ -19,9 +19,9 @@ pub enum ClientMsg {
Chat(String), Chat(String),
PlayerAnimation(comp::AnimationInfo), PlayerAnimation(comp::AnimationInfo),
PlayerPhysics { PlayerPhysics {
pos: comp::phys::Pos, pos: comp::Pos,
vel: comp::phys::Vel, vel: comp::Vel,
ori: comp::phys::Ori, ori: comp::Ori,
}, },
TerrainChunkRequest { TerrainChunkRequest {
key: Vec2<i32>, key: Vec2<i32>,

View File

@ -17,9 +17,9 @@ impl sphynx::ResPacket for EcsResPacket {}
sphynx::sum_type! { sphynx::sum_type! {
#[derive(Clone, Debug, Serialize, Deserialize)] #[derive(Clone, Debug, Serialize, Deserialize)]
pub enum EcsCompPacket { pub enum EcsCompPacket {
Pos(comp::phys::Pos), Pos(comp::Pos),
Vel(comp::phys::Vel), Vel(comp::Vel),
Ori(comp::phys::Ori), Ori(comp::Ori),
Actor(comp::Actor), Actor(comp::Actor),
Player(comp::Player), Player(comp::Player),
Stats(comp::Stats), Stats(comp::Stats),
@ -33,9 +33,9 @@ sphynx::sum_type! {
sphynx::sum_type! { sphynx::sum_type! {
#[derive(Clone, Debug, Serialize, Deserialize)] #[derive(Clone, Debug, Serialize, Deserialize)]
pub enum EcsCompPhantom { pub enum EcsCompPhantom {
Pos(PhantomData<comp::phys::Pos>), Pos(PhantomData<comp::Pos>),
Vel(PhantomData<comp::phys::Vel>), Vel(PhantomData<comp::Vel>),
Ori(PhantomData<comp::phys::Ori>), Ori(PhantomData<comp::Ori>),
Actor(PhantomData<comp::Actor>), Actor(PhantomData<comp::Actor>),
Player(PhantomData<comp::Player>), Player(PhantomData<comp::Player>),
Stats(PhantomData<comp::Stats>), Stats(PhantomData<comp::Stats>),

View File

@ -32,9 +32,9 @@ pub enum ServerMsg {
EcsSync(sphynx::SyncPackage<EcsCompPacket, EcsResPacket>), EcsSync(sphynx::SyncPackage<EcsCompPacket, EcsResPacket>),
EntityPhysics { EntityPhysics {
entity: u64, entity: u64,
pos: comp::phys::Pos, pos: comp::Pos,
vel: comp::phys::Vel, vel: comp::Vel,
ori: comp::phys::Ori, ori: comp::Ori,
}, },
EntityAnimation { EntityAnimation {
entity: u64, entity: u64,

View File

@ -104,12 +104,12 @@ impl State {
ecs.register_synced::<comp::Stats>(); ecs.register_synced::<comp::Stats>();
ecs.register_synced::<comp::Attacking>(); // TODO: Don't send this to the client? 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::Rolling>(); // TODO: Don't send this to the client?
ecs.register::<comp::phys::ForceUpdate>(); ecs.register::<comp::ForceUpdate>();
// Register components synced by other means // Register components synced by other means
ecs.register::<comp::phys::Pos>(); ecs.register::<comp::Pos>();
ecs.register::<comp::phys::Vel>(); ecs.register::<comp::Vel>();
ecs.register::<comp::phys::Ori>(); ecs.register::<comp::Ori>();
ecs.register::<comp::MoveDir>(); ecs.register::<comp::MoveDir>();
ecs.register::<comp::OnGround>(); ecs.register::<comp::OnGround>();
ecs.register::<comp::AnimationInfo>(); ecs.register::<comp::AnimationInfo>();

View File

@ -1,4 +1,4 @@
use crate::comp::{phys::Pos, Agent, Attacking, Controller, Jumping}; use crate::comp::{Agent, Attacking, Controller, Jumping, Pos};
use log::warn; use log::warn;
use rand::{seq::SliceRandom, thread_rng}; use rand::{seq::SliceRandom, thread_rng};
use specs::{Entities, Join, ReadStorage, System, WriteStorage}; use specs::{Entities, Join, ReadStorage, System, WriteStorage};

View File

@ -1,5 +1,8 @@
use crate::{ use crate::{
comp::{phys, Animation, AnimationInfo, Attacking, Gliding, Jumping, OnGround, Rolling}, comp::{
Animation, AnimationInfo, Attacking, ForceUpdate, Gliding, Jumping, OnGround, Ori, Pos,
Rolling, Vel,
},
state::DeltaTime, state::DeltaTime,
}; };
use specs::{Entities, Join, Read, ReadStorage, System, WriteStorage}; use specs::{Entities, Join, Read, ReadStorage, System, WriteStorage};
@ -10,7 +13,7 @@ impl<'a> System<'a> for Sys {
type SystemData = ( type SystemData = (
Entities<'a>, Entities<'a>,
Read<'a, DeltaTime>, Read<'a, DeltaTime>,
ReadStorage<'a, phys::Vel>, ReadStorage<'a, Vel>,
ReadStorage<'a, OnGround>, ReadStorage<'a, OnGround>,
ReadStorage<'a, Jumping>, ReadStorage<'a, Jumping>,
ReadStorage<'a, Gliding>, ReadStorage<'a, Gliding>,

View File

@ -1,7 +1,6 @@
use crate::{ use crate::{
comp::{ comp::{
phys::{ForceUpdate, Ori, Pos, Vel}, Attacking, HealthSource, Stats, {ForceUpdate, Ori, Pos, Vel},
Attacking, HealthSource, Stats,
}, },
state::{DeltaTime, Uid}, state::{DeltaTime, Uid},
}; };

View File

@ -1,8 +1,7 @@
use crate::{ use crate::{
comp::{ comp::{
phys::{ForceUpdate, Ori, Pos, Vel},
Animation, AnimationInfo, Attacking, Controller, Gliding, HealthSource, Jumping, MoveDir, Animation, AnimationInfo, Attacking, Controller, Gliding, HealthSource, Jumping, MoveDir,
OnGround, Respawning, Rolling, Stats, OnGround, Respawning, Rolling, Stats, {ForceUpdate, Ori, Pos, Vel},
}, },
state::DeltaTime, state::DeltaTime,
}; };

View File

@ -1,8 +1,5 @@
use crate::{ use crate::{
comp::{ comp::{Gliding, Jumping, MoveDir, OnGround, Ori, Pos, Rolling, Stats, Vel},
phys::{Ori, Pos, Vel},
Gliding, Jumping, MoveDir, OnGround, Rolling, Stats,
},
state::DeltaTime, state::DeltaTime,
terrain::TerrainMap, terrain::TerrainMap,
vol::{ReadVol, Vox}, vol::{ReadVol, Vox},

View File

@ -100,18 +100,12 @@ fn handle_jump(server: &mut Server, entity: EcsEntity, args: String, action: &Ch
let (opt_x, opt_y, opt_z) = scan_fmt!(&args, action.arg_fmt, f32, f32, f32); let (opt_x, opt_y, opt_z) = scan_fmt!(&args, action.arg_fmt, f32, f32, f32);
match (opt_x, opt_y, opt_z) { match (opt_x, opt_y, opt_z) {
(Some(x), Some(y), Some(z)) => { (Some(x), Some(y), Some(z)) => {
match server match server.state.read_component_cloned::<comp::Pos>(entity) {
.state
.read_component_cloned::<comp::phys::Pos>(entity)
{
Some(current_pos) => { Some(current_pos) => {
server.state.write_component(
entity,
comp::phys::Pos(current_pos.0 + Vec3::new(x, y, z)),
);
server server
.state .state
.write_component(entity, comp::phys::ForceUpdate); .write_component(entity, comp::Pos(current_pos.0 + Vec3::new(x, y, z)));
server.state.write_component(entity, comp::ForceUpdate);
} }
None => server.clients.notify( None => server.clients.notify(
entity, entity,
@ -131,10 +125,8 @@ fn handle_goto(server: &mut Server, entity: EcsEntity, args: String, action: &Ch
(Some(x), Some(y), Some(z)) => { (Some(x), Some(y), Some(z)) => {
server server
.state .state
.write_component(entity, comp::phys::Pos(Vec3::new(x, y, z))); .write_component(entity, comp::Pos(Vec3::new(x, y, z)));
server server.state.write_component(entity, comp::ForceUpdate);
.state
.write_component(entity, comp::phys::ForceUpdate);
} }
_ => server _ => server
.clients .clients
@ -173,20 +165,15 @@ fn handle_tp(server: &mut Server, entity: EcsEntity, args: String, action: &Chat
match opt_alias { match opt_alias {
Some(alias) => { Some(alias) => {
let ecs = server.state.ecs(); let ecs = server.state.ecs();
let opt_player = (&ecs.entities(), &ecs.read_storage::<comp::player::Player>()) let opt_player = (&ecs.entities(), &ecs.read_storage::<comp::Player>())
.join() .join()
.find(|(_, player)| player.alias == alias) .find(|(_, player)| player.alias == alias)
.map(|(entity, _)| entity); .map(|(entity, _)| entity);
match opt_player { match opt_player {
Some(player) => match server Some(player) => match server.state.read_component_cloned::<comp::Pos>(player) {
.state
.read_component_cloned::<comp::phys::Pos>(player)
{
Some(pos) => { Some(pos) => {
server.state.write_component(entity, pos); server.state.write_component(entity, pos);
server server.state.write_component(entity, comp::ForceUpdate);
.state
.write_component(entity, comp::phys::ForceUpdate);
} }
None => server.clients.notify( None => server.clients.notify(
entity, entity,
@ -222,10 +209,7 @@ fn handle_spawn(server: &mut Server, entity: EcsEntity, args: String, action: &C
match (opt_agent, opt_id, opt_amount) { match (opt_agent, opt_id, opt_amount) {
(Some(agent), Some(id), Some(amount)) => { (Some(agent), Some(id), Some(amount)) => {
match server match server.state.read_component_cloned::<comp::Pos>(entity) {
.state
.read_component_cloned::<comp::phys::Pos>(entity)
{
Some(mut pos) => { Some(mut pos) => {
pos.0.x += 1.0; // Temp fix TODO: Solve NaN issue with positions of pets pos.0.x += 1.0; // Temp fix TODO: Solve NaN issue with positions of pets
let body = kind_to_body(id); let body = kind_to_body(id);

View File

@ -135,7 +135,7 @@ impl Server {
#[allow(dead_code)] #[allow(dead_code)]
pub fn create_npc( pub fn create_npc(
&mut self, &mut self,
pos: comp::phys::Pos, pos: comp::Pos,
name: String, name: String,
body: comp::Body, body: comp::Body,
) -> EcsEntityBuilder { ) -> EcsEntityBuilder {
@ -143,13 +143,13 @@ impl Server {
.ecs_mut() .ecs_mut()
.create_entity_synced() .create_entity_synced()
.with(pos) .with(pos)
.with(comp::phys::Vel(Vec3::zero())) .with(comp::Vel(Vec3::zero()))
.with(comp::phys::Ori(Vec3::unit_y())) .with(comp::Ori(Vec3::unit_y()))
.with(comp::Controller::default()) .with(comp::Controller::default())
.with(comp::AnimationInfo::default()) .with(comp::AnimationInfo::default())
.with(comp::Actor::Character { name, body }) .with(comp::Actor::Character { name, body })
.with(comp::Stats::default()) .with(comp::Stats::default())
.with(comp::phys::ForceUpdate) .with(comp::ForceUpdate)
} }
pub fn create_player_character( pub fn create_player_character(
@ -165,11 +165,11 @@ impl Server {
state.write_component(entity, comp::Stats::default()); state.write_component(entity, comp::Stats::default());
state.write_component(entity, comp::AnimationInfo::default()); state.write_component(entity, comp::AnimationInfo::default());
state.write_component(entity, comp::Controller::default()); state.write_component(entity, comp::Controller::default());
state.write_component(entity, comp::phys::Pos(spawn_point)); state.write_component(entity, comp::Pos(spawn_point));
state.write_component(entity, comp::phys::Vel(Vec3::zero())); state.write_component(entity, comp::Vel(Vec3::zero()));
state.write_component(entity, comp::phys::Ori(Vec3::unit_y())); state.write_component(entity, comp::Ori(Vec3::unit_y()));
// Make sure physics are accepted. // Make sure physics are accepted.
state.write_component(entity, comp::phys::ForceUpdate); state.write_component(entity, comp::ForceUpdate);
// Tell the client its request was successful. // Tell the client its request was successful.
client.allow_state(ClientState::Character); client.allow_state(ClientState::Character);
@ -246,9 +246,8 @@ impl Server {
// Actually kill them // Actually kill them
for entity in todo_kill { for entity in todo_kill {
if let Some(client) = self.clients.get_mut(&entity) { if let Some(client) = self.clients.get_mut(&entity) {
self.state self.state.write_component(entity, comp::Vel(Vec3::zero()));
.write_component(entity, comp::phys::Vel(Vec3::zero())); self.state.write_component(entity, comp::ForceUpdate);
self.state.write_component(entity, comp::phys::ForceUpdate);
client.force_state(ClientState::Dead); client.force_state(ClientState::Dead);
} else { } else {
if let Err(err) = self.state.ecs_mut().delete_entity_synced(entity) { if let Err(err) = self.state.ecs_mut().delete_entity_synced(entity) {
@ -273,12 +272,11 @@ impl Server {
self.state.write_component(entity, comp::Stats::default()); self.state.write_component(entity, comp::Stats::default());
self.state self.state
.ecs_mut() .ecs_mut()
.write_storage::<comp::phys::Pos>() .write_storage::<comp::Pos>()
.get_mut(entity) .get_mut(entity)
.map(|pos| pos.0.z += 100.0); .map(|pos| pos.0.z += 100.0);
self.state self.state.write_component(entity, comp::Vel(Vec3::zero()));
.write_component(entity, comp::phys::Vel(Vec3::zero())); self.state.write_component(entity, comp::ForceUpdate);
self.state.write_component(entity, comp::phys::ForceUpdate);
} }
} }
@ -289,7 +287,7 @@ impl Server {
for (entity, view_distance, pos) in ( for (entity, view_distance, pos) in (
&self.state.ecs().entities(), &self.state.ecs().entities(),
&self.state.ecs().read_storage::<comp::Player>(), &self.state.ecs().read_storage::<comp::Player>(),
&self.state.ecs().read_storage::<comp::phys::Pos>(), &self.state.ecs().read_storage::<comp::Pos>(),
) )
.join() .join()
.filter_map(|(entity, player, pos)| { .filter_map(|(entity, player, pos)| {
@ -324,7 +322,7 @@ impl Server {
// For each player with a position, calculate the distance. // For each player with a position, calculate the distance.
for (player, pos) in ( for (player, pos) in (
&self.state.ecs().read_storage::<comp::Player>(), &self.state.ecs().read_storage::<comp::Player>(),
&self.state.ecs().read_storage::<comp::phys::Pos>(), &self.state.ecs().read_storage::<comp::Pos>(),
) )
.join() .join()
{ {
@ -632,9 +630,9 @@ impl Server {
// Sync physics // Sync physics
for (&uid, &pos, &vel, &ori) in ( for (&uid, &pos, &vel, &ori) in (
&state.ecs().read_storage::<Uid>(), &state.ecs().read_storage::<Uid>(),
&state.ecs().read_storage::<comp::phys::Pos>(), &state.ecs().read_storage::<comp::Pos>(),
&state.ecs().read_storage::<comp::phys::Vel>(), &state.ecs().read_storage::<comp::Vel>(),
&state.ecs().read_storage::<comp::phys::Ori>(), &state.ecs().read_storage::<comp::Ori>(),
) )
.join() .join()
{ {
@ -673,13 +671,10 @@ impl Server {
for (entity, &uid, &pos, &vel, &ori, force_update) in ( for (entity, &uid, &pos, &vel, &ori, force_update) in (
&self.state.ecs().entities(), &self.state.ecs().entities(),
&self.state.ecs().read_storage::<Uid>(), &self.state.ecs().read_storage::<Uid>(),
&self.state.ecs().read_storage::<comp::phys::Pos>(), &self.state.ecs().read_storage::<comp::Pos>(),
&self.state.ecs().read_storage::<comp::phys::Vel>(), &self.state.ecs().read_storage::<comp::Vel>(),
&self.state.ecs().read_storage::<comp::phys::Ori>(), &self.state.ecs().read_storage::<comp::Ori>(),
self.state self.state.ecs().read_storage::<comp::ForceUpdate>().maybe(),
.ecs()
.read_storage::<comp::phys::ForceUpdate>()
.maybe(),
) )
.join() .join()
{ {
@ -695,7 +690,7 @@ impl Server {
let in_vd = |entity| { let in_vd = |entity| {
// Get client position. // Get client position.
let client_pos = match state.ecs().read_storage::<comp::phys::Pos>().get(entity) { let client_pos = match state.ecs().read_storage::<comp::Pos>().get(entity) {
Some(pos) => pos.0, Some(pos) => pos.0,
None => return false, None => return false,
}; };
@ -726,10 +721,7 @@ impl Server {
&self.state.ecs().entities(), &self.state.ecs().entities(),
&self.state.ecs().read_storage::<Uid>(), &self.state.ecs().read_storage::<Uid>(),
&self.state.ecs().read_storage::<comp::AnimationInfo>(), &self.state.ecs().read_storage::<comp::AnimationInfo>(),
self.state self.state.ecs().read_storage::<comp::ForceUpdate>().maybe(),
.ecs()
.read_storage::<comp::phys::ForceUpdate>()
.maybe(),
) )
.join() .join()
{ {
@ -748,7 +740,7 @@ impl Server {
// Remove all force flags. // Remove all force flags.
self.state self.state
.ecs_mut() .ecs_mut()
.write_storage::<comp::phys::ForceUpdate>() .write_storage::<comp::ForceUpdate>()
.clear(); .clear();
} }

View File

@ -103,7 +103,7 @@ font_ids! {
pub struct DebugInfo { pub struct DebugInfo {
pub tps: f64, pub tps: f64,
pub ping_ms: f64, pub ping_ms: f64,
pub coordinates: Option<comp::phys::Pos>, pub coordinates: Option<comp::Pos>,
} }
pub enum Event { pub enum Event {
@ -312,7 +312,7 @@ impl Hud {
if self.show.ingame { if self.show.ingame {
let ecs = client.state().ecs(); let ecs = client.state().ecs();
let actor = ecs.read_storage::<comp::Actor>(); let actor = ecs.read_storage::<comp::Actor>();
let pos = ecs.read_storage::<comp::phys::Pos>(); let pos = ecs.read_storage::<comp::Pos>();
let stats = ecs.read_storage::<comp::Stats>(); let stats = ecs.read_storage::<comp::Stats>();
let player = ecs.read_storage::<comp::Player>(); let player = ecs.read_storage::<comp::Player>();
let entities = ecs.entities(); let entities = ecs.entities();
@ -322,7 +322,7 @@ impl Hud {
let player_pos = client let player_pos = client
.state() .state()
.ecs() .ecs()
.read_storage::<comp::phys::Pos>() .read_storage::<comp::Pos>()
.get(client.entity()) .get(client.entity())
.map_or(Vec3::zero(), |pos| pos.0); .map_or(Vec3::zero(), |pos| pos.0);
let mut name_id_walker = self.ids.name_tags.walk(); let mut name_id_walker = self.ids.name_tags.walk();

View File

@ -477,15 +477,15 @@ impl FigureMgr {
let player_pos = client let player_pos = client
.state() .state()
.ecs() .ecs()
.read_storage::<comp::phys::Pos>() .read_storage::<comp::Pos>()
.get(client.entity()) .get(client.entity())
.map_or(Vec3::zero(), |pos| pos.0); .map_or(Vec3::zero(), |pos| pos.0);
for (entity, pos, vel, ori, actor, animation_info, stats) in ( for (entity, pos, vel, ori, actor, animation_info, stats) in (
&ecs.entities(), &ecs.entities(),
&ecs.read_storage::<comp::phys::Pos>(), &ecs.read_storage::<comp::Pos>(),
&ecs.read_storage::<comp::phys::Vel>(), &ecs.read_storage::<comp::Vel>(),
&ecs.read_storage::<comp::phys::Ori>(), &ecs.read_storage::<comp::Ori>(),
&ecs.read_storage::<comp::Actor>(), &ecs.read_storage::<comp::Actor>(),
&ecs.read_storage::<comp::AnimationInfo>(), &ecs.read_storage::<comp::AnimationInfo>(),
ecs.read_storage::<comp::Stats>().maybe(), ecs.read_storage::<comp::Stats>().maybe(),
@ -676,15 +676,15 @@ impl FigureMgr {
let player_pos = client let player_pos = client
.state() .state()
.ecs() .ecs()
.read_storage::<comp::phys::Pos>() .read_storage::<comp::Pos>()
.get(client.entity()) .get(client.entity())
.map_or(Vec3::zero(), |pos| pos.0); .map_or(Vec3::zero(), |pos| pos.0);
for (entity, _, _, _, actor, _, _) in ( for (entity, _, _, _, actor, _, _) in (
&ecs.entities(), &ecs.entities(),
&ecs.read_storage::<comp::phys::Pos>(), &ecs.read_storage::<comp::Pos>(),
&ecs.read_storage::<comp::phys::Vel>(), &ecs.read_storage::<comp::Vel>(),
&ecs.read_storage::<comp::phys::Ori>(), &ecs.read_storage::<comp::Ori>(),
&ecs.read_storage::<comp::Actor>(), &ecs.read_storage::<comp::Actor>(),
&ecs.read_storage::<comp::AnimationInfo>(), &ecs.read_storage::<comp::AnimationInfo>(),
ecs.read_storage::<comp::Stats>().maybe(), ecs.read_storage::<comp::Stats>().maybe(),

View File

@ -110,7 +110,7 @@ impl Scene {
let player_pos = client let player_pos = client
.state() .state()
.ecs() .ecs()
.read_storage::<comp::phys::Pos>() .read_storage::<comp::Pos>()
.get(client.entity()) .get(client.entity())
.map_or(Vec3::zero(), |pos| pos.0); .map_or(Vec3::zero(), |pos| pos.0);

View File

@ -8,7 +8,7 @@ use crate::{
Direction, Error, GlobalState, PlayState, PlayStateResult, Direction, Error, GlobalState, PlayState, PlayStateResult,
}; };
use client::{self, Client}; use client::{self, Client};
use common::{clock::Clock, comp, comp::phys::Pos, msg::ClientState}; use common::{clock::Clock, comp, comp::Pos, msg::ClientState};
use log::{error, warn}; use log::{error, warn};
use std::{cell::RefCell, rc::Rc, time::Duration}; use std::{cell::RefCell, rc::Rc, time::Duration};
use vek::*; use vek::*;