]> git.lizzy.rs Git - mt_ser.git/blob - src/to_srv.rs
Initial commit
[mt_ser.git] / src / to_srv.rs
1 use crate::*;
2
3 #[mt_derive(to = "srv")]
4 pub struct PlayerPos {
5     #[mt(const_u16 = 1)] // supported compression
6     pub pos_100: [i32; 3],
7     pub vel_100: [i32; 3],
8     pub pitch_100: i32,
9     pub yaw_100: i32,
10     pub fov_80: u8,
11     pub wanted_range: u8,
12 }
13
14 #[mt_derive(to = "srv", repr = "u8")]
15 pub enum Interaction {
16     Dig = 0,
17     StopDigging,
18     Dug,
19     Place,
20     Use,
21     Activate,
22 }
23
24 #[mt_derive(to = "srv")]
25 pub struct PointedThing; // TODO
26
27 #[mt_derive(to = "srv", repr = "u16", tag = "type", content = "data")]
28 pub enum ToSrvPkt {
29     Nil = 0,
30     Init {
31         serialize_version: u8,
32         #[mt(const_u16 = 1)] // supported compression
33         min_proto_version: u16,
34         max_proto_version: u16,
35         player_name: String,
36         #[mt(default)]
37         send_full_item_meta: bool,
38     } = 2,
39     Init2 {
40         lang: String,
41     } = 17,
42     JoinModChan {
43         channel: String,
44     } = 23,
45     LeaveModChan {
46         channel: String,
47     } = 24,
48     MsgModChan {
49         channel: String,
50         msg: String,
51     } = 25,
52     PlayerPos(PlayerPos) = 35,
53     GotBlocks {
54         #[mt(len8)]
55         blocks: Vec<[i16; 3]>,
56     } = 36,
57     DeletedBlocks {
58         #[mt(len8)]
59         blocks: Vec<[i16; 3]>,
60     } = 37,
61     InvAction {
62         #[mt(len0)]
63         action: String,
64     } = 49,
65     ChatMsg {
66         #[mt(utf16)]
67         msg: String,
68     } = 50,
69     FallDmg {
70         amount: u16,
71     } = 53,
72     SelectItem {
73         select_item: u16,
74     } = 55,
75     Respawn = 56,
76     Interact {
77         action: Interaction,
78         item_slot: u16,
79         #[mt(size_u32)]
80         pointed: PointedThing,
81         pos: PlayerPos,
82     } = 57,
83     RemovedSounds {
84         ids: Vec<i32>,
85     } = 58,
86     NodeMetaFields {
87         pos: [i16; 3],
88         formname: String,
89         fields: HashMap<String, String>,
90     } = 59,
91     InvFields {
92         formname: String,
93         fields: HashMap<String, String>,
94     } = 60,
95     ReqMedia {
96         filenames: Vec<String>,
97     } = 64,
98     CltReady {
99         major: u8,
100         minor: u8,
101         patch: u8,
102         reserved: u8,
103         version: String,
104         formspec: u16,
105     } = 67,
106     FirstSrp {
107         salt: Vec<u8>,
108         verifier: Vec<u8>,
109         empty_passwd: bool,
110     } = 80,
111     SrpBytesA {
112         a: Vec<u8>,
113         no_sha1: bool,
114     } = 81,
115     SrpBytesM {
116         m: Vec<u8>,
117     } = 82,
118     Disco = 0xffff,
119 }