]> git.lizzy.rs Git - minetest.git/blob - src/client/clientevent.h
Ratelimit MeshUpdateQueue::cleanupCache() runs
[minetest.git] / src / client / clientevent.h
1 /*
2 Minetest
3 Copyright (C) 2017 nerzhul, Loic Blot <loic.blot@unix-experience.fr>
4
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU Lesser General Public License as published by
7 the Free Software Foundation; either version 2.1 of the License, or
8 (at your option) any later version.
9
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13 GNU Lesser General Public License for more details.
14
15 You should have received a copy of the GNU Lesser General Public License along
16 with this program; if not, write to the Free Software Foundation, Inc.,
17 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18 */
19
20 #pragma once
21
22 #include <string>
23 #include "irrlichttypes_bloated.h"
24
25 struct ParticleParameters;
26 struct ParticleSpawnerParameters;
27 struct SkyboxParams;
28 struct SunParams;
29 struct MoonParams;
30 struct StarParams;
31
32 enum ClientEventType : u8
33 {
34         CE_NONE,
35         CE_PLAYER_DAMAGE,
36         CE_PLAYER_FORCE_MOVE,
37         CE_DEATHSCREEN,
38         CE_SHOW_FORMSPEC,
39         CE_SHOW_LOCAL_FORMSPEC,
40         CE_SPAWN_PARTICLE,
41         CE_ADD_PARTICLESPAWNER,
42         CE_DELETE_PARTICLESPAWNER,
43         CE_HUDADD,
44         CE_HUDRM,
45         CE_HUDCHANGE,
46         CE_SET_SKY,
47         CE_SET_SUN,
48         CE_SET_MOON,
49         CE_SET_STARS,
50         CE_OVERRIDE_DAY_NIGHT_RATIO,
51         CE_CLOUD_PARAMS,
52         CLIENTEVENT_MAX,
53 };
54
55 struct ClientEventHudAdd
56 {
57         u32 server_id;
58         u8 type;
59         v2f pos, scale;
60         std::string name;
61         std::string text, text2;
62         u32 number, item, dir, style;
63         v2f align, offset;
64         v3f world_pos;
65         v2s32 size;
66         s16 z_index;
67 };
68
69 struct ClientEventHudChange
70 {
71         u32 id;
72         HudElementStat stat;
73         v2f v2fdata;
74         std::string sdata;
75         u32 data;
76         v3f v3fdata;
77         v2s32 v2s32data;
78 };
79
80 struct ClientEvent
81 {
82         ClientEventType type;
83         union
84         {
85                 // struct{
86                 //} none;
87                 struct
88                 {
89                         u16 amount;
90                         bool effect;
91                 } player_damage;
92                 struct
93                 {
94                         f32 pitch;
95                         f32 yaw;
96                 } player_force_move;
97                 struct
98                 {
99                         bool set_camera_point_target;
100                         f32 camera_point_target_x;
101                         f32 camera_point_target_y;
102                         f32 camera_point_target_z;
103                 } deathscreen;
104                 struct
105                 {
106                         std::string *formspec;
107                         std::string *formname;
108                 } show_formspec;
109                 // struct{
110                 //} textures_updated;
111                 ParticleParameters *spawn_particle;
112                 struct
113                 {
114                         ParticleSpawnerParameters *p;
115                         u16 attached_id;
116                         u64 id;
117                 } add_particlespawner;
118                 struct
119                 {
120                         u32 id;
121                 } delete_particlespawner;
122                 ClientEventHudAdd *hudadd;
123                 struct
124                 {
125                         u32 id;
126                 } hudrm;
127                 ClientEventHudChange *hudchange;
128                 SkyboxParams *set_sky;
129                 struct
130                 {
131                         bool do_override;
132                         float ratio_f;
133                 } override_day_night_ratio;
134                 struct
135                 {
136                         f32 density;
137                         u32 color_bright;
138                         u32 color_ambient;
139                         f32 height;
140                         f32 thickness;
141                         f32 speed_x;
142                         f32 speed_y;
143                 } cloud_params;
144                 SunParams *sun_params;
145                 MoonParams *moon_params;
146                 StarParams *star_params;
147         };
148 };