2019-04-10 23:16:29 +00:00
|
|
|
use vek::*;
|
2019-04-14 20:30:27 +00:00
|
|
|
use crate::{
|
|
|
|
comp,
|
|
|
|
terrain::TerrainChunk,
|
|
|
|
};
|
2019-04-19 19:32:47 +00:00
|
|
|
use super::{EcsPacket, ClientState};
|
|
|
|
|
|
|
|
#[derive(Debug, Clone, Serialize, Deserialize)]
|
|
|
|
pub enum RequestStateError {
|
|
|
|
Denied,
|
|
|
|
Already,
|
|
|
|
Impossible,
|
|
|
|
}
|
2019-03-04 19:50:26 +00:00
|
|
|
|
2019-04-22 00:38:29 +00:00
|
|
|
#[derive(Debug, Clone, Serialize, Deserialize)]
|
2019-03-03 22:02:38 +00:00
|
|
|
pub enum ServerMsg {
|
2019-04-19 19:32:47 +00:00
|
|
|
InitialSync {
|
2019-04-10 17:23:27 +00:00
|
|
|
ecs_state: sphynx::StatePackage<EcsPacket>,
|
2019-04-21 18:12:29 +00:00
|
|
|
entity_uid: u64,
|
2019-04-10 17:23:27 +00:00
|
|
|
},
|
2019-04-21 18:12:29 +00:00
|
|
|
StateAnswer(Result<ClientState, (RequestStateError, ClientState)>),
|
|
|
|
ForceState(ClientState),
|
2019-03-05 18:39:18 +00:00
|
|
|
Ping,
|
|
|
|
Pong,
|
2019-03-04 19:50:26 +00:00
|
|
|
Chat(String),
|
2019-04-10 17:23:27 +00:00
|
|
|
SetPlayerEntity(u64),
|
|
|
|
EcsSync(sphynx::SyncPackage<EcsPacket>),
|
2019-04-14 20:30:27 +00:00
|
|
|
EntityPhysics {
|
|
|
|
entity: u64,
|
|
|
|
pos: comp::phys::Pos,
|
|
|
|
vel: comp::phys::Vel,
|
|
|
|
dir: comp::phys::Dir,
|
|
|
|
},
|
2019-04-16 14:29:44 +00:00
|
|
|
EntityAnimation {
|
|
|
|
entity: u64,
|
2019-04-17 20:32:36 +00:00
|
|
|
animation_history: comp::AnimationHistory,
|
2019-04-16 14:29:44 +00:00
|
|
|
},
|
2019-04-10 23:16:29 +00:00
|
|
|
TerrainChunkUpdate {
|
|
|
|
key: Vec3<i32>,
|
2019-04-11 22:26:43 +00:00
|
|
|
chunk: Box<TerrainChunk>,
|
2019-04-10 23:16:29 +00:00
|
|
|
},
|
2019-04-19 19:32:47 +00:00
|
|
|
Shutdown,
|
2019-03-03 22:02:38 +00:00
|
|
|
}
|