Luanti 5.11.0-dev
 
Loading...
Searching...
No Matches
client.h
Go to the documentation of this file.
1// Luanti
2// SPDX-License-Identifier: LGPL-2.1-or-later
3// Copyright (C) 2013 celeron55, Perttu Ahola <celeron55@gmail.com>
4
5#pragma once
6
7#include "clientenvironment.h"
8#include "irrlichttypes.h"
9#include <ostream>
10#include <map>
11#include <memory>
12#include <set>
13#include <vector>
14#include <unordered_set>
15#include "gamedef.h"
16#include "inventorymanager.h"
17#include "network/address.h"
18#include "network/networkprotocol.h" // multiple enums
19#include "network/peerhandler.h"
20#include "gameparams.h"
21#include "script/common/c_types.h" // LuaError
22#include "util/numeric.h"
23#include "util/string.h" // StringMap
24#include "config.h"
25
26#if !IS_CLIENT_BUILD
27#error Do not include in server builds
28#endif
29
30#define CLIENT_CHAT_MESSAGE_LIMIT_PER_10S 10.0f
31
32class Camera;
34class ISoundManager;
38class MapBlockMesh;
39class MapDatabase;
41class Minimap;
42class ModChannelMgr;
43class MtEventManager;
44class NetworkPacket;
45class NodeDefManager;
46class ParticleManager;
47class RenderingEngine;
49struct ChatMessage;
51struct ClientEvent;
52struct MapDrawControl;
53struct MapNode;
54struct MeshMakeData;
55struct MinimapMapblock;
56struct PlayerControl;
57struct PointedThing;
58
59namespace con {
60class IConnection;
61}
62using sound_handle_t = int;
63
69
70/*
71 Packet counter
72*/
73
75{
76public:
77 PacketCounter() = default;
78
79 void add(u16 command)
80 {
81 auto n = m_packets.find(command);
82 if (n == m_packets.end())
83 m_packets[command] = 1;
84 else
85 n->second++;
86 }
87
88 void clear()
89 {
90 m_packets.clear();
91 }
92
93 u32 sum() const;
94 void print(std::ostream &o) const;
95
96private:
97 // command, count
98 std::map<u16, u32> m_packets;
99};
100
101class ClientScripting;
102
103class Client : public con::PeerHandler, public InventoryManager, public IGameDef
104{
105public:
106 /*
107 NOTE: Nothing is thread-safe here.
108 */
109
110 Client(
111 const char *playername,
112 const std::string &password,
113 MapDrawControl &control,
117 NodeDefManager *nodedef,
119 MtEventManager *event,
120 RenderingEngine *rendering_engine,
121 ELoginRegister allow_login_or_register
122 );
123
124 ~Client();
126
127 // Load local mods into memory
128 void scanModSubfolder(const std::string &mod_name, const std::string &mod_path,
129 std::string mod_subpath);
130 inline void scanModIntoMemory(const std::string &mod_name, const std::string &mod_path)
131 {
132 scanModSubfolder(mod_name, mod_path, "");
133 }
134
135 /*
136 request all threads managed by client to be stopped
137 */
138 void Stop();
139
140
141 bool isShutdown();
142
143 void connect(const Address &address, const std::string &address_name,
144 bool is_local_server);
145
146 /*
147 Stuff that references the environment is valid only as
148 long as this is not called. (eg. Players)
149 If this throws a PeerNotFoundException, the connection has
150 timed out.
151 */
152 void step(float dtime);
153
154 /*
155 * Command Handlers
156 */
157
158 void handleCommand(NetworkPacket* pkt);
159
220
221 void ProcessData(NetworkPacket *pkt);
222
223 void Send(NetworkPacket* pkt);
224
225 void interact(InteractAction action, const PointedThing &pointed);
226
227 void sendNodemetaFields(v3s16 p, const std::string &formname,
228 const StringMap &fields);
229 void sendInventoryFields(const std::string &formname,
230 const StringMap &fields);
232 void sendChatMessage(const std::wstring &message);
233 void clearOutChatQueue();
234 void sendChangePassword(const std::string &oldpassword,
235 const std::string &newpassword);
236 void sendDamage(u16 damage);
237 void sendRespawnLegacy();
238 void sendReady();
239 void sendHaveMedia(const std::vector<u32> &tokens);
240 void sendUpdateClientInfo(const ClientDynamicInfo &info);
241
245 static const std::string &getBuiltinLuaPath();
246 static const std::string &getClientModsLuaPath();
247
248 const std::vector<ModSpec> &getMods() const override;
249 const ModSpec* getModSpec(const std::string &modname) const override;
250
251 // Causes urgent mesh updates (unlike Map::add/removeNodeWithEvent)
252 void removeNode(v3s16 p);
253
254 // helpers to enforce CSM restrictions
255 MapNode CSMGetNode(v3s16 p, bool *is_valid_position);
256 int CSMClampRadius(v3s16 pos, int radius);
258
259 void addNode(v3s16 p, MapNode n, bool remove_metadata = true);
260
261 void setPlayerControl(PlayerControl &control);
262
263 // Returns true if the inventory of the local player has been
264 // updated from the server. If it is true, it is set to false.
265 bool updateWieldedItem();
266
267 /* InventoryManager interface */
268 Inventory* getInventory(const InventoryLocation &loc) override;
269 void inventoryAction(InventoryAction *a) override;
270
271 // Send the item number 'item' as player item to the server
272 void setPlayerItem(u16 item);
273
274 const std::set<std::string> &getConnectedPlayerNames()
275 {
276 return m_env.getPlayerNames();
277 }
278
279 float getAnimationTime();
280
281 int getCrackLevel();
283 void setCrack(int level, v3s16 pos);
284
285 u16 getHP();
286
287 bool checkPrivilege(const std::string &priv) const
288 { return (m_privileges.count(priv) != 0); }
289
290 const std::unordered_set<std::string> &getPrivilegeList() const
291 { return m_privileges; }
292
293 bool getChatMessage(std::wstring &message);
294 void typeChatMessage(const std::wstring& message);
295
296 u64 getMapSeed(){ return m_map_seed; }
297
298 void addUpdateMeshTask(v3s16 blockpos, bool ack_to_server=false, bool urgent=false);
299 // Including blocks at appropriate edges
300 void addUpdateMeshTaskWithEdge(v3s16 blockpos, bool ack_to_server=false, bool urgent=false);
301 void addUpdateMeshTaskForNode(v3s16 nodepos, bool ack_to_server=false, bool urgent=false);
302
303 void updateCameraOffset(v3s16 camera_offset);
304
305 bool hasClientEvents() const { return !m_client_event_queue.empty(); }
306 // Get event from queue. If queue is empty, it triggers an assertion failure.
308
309 bool accessDenied() const { return m_access_denied; }
310
312
313 void setFatalError(const std::string &reason)
314 {
315 m_access_denied = true;
316 m_access_denied_reason = reason;
317 }
318 inline void setFatalError(const LuaError &e)
319 {
320 setFatalError(std::string("Lua: ") + e.what());
321 }
322
323 // Renaming accessDeniedReason to better name could be good as it's used to
324 // disconnect client when CSM failed.
325 const std::string &accessDeniedReason() const { return m_access_denied_reason; }
326
327 bool itemdefReceived() const
328 { return m_itemdef_received; }
329 bool nodedefReceived() const
330 { return m_nodedef_received; }
331 bool mediaReceived() const
332 { return !m_media_downloader; }
335
336 u16 getProtoVersion() const
337 { return m_proto_ver; }
338
340
341 float mediaReceiveProgress();
342
343 void drawLoadScreen(const std::wstring &text, float dtime, int percent);
345 void showUpdateProgressTexture(void *args, u32 progress, u32 max_progress);
346
347 float getRTT();
348 float getCurRate();
349 // has the server ever replied to us, used for connection retry/fallback
350 bool hasServerReplied() const {
351 return getProtoVersion() != 0; // (set in TOCLIENT_HELLO)
352 }
353
355 void setCamera(Camera* camera) { m_camera = camera; }
356
357 Camera* getCamera () { return m_camera; }
358 scene::ISceneManager *getSceneManager();
359
360 // IGameDef interface
362 const NodeDefManager* getNodeDefManager() override;
366 u16 allocateUnknownNodeId(const std::string &name) override;
370 bool checkLocalPrivilege(const std::string &priv)
371 { return checkPrivilege(priv); }
372 virtual scene::IAnimatedMesh* getMesh(const std::string &filename, bool cache = false);
373 const std::string* getModFile(std::string filename);
375
376 // Migrates away old files-based mod storage if necessary
377 void migrateModStorage();
378
379 // The following set of functions is used by ClientMediaDownloader
380 // Insert a media file appropriately into the appropriate manager
381 bool loadMedia(const std::string &data, const std::string &filename,
382 bool from_media_push = false);
383
384 // Send a request for conventional media transfer
385 void request_media(const std::vector<std::string> &file_requests);
386
388
389 void makeScreenshot();
390
391 inline void pushToChatQueue(ChatMessage *cec)
392 {
393 m_chat_queue.push(cec);
394 }
395
397 bool modsLoaded() const { return m_mods_loaded; }
398
399 void pushToEventQueue(ClientEvent *event);
400
401 // IP and port we're connected to
403
404 // Hostname of the connected server (but can also be a numerical IP)
405 const std::string &getAddressName() const
406 {
407 return m_address_name;
408 }
409
410 inline u64 getCSMRestrictionFlags() const
411 {
413 }
414
416 {
417 return m_csm_restriction_flags & flag;
418 }
419
420 bool joinModChannel(const std::string &channel) override;
421 bool leaveModChannel(const std::string &channel) override;
422 bool sendModChannelMessage(const std::string &channel,
423 const std::string &message) override;
424 ModChannel *getModChannel(const std::string &channel) override;
425
426 const std::string &getFormspecPrepend() const;
427
429 {
430 return m_mesh_grid;
431 }
432
434
435private:
436 void loadMods();
437
438 // Virtual methods from con::PeerHandler
439 void peerAdded(con::IPeer *peer) override;
440 void deletingPeer(con::IPeer *peer, bool timeout) override;
441
442 void initLocalMapSaving(const Address &address,
443 const std::string &hostname,
444 bool is_local_server);
445
446 void ReceiveAll();
447
448 void sendPlayerPos();
449
450 void deleteAuthData();
451 // helper method shared with clientpackethandler
452 static AuthMechanism choseAuthMech(const u32 mechs);
453
454 void sendInit(const std::string &playerName);
455 void startAuth(AuthMechanism chosen_auth_mechanism);
456 void sendDeletedBlocks(std::vector<v3s16> &blocks);
457 void sendGotBlocks(const std::vector<v3s16> &blocks);
458 void sendRemovedSounds(const std::vector<s32> &soundList);
459
460 bool canSendChatMessage() const;
461
464 float m_avg_rtt_timer = 0.0f;
467
475
476
477 std::unique_ptr<MeshUpdateManager> m_mesh_update_manager;
479 std::unique_ptr<ParticleManager> m_particle_manager;
480 std::unique_ptr<con::IConnection> m_con;
481 std::string m_address_name;
483 Camera *m_camera = nullptr;
484 Minimap *m_minimap = nullptr;
485
486 // Server serialization version
488
489 // Used version of the protocol with server
490 // Values smaller than 25 only mean they are smaller than 25,
491 // and aren't accurate. We simply just don't know, because
492 // the server didn't send the version back then.
493 // If 0, server init hasn't been received yet.
494 u16 m_proto_ver = 0;
495
500 // Block mesh animation parameters
501 float m_animation_time = 0.0f;
504 // 0 <= m_daynight_i < DAYNIGHT_CACHE_COUNT
505 //s32 m_daynight_i;
506 //u32 m_daynight_ratio;
507 std::queue<std::wstring> m_out_chat_queue;
510 std::queue<ChatMessage *> m_chat_queue;
511
512 // The authentication methods we can use to enter sudo mode (=change password)
514
515 // The seed returned by the server in TOCLIENT_INIT is stored here
516 u64 m_map_seed = 0;
517
518 // Auth data
519 std::string m_playername;
520 std::string m_password;
521 // If set, this will be sent (and cleared) upon a TOCLIENT_ACCEPT_SUDO_MODE
522 std::string m_new_password;
523 // Usable by auth mechanisms.
525 void *m_auth_data = nullptr;
526
527 bool m_access_denied = false;
529 std::string m_access_denied_reason = "";
530 std::queue<ClientEvent *> m_client_event_queue;
531 bool m_itemdef_received = false;
532 bool m_nodedef_received = false;
534 bool m_mods_loaded = false;
535
536 std::vector<std::string> m_remote_media_servers;
537 // Media downloader, only exists during init
539 // Pending downloads of dynamic media (key: token)
540 std::vector<std::pair<u32, std::shared_ptr<SingleMediaDownloader>>> m_pending_media_downloads;
541
542 // time_of_day speed approximation for old protocol
543 bool m_time_of_day_set = false;
544 float m_last_time_of_day_f = -1.0f;
546
547 // An interval for generally sending object positions and stuff
549
550 // Sounds
552 // Mapping from server sound ids to our sound ids
553 std::unordered_map<s32, sound_handle_t> m_sounds_server_to_client;
554 // And the other way!
555 // This takes ownership for the sound handles.
556 std::unordered_map<sound_handle_t, s32> m_sounds_client_to_server;
557 // Relation of client id to object id
558 std::unordered_map<sound_handle_t, u16> m_sounds_to_objects;
559
560 // Privileges
561 std::unordered_set<std::string> m_privileges;
562
563 // Detached inventories
564 // key = name
565 std::unordered_map<std::string, Inventory*> m_detached_inventories;
566
567 // Storage for mesh data for creating multiple instances of the same mesh
569
570 // own state
572
573 // Used for saving server map to disk client-side
577
578 // Client modding
582 std::vector<ModSpec> m_mods;
584
585 bool m_shutdown = false;
586
587 // CSM restrictions byteflag
590
591 std::unique_ptr<ModChannelMgr> m_modchannel_mgr;
592
593 // The number of blocks the client will combine for mesh generation.
595};
Definition address.h:28
virtual const char * what() const noexcept
Definition exceptions.h:17
Definition camera.h:68
Definition clientenvironment.h:54
const std::set< std::string > & getPlayerNames()
Definition clientenvironment.h:129
Definition clientmedia.h:85
Definition scripting_client.h:25
Definition client.h:104
void setFatalError(const std::string &reason)
Definition client.h:313
void handleCommand_NodeDef(NetworkPacket *pkt)
Definition clientpackethandler.cpp:763
void handleCommand_DeleteParticleSpawner(NetworkPacket *pkt)
Definition clientpackethandler.cpp:1131
const std::string * getModFile(std::string filename)
Definition client.cpp:2034
ICraftDefManager * getCraftDefManager() override
Definition client.cpp:1972
void handleCommand_Privileges(NetworkPacket *pkt)
Definition clientpackethandler.cpp:908
bool activeObjectsReceived() const
Definition client.h:333
v3s16 getCrackPos()
Definition client.cpp:1631
void loadMods()
Definition client.cpp:163
void handleCommand_AuthAccept(NetworkPacket *pkt)
Definition clientpackethandler.cpp:131
MapDatabase * m_localdb
Definition client.h:574
void clearOutChatQueue()
Definition client.cpp:1320
void handleCommand_ModChannelMsg(NetworkPacket *pkt)
Definition clientpackethandler.cpp:1677
MtEventManager * getEventManager()
Definition client.cpp:1998
std::unique_ptr< ParticleManager > m_particle_manager
Definition client.h:479
void handleCommand_DetachedInventory(NetworkPacket *pkt)
Definition clientpackethandler.cpp:936
StringMap m_mesh_data
Definition client.h:568
bool loadMedia(const std::string &data, const std::string &filename, bool from_media_push=false)
Definition client.cpp:759
std::unordered_map< sound_handle_t, u16 > m_sounds_to_objects
Definition client.h:558
void handleCommand_AddNode(NetworkPacket *pkt)
Definition clientpackethandler.cpp:242
Minimap * m_minimap
Definition client.h:484
IItemDefManager * getItemDefManager() override
Definition client.cpp:1964
void sendHaveMedia(const std::vector< u32 > &tokens)
Definition client.cpp:1418
float m_connection_reinit_timer
Definition client.h:463
void connect(const Address &address, const std::string &address_name, bool is_local_server)
Definition client.cpp:365
float m_inventory_from_server_age
Definition client.h:498
void handleCommand_DenySudoMode(NetworkPacket *pkt)
Definition clientpackethandler.cpp:179
void handleCommand_PlayerSpeed(NetworkPacket *pkt)
Definition clientpackethandler.cpp:1609
const std::string & getFormspecPrepend() const
Definition client.cpp:2105
void interact(InteractAction action, const PointedThing &pointed)
Definition client.cpp:1053
ClientEnvironment & getEnv()
Definition client.h:242
void request_media(const std::vector< std::string > &file_requests)
Definition client.cpp:869
bool checkCSMRestrictionFlag(CSMRestrictionFlags flag) const
Definition client.h:415
void updateCameraOffset(v3s16 camera_offset)
Definition client.cpp:1749
void Stop()
Definition client.cpp:296
MapNode CSMGetNode(v3s16 p, bool *is_valid_position)
Helper function for Client Side Modding CSM restrictions are applied there, this should not be used f...
Definition client.cpp:1465
void handleCommand_AnnounceMedia(NetworkPacket *pkt)
Definition clientpackethandler.cpp:650
ModStorageDatabase * getModStorageDatabase() override
Definition client.h:374
const ModSpec * getModSpec(const std::string &modname) const override
Definition client.cpp:291
u64 m_csm_restriction_flags
Definition client.h:588
scene::ISceneManager * getSceneManager()
Definition client.cpp:1556
std::queue< ClientEvent * > m_client_event_queue
Definition client.h:530
const Address getServerAddress()
Definition client.cpp:1764
void handleCommand_HP(NetworkPacket *pkt)
Definition clientpackethandler.cpp:560
void handleCommand_UpdatePlayerList(NetworkPacket *pkt)
Definition clientpackethandler.cpp:1536
void addUpdateMeshTask(v3s16 blockpos, bool ack_to_server=false, bool urgent=false)
Definition client.cpp:1711
void handleCommand_ActiveObjectMessages(NetworkPacket *pkt)
Definition clientpackethandler.cpp:486
bool nodedefReceived() const
Definition client.h:329
void handleCommand_ItemDef(NetworkPacket *pkt)
Definition clientpackethandler.cpp:782
StringMap m_mod_vfs
Definition client.h:583
Camera * getCamera()
Definition client.h:357
IntervalLimiter m_map_timer_and_unload_interval
Definition client.h:466
float m_recommended_send_interval
Definition client.h:548
std::unordered_map< s32, sound_handle_t > m_sounds_server_to_client
Definition client.h:553
float m_avg_rtt_timer
Definition client.h:464
float m_mod_storage_save_timer
Definition client.h:581
static const std::string & getBuiltinLuaPath()
Definition client.cpp:273
void handleCommand_ChatMessage(NetworkPacket *pkt)
Definition clientpackethandler.cpp:403
IntervalLimiter m_localdb_save_interval
Definition client.h:575
MeshGrid getMeshGrid()
Definition client.h:428
void sendRemovedSounds(const std::vector< s32 > &soundList)
Definition client.cpp:1209
void handleCommand_HudSetParam(NetworkPacket *pkt)
Definition clientpackethandler.cpp:1289
void handleCommand_HudSetSky(NetworkPacket *pkt)
Definition clientpackethandler.cpp:1311
void addUpdateMeshTaskWithEdge(v3s16 blockpos, bool ack_to_server=false, bool urgent=false)
Definition client.cpp:1723
NodeDefManager * m_nodedef
Definition client.h:471
void sendRespawnLegacy()
Definition client.cpp:1346
void sendUpdateClientInfo(const ClientDynamicInfo &info)
Definition client.cpp:1431
bool m_mods_loaded
Definition client.h:534
bool m_simple_singleplayer_mode
Definition client.h:339
void addNode(v3s16 p, MapNode n, bool remove_metadata=true)
Definition client.cpp:1502
void handleCommand_HudSetStars(NetworkPacket *pkt)
Definition clientpackethandler.cpp:1436
u32 m_sudo_auth_methods
Definition client.h:513
void handleCommand_Movement(NetworkPacket *pkt)
Definition clientpackethandler.cpp:516
std::vector< std::string > m_remote_media_servers
Definition client.h:536
void setCamera(Camera *camera)
Definition client.h:355
void handleCommand_HudSetMoon(NetworkPacket *pkt)
Definition clientpackethandler.cpp:1423
std::unordered_map< sound_handle_t, s32 > m_sounds_client_to_server
Definition client.h:556
float m_animation_time
Definition client.h:501
void pushToChatQueue(ChatMessage *cec)
Definition client.h:391
void setPlayerControl(PlayerControl &control)
Definition client.cpp:1520
LocalClientState m_state
Definition client.h:571
std::unique_ptr< con::IConnection > m_con
Definition client.h:480
std::vector< ModSpec > m_mods
Definition client.h:582
Camera * m_camera
Definition client.h:483
void handleCommand_LocalPlayerAnimations(NetworkPacket *pkt)
Definition clientpackethandler.cpp:1503
void sendInventoryFields(const std::string &formname, const StringMap &fields)
Definition client.cpp:1246
int m_crack_level
Definition client.h:502
IWritableShaderSource * m_shsrc
Definition client.h:469
std::unordered_map< std::string, Inventory * > m_detached_inventories
Definition client.h:565
void sendNodemetaFields(v3s16 p, const std::string &formname, const StringMap &fields)
Definition client.cpp:1224
void sendInit(const std::string &playerName)
Definition client.cpp:1124
void scanModIntoMemory(const std::string &mod_name, const std::string &mod_path)
Definition client.h:130
void handleCommand_Hello(NetworkPacket *pkt)
Definition clientpackethandler.cpp:61
void deleteAuthData()
Definition client.cpp:1090
static AuthMechanism choseAuthMech(const u32 mechs)
Definition client.cpp:1110
bool hasClientEvents() const
Definition client.h:305
void pushToEventQueue(ClientEvent *event)
Definition client.cpp:1957
std::string m_access_denied_reason
Definition client.h:529
bool itemdefReceived() const
Definition client.h:327
std::string m_password
Definition client.h:520
void inventoryAction(InventoryAction *a) override
Definition client.cpp:1605
std::string m_new_password
Definition client.h:522
void handleCommand_HudChange(NetworkPacket *pkt)
Definition clientpackethandler.cpp:1206
Inventory * getInventory(const InventoryLocation &loc) override
Definition client.cpp:1561
const std::unordered_set< std::string > & getPrivilegeList() const
Definition client.h:290
void typeChatMessage(const std::wstring &message)
Definition client.cpp:1694
IWritableTextureSource * m_tsrc
Definition client.h:468
const std::set< std::string > & getConnectedPlayerNames()
Definition client.h:274
RenderingEngine * m_rendering_engine
Definition client.h:474
void Send(NetworkPacket *pkt)
Definition client.cpp:1009
float mediaReceiveProgress()
Definition client.cpp:1769
float m_removed_sounds_check_timer
Definition client.h:551
bool modsLoaded() const
Definition client.h:397
bool checkPrivilege(const std::string &priv) const
Definition client.h:287
void sendDamage(u16 damage)
Definition client.cpp:1339
void handleCommand_EyeOffset(NetworkPacket *pkt)
Definition clientpackethandler.cpp:1523
std::queue< std::wstring > m_out_chat_queue
Definition client.h:507
u32 m_csm_restriction_noderange
Definition client.h:589
void handleCommand_FormspecPrepend(NetworkPacket *pkt)
Definition clientpackethandler.cpp:1591
int CSMClampRadius(v3s16 pos, int radius)
Definition client.cpp:1477
ClientEvent * getClientEvent()
Definition client.cpp:1754
void makeScreenshot()
Definition client.cpp:1888
bool mediaReceived() const
Definition client.h:331
void handleCommand_MovePlayer(NetworkPacket *pkt)
Definition clientpackethandler.cpp:601
ISoundManager * m_sound
Definition client.h:472
void handleCommand_NodemetaChanged(NetworkPacket *pkt)
Definition clientpackethandler.cpp:262
std::string m_playername
Definition client.h:519
float m_last_time_of_day_f
Definition client.h:544
void sendDeletedBlocks(std::vector< v3s16 > &blocks)
Definition client.cpp:1186
IWritableItemDefManager * m_itemdef
Definition client.h:470
bool checkLocalPrivilege(const std::string &priv)
Definition client.h:370
virtual ISoundManager * getSoundManager()
Definition client.cpp:1994
void ProcessData(NetworkPacket *pkt)
Definition client.cpp:964
bool sendModChannelMessage(const std::string &channel, const std::string &message) override
Definition client.cpp:2081
u16 getProtoVersion() const
Definition client.h:336
void handleCommand_PlaySound(NetworkPacket *pkt)
Definition clientpackethandler.cpp:801
void startAuth(AuthMechanism chosen_auth_mechanism)
Definition client.cpp:1135
void handleCommand_Null(NetworkPacket *pkt)
Definition client.h:160
bool joinModChannel(const std::string &channel) override
Definition client.cpp:2055
void handleCommand_SrpBytesSandB(NetworkPacket *pkt)
Definition clientpackethandler.cpp:1558
void scanModSubfolder(const std::string &mod_name, const std::string &mod_path, std::string mod_subpath)
Definition client.cpp:244
~Client()
Definition client.cpp:318
void handleCommand_MovePlayerRel(NetworkPacket *pkt)
Definition clientpackethandler.cpp:632
void removeNode(v3s16 p)
Definition client.cpp:1443
u64 getCSMRestrictionFlags() const
Definition client.h:410
void initLocalMapSaving(const Address &address, const std::string &hostname, bool is_local_server)
Definition client.cpp:893
std::vector< std::pair< u32, std::shared_ptr< SingleMediaDownloader > > > m_pending_media_downloads
Definition client.h:540
u16 m_proto_ver
Definition client.h:494
bool canSendChatMessage() const
Definition client.cpp:1281
ISoundManager * sound()
Definition client.h:244
void handleCommand_InventoryFormSpec(NetworkPacket *pkt)
Definition clientpackethandler.cpp:927
bool m_activeobjects_received
Definition client.h:533
void sendChangePassword(const std::string &oldpassword, const std::string &newpassword)
Definition client.cpp:1325
u16 allocateUnknownNodeId(const std::string &name) override
Definition client.cpp:1986
void handleCommand_Deprecated(NetworkPacket *pkt)
Definition clientpackethandler.cpp:54
void sendReady()
Definition client.cpp:1352
u8 m_server_ser_ver
Definition client.h:487
void handleCommand_HudSetFlags(NetworkPacket *pkt)
Definition clientpackethandler.cpp:1260
void step(float dtime)
Definition client.cpp:390
bool accessDenied() const
Definition client.h:309
const std::vector< ModSpec > & getMods() const override
Definition client.cpp:285
ELoginRegister m_allow_login_or_register
Definition client.h:482
bool m_update_wielded_item
Definition client.h:496
float m_chat_message_allowance
Definition client.h:509
void sendPlayerPos()
Definition client.cpp:1365
void handleCommand_HudSetSun(NetworkPacket *pkt)
Definition clientpackethandler.cpp:1410
void * m_auth_data
Definition client.h:525
void setFatalError(const LuaError &e)
Definition client.h:318
PacketCounter m_packetcounter
Definition client.h:499
u64 getMapSeed()
Definition client.h:296
int getCrackLevel()
Definition client.cpp:1626
float m_time_of_day_update_timer
Definition client.h:545
u16 getHP()
Definition client.cpp:1656
void handleCommand_RemoveNode(NetworkPacket *pkt)
Definition clientpackethandler.cpp:232
void sendChatMessage(const std::wstring &message)
Definition client.cpp:1295
void handleCommand_Breath(NetworkPacket *pkt)
Definition clientpackethandler.cpp:589
MeshGrid m_mesh_grid
Definition client.h:594
std::unique_ptr< MeshUpdateManager > m_mesh_update_manager
Definition client.h:477
void handleCommand_BlockData(NetworkPacket *pkt)
Definition clientpackethandler.cpp:288
std::unique_ptr< ModChannelMgr > m_modchannel_mgr
Definition client.h:591
void afterContentReceived()
Definition client.cpp:1814
void handleCommand_HudRemove(NetworkPacket *pkt)
Definition clientpackethandler.cpp:1194
virtual IWritableShaderSource * getShaderSource()
Definition client.cpp:1981
float getCurRate()
Definition client.cpp:1881
void showUpdateProgressTexture(void *args, u32 progress, u32 max_progress)
Definition client.cpp:1790
void handleCommand_ActiveObjectRemoveAdd(NetworkPacket *pkt)
Definition clientpackethandler.cpp:439
bool m_shutdown
Definition client.h:585
bool isShutdown()
Definition client.cpp:313
void handleCommand_Inventory(NetworkPacket *pkt)
Definition clientpackethandler.cpp:335
void addUpdateMeshTaskForNode(v3s16 nodepos, bool ack_to_server=false, bool urgent=false)
Definition client.cpp:1728
ModStorageDatabase * m_mod_storage_database
Definition client.h:580
void handleCommand_OverrideDayNightRatio(NetworkPacket *pkt)
Definition clientpackethandler.cpp:1487
bool m_nodedef_received
Definition client.h:532
u64 m_map_seed
Definition client.h:516
Inventory * m_inventory_from_server
Definition client.h:497
void handleCommand_MinimapModes(NetworkPacket *pkt)
Definition clientpackethandler.cpp:1765
bool m_itemdef_received
Definition client.h:531
void setPlayerItem(u16 item)
Definition client.cpp:1527
LocalClientState getState()
Definition client.h:387
ClientMediaDownloader * m_media_downloader
Definition client.h:538
void migrateModStorage()
Definition client.cpp:136
float getRTT()
Definition client.cpp:1875
float m_playerpos_send_timer
Definition client.h:465
ModChannel * getModChannel(const std::string &channel) override
Definition client.cpp:2100
virtual scene::IAnimatedMesh * getMesh(const std::string &filename, bool cache=false)
Definition client.cpp:2008
bool m_access_denied
Definition client.h:527
bool inhibit_inventory_revert
Definition client.h:433
static const std::string & getClientModsLuaPath()
Definition client.cpp:279
Minimap * getMinimap()
Definition client.h:354
void handleCommand_AccessDenied(NetworkPacket *pkt)
Definition clientpackethandler.cpp:188
ITextureSource * getTextureSource()
Definition client.cpp:1977
void handleCommand_AddParticleSpawner(NetworkPacket *pkt)
Definition clientpackethandler.cpp:1000
const std::string & getAddressName() const
Definition client.h:405
void handleCommand_DeathScreenLegacy(NetworkPacket *pkt)
Definition clientpackethandler.cpp:643
u16 m_cache_save_interval
Definition client.h:576
void handleCommand_ModChannelSignal(NetworkPacket *pkt)
Definition clientpackethandler.cpp:1695
void handleCommand_CSMRestrictionFlags(NetworkPacket *pkt)
Definition clientpackethandler.cpp:1600
void deletingPeer(con::IPeer *peer, bool timeout) override
Definition client.cpp:848
bool leaveModChannel(const std::string &channel) override
Definition client.cpp:2068
bool hasServerReplied() const
Definition client.h:350
AuthMechanism m_chosen_auth_mech
Definition client.h:524
std::queue< ChatMessage * > m_chat_queue
Definition client.h:510
std::unordered_set< std::string > m_privileges
Definition client.h:561
void handleCommand_Fov(NetworkPacket *pkt)
Definition clientpackethandler.cpp:540
void peerAdded(con::IPeer *peer) override
Definition client.cpp:842
void sendGotBlocks(const std::vector< v3s16 > &blocks)
Definition client.cpp:1199
MtEventManager * m_event
Definition client.h:473
void handleCommand_SetLighting(NetworkPacket *pkt)
Definition clientpackethandler.cpp:1792
void handleCommand_MediaPush(NetworkPacket *pkt)
Definition clientpackethandler.cpp:1620
void handleCommand(NetworkPacket *pkt)
Definition client.cpp:955
void handleCommand_TimeOfDay(NetworkPacket *pkt)
Definition clientpackethandler.cpp:355
void setCrack(int level, v3s16 pos)
Definition client.cpp:1636
bool m_access_denied_reconnect
Definition client.h:528
bool updateWieldedItem()
Definition client.cpp:1539
bool reconnectRequested() const
Definition client.h:311
const NodeDefManager * getNodeDefManager() override
Definition client.cpp:1968
ClientScripting * getScript()
Definition client.h:396
void handleCommand_AcceptSudoMode(NetworkPacket *pkt)
Definition clientpackethandler.cpp:165
v3s16 m_crack_pos
Definition client.h:503
DISABLE_CLASS_COPY(Client)
bool getChatMessage(std::wstring &message)
Definition client.cpp:1663
ITextureSource * tsrc()
Definition client.h:243
float m_packetcounter_timer
Definition client.h:462
std::string m_address_name
Definition client.h:481
void drawLoadScreen(const std::wstring &text, float dtime, int percent)
Definition client.cpp:1777
ClientEnvironment m_env
Definition client.h:478
void ReceiveAll()
Definition client.cpp:926
void sendInventoryAction(InventoryAction *a)
Definition client.cpp:1266
void handleCommand_SpawnParticle(NetworkPacket *pkt)
Definition clientpackethandler.cpp:985
const std::string & accessDeniedReason() const
Definition client.h:325
void handleCommand_HudAdd(NetworkPacket *pkt)
Definition clientpackethandler.cpp:1143
void handleCommand_ShowFormSpec(NetworkPacket *pkt)
Definition clientpackethandler.cpp:969
void handleCommand_CloudParams(NetworkPacket *pkt)
Definition clientpackethandler.cpp:1453
u32 m_last_chat_message_sent
Definition client.h:508
void handleCommand_Media(NetworkPacket *pkt)
Definition clientpackethandler.cpp:701
bool m_time_of_day_set
Definition client.h:543
virtual ParticleManager * getParticleManager()
Definition client.cpp:2003
float getAnimationTime()
Definition client.cpp:1621
v3s16 CSMClampPos(v3s16 pos)
Definition client.cpp:1489
void handleCommand_FadeSound(NetworkPacket *pkt)
Definition clientpackethandler.cpp:893
void handleCommand_StopSound(NetworkPacket *pkt)
Definition clientpackethandler.cpp:880
ClientScripting * m_script
Definition client.h:579
Definition craftdef.h:390
Definition gamedef.h:36
Definition itemdef.h:129
Definition sound.h:46
Definition texturesource.h:36
Definition itemdef.h:172
Definition shader.h:228
Definition texturesource.h:61
Definition numeric.h:347
Definition inventorymanager.h:96
Definition inventory.h:314
Definition c_types.h:40
Definition mapblock_mesh.h:164
Definition database.h:23
Definition mesh_generator_thread.h:111
Definition minimap.h:101
Definition modchannels.h:52
Definition modchannels.h:23
Definition database.h:74
Definition mtevent.h:49
Definition networkpacket.h:14
This class is for getting the actual properties of nodes from their content ID.
Definition nodedef.h:545
Definition client.h:75
std::map< u16, u32 > m_packets
Definition client.h:98
void print(std::ostream &o) const
Definition client.cpp:69
void add(u16 command)
Definition client.h:79
PacketCounter()=default
u32 sum() const
Definition client.cpp:61
void clear()
Definition client.h:88
Class doing particle as well as their spawners handling.
Definition particles.h:200
Definition renderingengine.h:68
Definition clientmedia.h:185
Definition connection.h:47
Definition connection.h:34
Definition peerhandler.h:13
LocalClientState
Definition client.h:64
@ LC_Init
Definition client.h:66
@ LC_Created
Definition client.h:65
@ LC_Ready
Definition client.h:67
int sound_handle_t
Definition client.h:62
ELoginRegister
Definition gameparams.h:21
core::vector3d< s16 > v3s16
Definition irr_v3d.h:13
Definition client.h:59
Definition al_extensions.cpp:11
CSMRestrictionFlags
Definition networkprotocol.h:926
@ CSM_RF_NONE
Definition networkprotocol.h:927
InteractAction
Definition networkprotocol.h:942
AuthMechanism
Definition networkprotocol.h:888
std::unordered_map< std::string, std::string > StringMap
Definition string.h:66
Definition chatmessage.h:20
Definition clientdynamicinfo.h:12
Definition clientevent.h:67
Definition inventorymanager.h:116
Definition inventorymanager.h:18
Definition clientmap.h:14
Definition mapnode.h:124
Describes a grid with given step, oirginating at (0,0,0)
Definition numeric.h:136
Definition mapblock_mesh.h:30
Definition minimap.h:51
Definition mods.h:25
Definition player.h:46
An active object or node which is selected by a ray on the map.
Definition pointedthing.h:22
static std::string p(std::string path)
Definition test_filesys.cpp:55