+/*
+Minetest-c55
+Copyright (C) 2010 celeron55, Perttu Ahola <celeron55@gmail.com>
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License along
+with this program; if not, write to the Free Software Foundation, Inc.,
+51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+*/
+
#ifndef CLIENTSERVER_HEADER
#define CLIENTSERVER_HEADER
+#include "utility.h"
+
#define PROTOCOL_ID 0x4f457403
enum ToClientCommand
v3s16 blockpos
block objects
*/
+
+ TOCLIENT_TIME_OF_DAY = 0x29,
+ /*
+ u16 command
+ u16 time (0-23999)
+ */
+
+ TOCLIENT_CHAT_MESSAGE = 0x30,
+ /*
+ u16 command
+ u16 length
+ wstring message
+ */
+
};
enum ToServerCommand
[11] u16 item
*/
- TOSERVER_CLICK_GROUND = 0x28,
+ TOSERVER_GROUND_ACTION = 0x28,
/*
length: 17
[0] u16 command
- [2] u8 button (0=left, 1=right)
+ [2] u8 action
[3] v3s16 nodepos_undersurface
[9] v3s16 nodepos_abovesurface
[15] u16 item
+ actions:
+ 0: start digging (from undersurface)
+ 1: place block (to abovesurface)
+ 2: stop digging (all parameters ignored)
+ 3: digging completed
*/
- TOSERVER_RELEASE = 0x29,
- /*
- length: 3
- [0] u16 command
- [2] u8 button
- */
+ TOSERVER_RELEASE = 0x29, // Not used
TOSERVER_SIGNTEXT = 0x30,
/*
u16 textlen
textdata
*/
+
+ TOSERVER_INVENTORY_ACTION = 0x31,
+ /*
+ See InventoryAction in inventory.h
+ */
+
+ TOSERVER_CHAT_MESSAGE = 0x32,
+ /*
+ u16 command
+ u16 length
+ wstring message
+ */
+
};
-// Flags for TOSERVER_GETBLOCK
-#define TOSERVER_GETBLOCK_FLAG_OPTIONAL (1<<0)
+inline SharedBuffer<u8> makePacket_TOCLIENT_TIME_OF_DAY(u16 time)
+{
+ SharedBuffer<u8> data(2+2);
+ writeU16(&data[0], TOCLIENT_TIME_OF_DAY);
+ writeU16(&data[2], time);
+ return data;
+}
#endif