minetest/src/clientserver.h

175 lines
2.9 KiB
C
Raw Normal View History

2010-11-27 00:02:21 +01:00
#ifndef CLIENTSERVER_HEADER
#define CLIENTSERVER_HEADER
#define PROTOCOL_ID 0x4f457403
enum ToClientCommand
{
TOCLIENT_INIT = 0x10,
2010-11-27 00:02:21 +01:00
/*
Server's reply to TOSERVER_INIT.
Sent second after connected.
[0] u16 TOSERVER_INIT
[2] u8 deployed version
[3] v3s16 player's position + v3f(0,BS/2,0) floatToInt'd
*/
TOCLIENT_BLOCKDATA = 0x20, //TODO: Multiple blocks
TOCLIENT_ADDNODE = 0x21,
TOCLIENT_REMOVENODE = 0x22,
2010-11-27 00:02:21 +01:00
TOCLIENT_PLAYERPOS = 0x23,
2010-11-27 00:02:21 +01:00
/*
[0] u16 command
// Followed by an arbitary number of these:
// Number is determined from packet length.
[N] u16 peer_id
[N+2] v3s32 position*100
[N+2+12] v3s32 speed*100
[N+2+12+12] s32 pitch*100
[N+2+12+12+4] s32 yaw*100
*/
TOCLIENT_PLAYERINFO = 0x24,
2010-11-27 00:02:21 +01:00
/*
[0] u16 command
// Followed by an arbitary number of these:
// Number is determined from packet length.
[N] u16 peer_id
[N] char[20] name
*/
TOCLIENT_OPT_BLOCK_NOT_FOUND = 0x25, // Not used
2010-11-27 00:02:21 +01:00
TOCLIENT_SECTORMETA = 0x26, // Not used
2010-11-27 00:02:21 +01:00
/*
[0] u16 command
[2] u8 sector count
[3...] v2s16 pos + sector metadata
*/
TOCLIENT_INVENTORY = 0x27,
2010-11-27 00:02:21 +01:00
/*
[0] u16 command
[2] serialized inventory
*/
TOCLIENT_OBJECTDATA = 0x28,
2010-11-27 00:02:21 +01:00
/*
Sent as unreliable.
u16 command
u16 number of player positions
for each player:
v3s32 position*100
v3s32 speed*100
s32 pitch*100
s32 yaw*100
u16 count of blocks
for each block:
v3s16 blockpos
block objects
*/
};
enum ToServerCommand
{
TOSERVER_INIT=0x10,
/*
Sent first after connected.
[0] u16 TOSERVER_INIT
[2] u8 SER_FMT_VER_HIGHEST
[3] u8[20] player_name
*/
TOSERVER_INIT2 = 0x11,
2010-11-27 00:02:21 +01:00
/*
Sent as an ACK for TOCLIENT_INIT.
After this, the server can send data.
[0] u16 TOSERVER_INIT2
*/
TOSERVER_GETBLOCK=0x20, // Not used
TOSERVER_ADDNODE = 0x21, // Not used
TOSERVER_REMOVENODE = 0x22, // deprecated
2010-11-27 00:02:21 +01:00
TOSERVER_PLAYERPOS = 0x23,
2010-11-27 00:02:21 +01:00
/*
[0] u16 command
[2] v3s32 position*100
[2+12] v3s32 speed*100
[2+12+12] s32 pitch*100
[2+12+12+4] s32 yaw*100
*/
TOSERVER_GOTBLOCKS = 0x24,
2010-11-27 00:02:21 +01:00
/*
[0] u16 command
[2] u8 count
[3] v3s16 pos_0
[3+6] v3s16 pos_1
...
*/
TOSERVER_DELETEDBLOCKS = 0x25,
2010-11-27 00:02:21 +01:00
/*
[0] u16 command
[2] u8 count
[3] v3s16 pos_0
[3+6] v3s16 pos_1
...
*/
TOSERVER_ADDNODE_FROM_INVENTORY = 0x26, // deprecated
2010-11-27 00:02:21 +01:00
/*
[0] u16 command
[2] v3s16 pos
[8] u16 i
*/
TOSERVER_CLICK_OBJECT = 0x27,
2010-11-27 00:02:21 +01:00
/*
length: 13
[0] u16 command
[2] u8 button (0=left, 1=right)
[3] v3s16 blockpos
[9] s16 id
[11] u16 item
*/
TOSERVER_CLICK_GROUND = 0x28,
2010-11-27 00:02:21 +01:00
/*
length: 17
[0] u16 command
[2] u8 button (0=left, 1=right)
[3] v3s16 nodepos_undersurface
[9] v3s16 nodepos_abovesurface
[15] u16 item
*/
TOSERVER_RELEASE = 0x29,
2010-11-27 00:02:21 +01:00
/*
length: 3
[0] u16 command
[2] u8 button
*/
TOSERVER_SIGNTEXT = 0x30,
2010-11-27 00:02:21 +01:00
/*
u16 command
v3s16 blockpos
s16 id
u16 textlen
textdata
*/
};
// Flags for TOSERVER_GETBLOCK
#define TOSERVER_GETBLOCK_FLAG_OPTIONAL (1<<0)
#endif