]> git.lizzy.rs Git - minetest.git/blob - src/client/clientevent.h
f0f1dc9e0b7fd61f8ee7a2190d2449106a58bc6f
[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 #include "hud.h"
25
26 enum ClientEventType : u8
27 {
28         CE_NONE,
29         CE_PLAYER_DAMAGE,
30         CE_PLAYER_FORCE_MOVE,
31         CE_DEATHSCREEN,
32         CE_SHOW_FORMSPEC,
33         CE_SHOW_LOCAL_FORMSPEC,
34         CE_SPAWN_PARTICLE,
35         CE_ADD_PARTICLESPAWNER,
36         CE_DELETE_PARTICLESPAWNER,
37         CE_HUDADD,
38         CE_HUDRM,
39         CE_HUDCHANGE,
40         CE_SET_SKY,
41         CE_OVERRIDE_DAY_NIGHT_RATIO,
42         CE_CLOUD_PARAMS,
43         CLIENTEVENT_MAX,
44 };
45
46 struct ClientEvent
47 {
48         ClientEventType type;
49         union
50         {
51                 // struct{
52                 //} none;
53                 struct
54                 {
55                         u16 amount;
56                 } player_damage;
57                 struct
58                 {
59                         f32 pitch;
60                         f32 yaw;
61                 } player_force_move;
62                 struct
63                 {
64                         bool set_camera_point_target;
65                         f32 camera_point_target_x;
66                         f32 camera_point_target_y;
67                         f32 camera_point_target_z;
68                 } deathscreen;
69                 struct
70                 {
71                         std::string *formspec;
72                         std::string *formname;
73                 } show_formspec;
74                 // struct{
75                 //} textures_updated;
76                 struct
77                 {
78                         v3f *pos;
79                         v3f *vel;
80                         v3f *acc;
81                         f32 expirationtime;
82                         f32 size;
83                         bool collisiondetection;
84                         bool collision_removal;
85                         bool vertical;
86                         std::string *texture;
87                         struct TileAnimationParams animation;
88                         u8 glow;
89                 } spawn_particle;
90                 struct
91                 {
92                         u16 amount;
93                         f32 spawntime;
94                         v3f *minpos;
95                         v3f *maxpos;
96                         v3f *minvel;
97                         v3f *maxvel;
98                         v3f *minacc;
99                         v3f *maxacc;
100                         f32 minexptime;
101                         f32 maxexptime;
102                         f32 minsize;
103                         f32 maxsize;
104                         bool collisiondetection;
105                         bool collision_removal;
106                         u16 attached_id;
107                         bool vertical;
108                         std::string *texture;
109                         u32 id;
110                         struct TileAnimationParams animation;
111                         u8 glow;
112                 } add_particlespawner;
113                 struct
114                 {
115                         u32 id;
116                 } delete_particlespawner;
117                 struct
118                 {
119                         u32 server_id;
120                         u8 type;
121                         v2f *pos;
122                         std::string *name;
123                         v2f *scale;
124                         std::string *text;
125                         u32 number;
126                         u32 item;
127                         u32 dir;
128                         v2f *align;
129                         v2f *offset;
130                         v3f *world_pos;
131                         v2s32 *size;
132                 } hudadd;
133                 struct
134                 {
135                         u32 id;
136                 } hudrm;
137                 struct
138                 {
139                         u32 id;
140                         HudElementStat stat;
141                         v2f *v2fdata;
142                         std::string *sdata;
143                         u32 data;
144                         v3f *v3fdata;
145                         v2s32 *v2s32data;
146                 } hudchange;
147                 struct
148                 {
149                         video::SColor *bgcolor;
150                         std::string *type;
151                         std::vector<std::string> *params;
152                         bool clouds;
153                 } set_sky;
154                 struct
155                 {
156                         bool do_override;
157                         float ratio_f;
158                 } override_day_night_ratio;
159                 struct
160                 {
161                         f32 density;
162                         u32 color_bright;
163                         u32 color_ambient;
164                         f32 height;
165                         f32 thickness;
166                         f32 speed_x;
167                         f32 speed_y;
168                 } cloud_params;
169         };
170 };