]> git.lizzy.rs Git - mt_net.git/blob - src/to_clt.rs
Implement SkyParams
[mt_net.git] / src / to_clt.rs
1 use super::*;
2
3 #[mt_derive(to = "clt")]
4 pub struct Color {
5     pub a: u8,
6     pub r: u8,
7     pub g: u8,
8     pub b: u8,
9 }
10
11 #[mt_derive(to = "clt", repr = "u8")]
12 pub enum ModChanSig {
13     JoinOk = 0,
14     JoinFail,
15     LeaveOk,
16     LeaveFail,
17     NotRegistered,
18     SetState,
19 }
20
21 mod chat;
22 mod env;
23 mod hud;
24 mod media;
25 mod sky;
26 mod status;
27
28 pub use chat::*;
29 pub use env::*;
30 pub use hud::*;
31 pub use media::*;
32 pub use sky::*;
33 pub use status::*;
34
35 #[mt_derive(to = "clt", repr = "u16", tag = "type", content = "data")]
36 pub enum ToCltPkt {
37     Hello {
38         serialize_version: u8,
39         #[mt(const_before = "1u16")] // compression
40         proto_version: u16,
41         auth_methods: EnumSet<AuthMethod>,
42         username: String,
43     } = 2,
44     AcceptAuth {
45         player_pos: [f32; 3],
46         map_seed: u64,
47         send_interval: f32,
48         sudo_auth_methods: EnumSet<AuthMethod>,
49     } = 3,
50     AcceptSudoMode {
51         #[mt(const_after = "[0u8; 15]")]
52         sudo_auth_methods: EnumSet<AuthMethod>,
53     } = 4,
54     DenySudoMode = 5,
55     Kick(KickReason) = 10,
56     BlockData {
57         pos: [i16; 3],
58         #[mt(zstd)]
59         block: Box<MapBlock>,
60     } = 32,
61     AddNode {
62         pos: [i16; 3],
63         param0: u16,
64         param1: u8,
65         param2: u8,
66         keep_meta: bool,
67     } = 33,
68     RemoveNode {
69         pos: [i16; 3],
70     } = 34,
71     Inv {
72         inv: String,
73     } = 39,
74     TimeOfDay {
75         time: u16,
76         speed: f32,
77     } = 41,
78     CsmRestrictionFlags {
79         flags: EnumSet<CsmRestrictionFlag>,
80         map_range: u32,
81     } = 42,
82     AddPlayerVelocity {
83         vel: [f32; 3],
84     } = 43,
85     MediaPush {
86         raw_hash: String,
87         filename: String,
88         callback_token: u32,
89         should_cache: bool,
90     } = 44,
91     ChatMsg {
92         #[mt(const_before = "1u8")]
93         msg_type: ChatMsgType,
94         #[mt(len = "Utf16")]
95         sender: String,
96         #[mt(len = "Utf16")]
97         text: String,
98         timestamp: i64, // unix time
99     } = 47,
100     ObjRemoveAdd {
101         remove: Vec<u16>,
102         add: Vec<ObjAdd>,
103     } = 49,
104     ObjMsgs {
105         #[mt(len = "()")]
106         msgs: Vec<ObjIdMsg>,
107     } = 50,
108     Hp {
109         hp: u16,
110         #[mt(default)]
111         damage_effect: bool,
112     } = 51,
113     MovePlayer {
114         pos: [f32; 3],
115         pitch: f32,
116         yaw: f32,
117     } = 52,
118     LegacyKick {
119         #[mt(len = "Utf16")]
120         reason: String,
121     } = 53,
122     Fov {
123         fov: f32,
124         multiplier: bool,
125         transition_time: f32,
126     } = 54,
127     DeathScreen {
128         point_cam: bool,
129         point_at: [f32; 3],
130     } = 55,
131     Media {
132         n: u16,
133         i: u16,
134         #[mt(len = "(u32, (DefCfg, u32))")]
135         files: HashMap<String, Vec<u8>>, // name -> payload
136     } = 56,
137     #[mt(size = "u32", zlib)]
138     NodeDefs {
139         #[mt(const_before = "1u8")] // version
140         defs: Vec<NodeDef>,
141     } = 58,
142     AnnounceMedia {
143         files: HashMap<String, String>, // name -> base64 sha1 hash
144         url: String,
145     } = 60,
146     #[mt(size = "u32", zlib)]
147     ItemDefs {
148         #[mt(const_before = "0u8")] // version
149         defs: Vec<ItemDef>,
150         aliases: HashMap<String, String>,
151     } = 61,
152     PlaySound {
153         id: u32,
154         name: String,
155         gain: f32,
156         src_type: SoundSrcType,
157         pos: [f32; 3],
158         src_obj_id: u16,
159         #[serde(rename = "loop")]
160         sound_loop: bool,
161         fade: f32,
162         pitch: f32,
163         ephermeral: bool,
164     } = 63,
165     StopSound {
166         id: u32,
167     } = 64,
168     Privs {
169         privs: HashSet<String>,
170     } = 65,
171     InvFormspec {
172         #[mt(size = "u32")]
173         formspec: String,
174     } = 66,
175     DetachedInv {
176         name: String,
177         keep: bool,
178         len: u16,
179         #[mt(len = "()")]
180         inv: String,
181     } = 67,
182     ShowFormspec {
183         #[mt(len = "u32")]
184         formspec: String,
185         formname: String,
186     } = 68,
187     Movement {
188         default_accel: f32,
189         air_accel: f32,
190         fast_accel: f32,
191         walk_speed: f32,
192         crouch_speed: f32,
193         fast_speed: f32,
194         climb_speed: f32,
195         jump_speed: f32,
196         fluidity: f32,
197         smoothing: f32,
198         sink: f32,
199         gravity: f32,
200     } = 69,
201     SpawnParticle {
202         pos: [f32; 3],
203         vel: [f32; 3],
204         acc: [f32; 3],
205         expiration_time: f32,
206         size: f32,
207         collide: bool,
208         #[mt(len = "u32")]
209         texture: String,
210         vertical: bool,
211         collision_rm: bool,
212         anim_params: TileAnim,
213         glow: u8,
214         obj_collision: bool,
215         node_param0: u16,
216         node_param2: u8,
217         node_tile: u8,
218     } = 70,
219     AddParticleSpawner {
220         amount: u16,
221         duration: f32,
222         pos: [[f32; 3]; 2],
223         vel: [[f32; 3]; 2],
224         acc: [[f32; 3]; 2],
225         expiration_time: [f32; 2],
226         size: [f32; 2],
227         collide: bool,
228         #[mt(len = "u32")]
229         texture: String,
230         id: u32,
231         vertical: bool,
232         collision_rm: bool,
233         attached_obj_id: u16,
234         anim_params: TileAnim,
235         glow: u8,
236         obj_collision: bool,
237         node_param0: u16,
238         node_param2: u8,
239         node_tile: u8,
240     } = 71,
241     AddHud {
242         id: u32,
243         hud: HudElement,
244     } = 73,
245     RemoveHud {
246         id: u32,
247     } = 74,
248     ChangeHud {
249         id: u32,
250         change: HudChange,
251     } = 75,
252     HudFlags {
253         flags: EnumSet<HudFlag>,
254         mask: EnumSet<HudFlag>,
255     } = 76,
256     SetHotbarParam(HotbarParam) = 77,
257     Breath {
258         breath: u16,
259     } = 78,
260     SkyParams(SkyParams) = 79,
261     OverrideDayNightRatio {
262         #[serde(rename = "override")]
263         ratio_override: bool,
264         ratio: u16,
265     } = 80,
266     LocalPlayerAnim {
267         idle: [i32; 2],
268         walk: [i32; 2],
269         dig: [i32; 2],
270         walk_dig: [i32; 2],
271         speed: f32,
272     } = 81,
273     EyeOffset {
274         first: [f32; 3],
275         third: [f32; 3],
276     } = 82,
277     RemoveParticleSpawner {
278         id: u32,
279     } = 83,
280     CloudParams(CloudParams) = 84,
281     FadeSound {
282         id: u32,
283         step: f32,
284         gain: f32,
285     } = 85,
286     UpdatePlayerList {
287         update_type: PlayerListUpdateType,
288         players: HashSet<String>,
289     } = 86,
290     ModChanMsg {
291         channel: String,
292         sender: String,
293         msg: String,
294     } = 87,
295     ModChanSig {
296         signal: ModChanSig,
297         channel: String,
298     } = 88,
299     NodeMetasChanged {
300         #[mt(size = "u32")]
301         changed: HashMap<[i16; 3], NodeMeta>,
302     } = 89,
303     SunParams(SunParams) = 90,
304     MoonParams(MoonParams) = 91,
305     StarParams(StarParams) = 92,
306     SrpBytesSaltB {
307         salt: Vec<u8>,
308         b: Vec<u8>,
309     } = 96,
310     FormspecPrepend {
311         prepend: String,
312     } = 97,
313     MinimapModes(MinimapModesPkt) = 98,
314 }