veloren/common/src/msg/client.rs

51 lines
1.1 KiB
Rust
Raw Normal View History

use super::ClientState;
use crate::terrain::block::Block;
2019-07-17 22:10:42 +00:00
use crate::{comp, ChatType};
use vek::*;
#[derive(Debug, Clone, Serialize, Deserialize)]
pub enum ClientMsg {
Register {
player: comp::Player,
},
Character {
name: String,
body: comp::Body,
},
2019-06-09 14:20:20 +00:00
Controller(comp::Controller),
RequestState(ClientState),
SetViewDistance(u32),
BreakBlock(Vec3<i32>),
PlaceBlock(Vec3<i32>, Block),
Ping,
Pong,
2019-07-17 22:10:42 +00:00
ChatMsg {
chat_type: ChatType,
msg: String,
},
PlayerPhysics {
pos: comp::Pos,
vel: comp::Vel,
ori: comp::Ori,
},
TerrainChunkRequest {
key: Vec2<i32>,
},
Disconnect,
}
2019-07-17 22:10:42 +00:00
impl ClientMsg {
pub fn chat(message: String) -> crate::msg::client::ClientMsg {
crate::msg::client::ClientMsg::ChatMsg {
chat_type: ChatType::Chat,
msg: message,
}
}
pub fn tell(message: String) -> crate::msg::client::ClientMsg {
crate::msg::client::ClientMsg::ChatMsg {
chat_type: ChatType::Tell,
msg: message,
}
}
}