2019-05-16 23:05:46 +00:00
|
|
|
use super::{ClientState, EcsCompPacket, EcsResPacket};
|
2019-04-29 20:37:19 +00:00
|
|
|
use crate::{comp, terrain::TerrainChunk};
|
2019-04-10 23:16:29 +00:00
|
|
|
use vek::*;
|
2019-04-19 19:32:47 +00:00
|
|
|
|
|
|
|
#[derive(Debug, Clone, Serialize, Deserialize)]
|
|
|
|
pub enum RequestStateError {
|
|
|
|
Denied,
|
|
|
|
Already,
|
|
|
|
Impossible,
|
2019-04-22 14:25:37 +00:00
|
|
|
WrongMessage,
|
2019-04-19 19:32:47 +00:00
|
|
|
}
|
2019-03-04 19:50:26 +00:00
|
|
|
|
2019-05-08 16:22:52 +00:00
|
|
|
#[derive(Debug, Clone, Serialize, Deserialize)]
|
|
|
|
pub struct ServerInfo {
|
|
|
|
pub name: String,
|
|
|
|
pub description: String,
|
|
|
|
}
|
|
|
|
|
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-05-16 23:05:46 +00:00
|
|
|
ecs_state: sphynx::StatePackage<EcsCompPacket, EcsResPacket>,
|
2019-04-21 18:12:29 +00:00
|
|
|
entity_uid: u64,
|
2019-05-08 16:22:52 +00:00
|
|
|
server_info: ServerInfo,
|
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),
|
2019-05-16 23:05:46 +00:00
|
|
|
EcsSync(sphynx::SyncPackage<EcsCompPacket, EcsResPacket>),
|
2019-04-14 20:30:27 +00:00
|
|
|
EntityPhysics {
|
|
|
|
entity: u64,
|
|
|
|
pos: comp::phys::Pos,
|
|
|
|
vel: comp::phys::Vel,
|
2019-05-31 18:45:16 +00:00
|
|
|
ori: comp::phys::Ori,
|
2019-04-14 20:30:27 +00:00
|
|
|
},
|
2019-04-16 14:29:44 +00:00
|
|
|
EntityAnimation {
|
|
|
|
entity: u64,
|
2019-05-17 20:47:58 +00:00
|
|
|
animation_info: comp::AnimationInfo,
|
2019-04-16 14:29:44 +00:00
|
|
|
},
|
2019-04-10 23:16:29 +00:00
|
|
|
TerrainChunkUpdate {
|
2019-05-17 17:44:30 +00:00
|
|
|
key: Vec2<i32>,
|
2019-04-11 22:26:43 +00:00
|
|
|
chunk: Box<TerrainChunk>,
|
2019-04-10 23:16:29 +00:00
|
|
|
},
|
2019-04-23 12:01:16 +00:00
|
|
|
Disconnect,
|
2019-04-19 19:32:47 +00:00
|
|
|
Shutdown,
|
2019-03-03 22:02:38 +00:00
|
|
|
}
|