mirror of
https://github.com/luanti-org/luanti.git
synced 2025-06-27 16:36:03 +00:00
Cleanup client init states by bumping protocol version
Don't use TOSERVER_RECEIVED_MEDIA but TOSERVER_CLIENT_READY as indicatio for client ready Handle clients with protocol version < 23 (almost) same way as before Make client tell server about it's version Add client state to not send bogus player position updates prior init complete Add access to statistics information (peer connction time,rtt,version) Fix clients standing stalled in world while preloading item visuals (new clients only) Add get_player_information to read client specific information from lua
This commit is contained in:
parent
556bdc260a
commit
142e2d3b74
15 changed files with 625 additions and 144 deletions
21
src/client.h
21
src/client.h
|
@ -57,6 +57,12 @@ struct QueuedMeshUpdate
|
|||
~QueuedMeshUpdate();
|
||||
};
|
||||
|
||||
enum LocalClientState {
|
||||
LC_Created,
|
||||
LC_Init,
|
||||
LC_Ready
|
||||
};
|
||||
|
||||
/*
|
||||
A thread-safe queue of mesh update tasks
|
||||
*/
|
||||
|
@ -319,14 +325,7 @@ public:
|
|||
calling this, as it is sent in the initialization.
|
||||
*/
|
||||
void connect(Address address);
|
||||
/*
|
||||
returns true when
|
||||
m_con.Connected() == true
|
||||
AND m_server_ser_ver != SER_FMT_VER_INVALID
|
||||
throws con::PeerNotFoundException if connection has been deleted,
|
||||
eg. timed out.
|
||||
*/
|
||||
bool connectedAndInitialized();
|
||||
|
||||
/*
|
||||
Stuff that references the environment is valid only as
|
||||
long as this is not called. (eg. Players)
|
||||
|
@ -354,6 +353,7 @@ public:
|
|||
void sendDamage(u8 damage);
|
||||
void sendBreath(u16 breath);
|
||||
void sendRespawn();
|
||||
void sendReady();
|
||||
|
||||
ClientEnvironment& getEnv()
|
||||
{ return m_env; }
|
||||
|
@ -454,6 +454,8 @@ public:
|
|||
// Send a notification that no conventional media transfer is needed
|
||||
void received_media();
|
||||
|
||||
LocalClientState getState() { return m_state; }
|
||||
|
||||
private:
|
||||
|
||||
// Virtual methods from con::PeerHandler
|
||||
|
@ -537,6 +539,9 @@ private:
|
|||
|
||||
// Storage for mesh data for creating multiple instances of the same mesh
|
||||
std::map<std::string, std::string> m_mesh_data;
|
||||
|
||||
// own state
|
||||
LocalClientState m_state;
|
||||
};
|
||||
|
||||
#endif // !CLIENT_HEADER
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue