]> git.lizzy.rs Git - minetest.git/blob - src/network/serveropcodes.cpp
Handle the newly added TOCLIENT_ACCESS_DENIED and TOCLIENT_DELETE_PARTICLESPAWNER
[minetest.git] / src / network / serveropcodes.cpp
1 /*
2 Minetest
3 Copyright (C) 2013 celeron55, Perttu Ahola <celeron55@gmail.com>
4 Copyright (C) 2015 nerzhul, Loic Blot <loic.blot@unix-experience.fr>
5
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU Lesser General Public License as published by
8 the Free Software Foundation; either version 2.1 of the License, or
9 (at your option) any later version.
10
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14 GNU Lesser General Public License for more details.
15
16 You should have received a copy of the GNU Lesser General Public License along
17 with this program; if not, write to the Free Software Foundation, Inc.,
18 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19 */
20
21 #include "serveropcodes.h"
22
23 const static ToServerCommandHandler null_command_handler = { "TOSERVER_NULL", TOSERVER_STATE_ALL, &Server::handleCommand_Null };
24
25 const ToServerCommandHandler toServerCommandTable[TOSERVER_NUM_MSG_TYPES] =
26 {
27         null_command_handler, // 0x00 (never use this)
28         null_command_handler, // 0x01
29         null_command_handler, // 0x02
30         null_command_handler, // 0x03
31         null_command_handler, // 0x04
32         null_command_handler, // 0x05
33         null_command_handler, // 0x06
34         null_command_handler, // 0x07
35         null_command_handler, // 0x08
36         null_command_handler, // 0x09
37         null_command_handler, // 0x0a
38         null_command_handler, // 0x0b
39         null_command_handler, // 0x0c
40         null_command_handler, // 0x0d
41         null_command_handler, // 0x0e
42         null_command_handler, // 0x0f
43         { "TOSERVER_INIT_LEGACY",              TOSERVER_STATE_NOT_CONNECTED, &Server::handleCommand_Init_Legacy }, // 0x10
44         { "TOSERVER_INIT2",                    TOSERVER_STATE_NOT_CONNECTED, &Server::handleCommand_Init2 }, // 0x11
45         null_command_handler, // 0x12
46         null_command_handler, // 0x13
47         null_command_handler, // 0x14
48         null_command_handler, // 0x15
49         null_command_handler, // 0x16
50         null_command_handler, // 0x17
51         null_command_handler, // 0x18
52         null_command_handler, // 0x19
53         null_command_handler, // 0x1a
54         null_command_handler, // 0x1b
55         null_command_handler, // 0x1c
56         null_command_handler, // 0x1d
57         null_command_handler, // 0x1e
58         null_command_handler, // 0x1f
59         null_command_handler, // 0x20
60         null_command_handler, // 0x21
61         null_command_handler, // 0x22
62         { "TOSERVER_PLAYERPOS",                TOSERVER_STATE_INGAME, &Server::handleCommand_PlayerPos }, // 0x23
63         { "TOSERVER_GOTBLOCKS",                TOSERVER_STATE_STARTUP, &Server::handleCommand_GotBlocks }, // 0x24
64         { "TOSERVER_DELETEDBLOCKS",            TOSERVER_STATE_INGAME, &Server::handleCommand_DeletedBlocks }, // 0x25
65         null_command_handler, // 0x26
66         { "TOSERVER_CLICK_OBJECT",             TOSERVER_STATE_INGAME, &Server::handleCommand_Deprecated }, // 0x27
67         { "TOSERVER_GROUND_ACTION",            TOSERVER_STATE_INGAME, &Server::handleCommand_Deprecated }, // 0x28
68         { "TOSERVER_RELEASE",                  TOSERVER_STATE_INGAME, &Server::handleCommand_Deprecated }, // 0x29
69         null_command_handler, // 0x2a
70         null_command_handler, // 0x2b
71         null_command_handler, // 0x2c
72         null_command_handler, // 0x2d
73         null_command_handler, // 0x2e
74         null_command_handler, // 0x2f
75         { "TOSERVER_SIGNTEXT",                 TOSERVER_STATE_INGAME, &Server::handleCommand_Deprecated }, // 0x30
76         { "TOSERVER_INVENTORY_ACTION",         TOSERVER_STATE_INGAME, &Server::handleCommand_InventoryAction }, // 0x31
77         { "TOSERVER_CHAT_MESSAGE",             TOSERVER_STATE_INGAME, &Server::handleCommand_ChatMessage }, // 0x32
78         { "TOSERVER_SIGNNODETEXT",             TOSERVER_STATE_INGAME, &Server::handleCommand_Deprecated }, // 0x33
79         { "TOSERVER_CLICK_ACTIVEOBJECT",       TOSERVER_STATE_INGAME, &Server::handleCommand_Deprecated }, // 0x34
80         { "TOSERVER_DAMAGE",                   TOSERVER_STATE_INGAME, &Server::handleCommand_Damage }, // 0x35
81         { "TOSERVER_PASSWORD_LEGACY",          TOSERVER_STATE_INGAME, &Server::handleCommand_Password_Legacy }, // 0x36
82         { "TOSERVER_PLAYERITEM",               TOSERVER_STATE_INGAME, &Server::handleCommand_PlayerItem }, // 0x37
83         { "TOSERVER_RESPAWN",                  TOSERVER_STATE_INGAME, &Server::handleCommand_Respawn }, // 0x38
84         { "TOSERVER_INTERACT",                 TOSERVER_STATE_INGAME, &Server::handleCommand_Interact }, // 0x39
85         { "TOSERVER_REMOVED_SOUNDS",           TOSERVER_STATE_INGAME, &Server::handleCommand_RemovedSounds }, // 0x3a
86         { "TOSERVER_NODEMETA_FIELDS",          TOSERVER_STATE_INGAME, &Server::handleCommand_NodeMetaFields }, // 0x3b
87         { "TOSERVER_INVENTORY_FIELDS",         TOSERVER_STATE_INGAME, &Server::handleCommand_InventoryFields }, // 0x3c
88         null_command_handler, // 0x3d
89         null_command_handler, // 0x3e
90         null_command_handler, // 0x3f
91         { "TOSERVER_REQUEST_MEDIA",            TOSERVER_STATE_STARTUP, &Server::handleCommand_RequestMedia }, // 0x40
92         { "TOSERVER_RECEIVED_MEDIA",           TOSERVER_STATE_STARTUP, &Server::handleCommand_ReceivedMedia }, // 0x41
93         { "TOSERVER_BREATH",                   TOSERVER_STATE_INGAME, &Server::handleCommand_Breath }, // 0x42
94         { "TOSERVER_CLIENT_READY",             TOSERVER_STATE_STARTUP, &Server::handleCommand_ClientReady }, // 0x43
95 };
96
97 const static ClientCommandFactory null_command_factory = { "TOCLIENT_NULL", 0, false };
98
99 const ClientCommandFactory clientCommandFactoryTable[TOCLIENT_NUM_MSG_TYPES] =
100 {
101         null_command_factory, // 0x00
102         null_command_factory, // 0x01
103         null_command_factory, // 0x02
104         null_command_factory, // 0x03
105         null_command_factory, // 0x04
106         null_command_factory, // 0x05
107         null_command_factory, // 0x06
108         null_command_factory, // 0x07
109         null_command_factory, // 0x08
110         null_command_factory, // 0x09
111         { "TOCLIENT_ACCESS_DENIED",     0, true }, // 0x0A
112         null_command_factory, // 0x0B
113         null_command_factory, // 0x0C
114         null_command_factory, // 0x0D
115         null_command_factory, // 0x0E
116         null_command_factory, // 0x0F
117         { "TOCLIENT_INIT",              0, true }, // 0x10
118         null_command_factory,
119         null_command_factory,
120         null_command_factory,
121         null_command_factory,
122         null_command_factory,
123         null_command_factory,
124         null_command_factory,
125         null_command_factory,
126         null_command_factory,
127         null_command_factory,
128         null_command_factory,
129         null_command_factory,
130         null_command_factory,
131         null_command_factory,
132         null_command_factory,
133         { "TOCLIENT_BLOCKDATA",                2, true }, // 0x20
134         { "TOCLIENT_ADDNODE",                  0, true }, // 0x21
135         { "TOCLIENT_REMOVENODE",               0, true }, // 0x22
136         null_command_factory,
137         null_command_factory,
138         null_command_factory,
139         null_command_factory,
140         { "TOCLIENT_INVENTORY",                0, true }, // 0x27
141         null_command_factory,
142         { "TOCLIENT_TIME_OF_DAY",              0, true }, // 0x29
143         null_command_factory,
144         null_command_factory,
145         null_command_factory,
146         null_command_factory,
147         null_command_factory,
148         null_command_factory,
149         { "TOCLIENT_CHAT_MESSAGE",             0, true }, // 0x30
150         { "TOCLIENT_ACTIVE_OBJECT_REMOVE_ADD", 0, true }, // 0x31
151         { "TOCLIENT_ACTIVE_OBJECT_MESSAGES",   0, true }, // 0x32 Special packet, sent by 0 (rel) and 1 (unrel) channel
152         { "TOCLIENT_HP",                       0, true }, // 0x33
153         { "TOCLIENT_MOVE_PLAYER",              0, true }, // 0x34
154         { "TOCLIENT_ACCESS_DENIED_LEGACY",     0, true }, // 0x35
155         { "TOCLIENT_PLAYERITEM",               0, false }, // 0x36 obsolete
156         { "TOCLIENT_DEATHSCREEN",              0, true }, // 0x37
157         { "TOCLIENT_MEDIA",                    2, true }, // 0x38
158         { "TOCLIENT_TOOLDEF",                  0, false }, // 0x39 obsolete
159         { "TOCLIENT_NODEDEF",                  0, true }, // 0x3a
160         { "TOCLIENT_CRAFTITEMDEF",             0, false }, // 0x3b obsolete
161         { "TOCLIENT_ANNOUNCE_MEDIA",           0, true }, // 0x3c
162         { "TOCLIENT_ITEMDEF",                  0, true }, // 0x3d
163         null_command_factory,
164         { "TOCLIENT_PLAY_SOUND",               0, true }, // 0x3f
165         { "TOCLIENT_STOP_SOUND",               0, true }, // 0x40
166         { "TOCLIENT_PRIVILEGES",               0, true }, // 0x41
167         { "TOCLIENT_INVENTORY_FORMSPEC",       0, true }, // 0x42
168         { "TOCLIENT_DETACHED_INVENTORY",       0, true }, // 0x43
169         { "TOCLIENT_SHOW_FORMSPEC",            0, true }, // 0x44
170         { "TOCLIENT_MOVEMENT",                 0, true }, // 0x45
171         { "TOCLIENT_SPAWN_PARTICLE",           0, true }, // 0x46
172         { "TOCLIENT_ADD_PARTICLESPAWNER",      0, true }, // 0x47
173         { "TOCLIENT_DELETE_PARTICLESPAWNER_LEGACY",   0, true }, // 0x48
174         { "TOCLIENT_HUDADD",                   1, true }, // 0x49
175         { "TOCLIENT_HUDRM",                    1, true }, // 0x4a
176         { "TOCLIENT_HUDCHANGE",                0, true }, // 0x4b
177         { "TOCLIENT_HUD_SET_FLAGS",            0, true }, // 0x4c
178         { "TOCLIENT_HUD_SET_PARAM",            0, true }, // 0x4d
179         { "TOCLIENT_BREATH",                   0, true }, // 0x4e
180         { "TOCLIENT_SET_SKY",                  0, true }, // 0x4f
181         { "TOCLIENT_OVERRIDE_DAY_NIGHT_RATIO", 0, true }, // 0x50
182         { "TOCLIENT_LOCAL_PLAYER_ANIMATIONS",  0, true }, // 0x51
183         { "TOCLIENT_EYE_OFFSET",               0, true }, // 0x52
184         { "TOCLIENT_DELETE_PARTICLESPAWNER",   0, true }, // 0x53
185 };