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;
102class GameUI;
103
104class Client : public con::PeerHandler, public InventoryManager, public IGameDef
105{
106public:
107 /*
108 NOTE: Nothing is thread-safe here.
109 */
110
111 Client(
112 const char *playername,
113 const std::string &password,
114 MapDrawControl &control,
118 NodeDefManager *nodedef,
120 MtEventManager *event,
121 RenderingEngine *rendering_engine,
122 GameUI *game_ui,
123 ELoginRegister allow_login_or_register
124 );
125
126 ~Client();
128
129 // Load local mods into memory
130 void scanModSubfolder(const std::string &mod_name, const std::string &mod_path,
131 std::string mod_subpath);
132 inline void scanModIntoMemory(const std::string &mod_name, const std::string &mod_path)
133 {
134 scanModSubfolder(mod_name, mod_path, "");
135 }
136
137 /*
138 request all threads managed by client to be stopped
139 */
140 void Stop();
141
142
143 bool isShutdown();
144
145 void connect(const Address &address, const std::string &address_name,
146 bool is_local_server);
147
148 /*
149 Stuff that references the environment is valid only as
150 long as this is not called. (eg. Players)
151 If this throws a PeerNotFoundException, the connection has
152 timed out.
153 */
154 void step(float dtime);
155
156 /*
157 * Command Handlers
158 */
159
160 void handleCommand(NetworkPacket* pkt);
161
222
223 void ProcessData(NetworkPacket *pkt);
224
225 void Send(NetworkPacket* pkt);
226
227 void interact(InteractAction action, const PointedThing &pointed);
228
229 void sendNodemetaFields(v3s16 p, const std::string &formname,
230 const StringMap &fields);
231 void sendInventoryFields(const std::string &formname,
232 const StringMap &fields);
234 void sendChatMessage(const std::wstring &message);
235 void clearOutChatQueue();
236 void sendChangePassword(const std::string &oldpassword,
237 const std::string &newpassword);
238 void sendDamage(u16 damage);
239 void sendRespawnLegacy();
240 void sendReady();
241 void sendHaveMedia(const std::vector<u32> &tokens);
242 void sendUpdateClientInfo(const ClientDynamicInfo &info);
243
247 static const std::string &getBuiltinLuaPath();
248 static const std::string &getClientModsLuaPath();
249
250 const std::vector<ModSpec> &getMods() const override;
251 const ModSpec* getModSpec(const std::string &modname) const override;
252
253 // Causes urgent mesh updates (unlike Map::add/removeNodeWithEvent)
254 void removeNode(v3s16 p);
255
256 // helpers to enforce CSM restrictions
257 MapNode CSMGetNode(v3s16 p, bool *is_valid_position);
258 int CSMClampRadius(v3s16 pos, int radius);
260
261 void addNode(v3s16 p, MapNode n, bool remove_metadata = true);
262
263 void setPlayerControl(PlayerControl &control);
264
265 // Returns true if the inventory of the local player has been
266 // updated from the server. If it is true, it is set to false.
267 bool updateWieldedItem();
268
269 /* InventoryManager interface */
270 Inventory* getInventory(const InventoryLocation &loc) override;
271 void inventoryAction(InventoryAction *a) override;
272
273 // Send the item number 'item' as player item to the server
274 void setPlayerItem(u16 item);
275
276 const std::set<std::string> &getConnectedPlayerNames()
277 {
278 return m_env.getPlayerNames();
279 }
280
281 float getAnimationTime();
282
283 int getCrackLevel();
285 void setCrack(int level, v3s16 pos);
286
287 u16 getHP();
288
289 bool checkPrivilege(const std::string &priv) const
290 { return (m_privileges.count(priv) != 0); }
291
292 const std::unordered_set<std::string> &getPrivilegeList() const
293 { return m_privileges; }
294
295 bool getChatMessage(std::wstring &message);
296 void typeChatMessage(const std::wstring& message);
297
298 u64 getMapSeed(){ return m_map_seed; }
299
300 void addUpdateMeshTask(v3s16 blockpos, bool ack_to_server=false, bool urgent=false);
301 // Including blocks at appropriate edges
302 void addUpdateMeshTaskWithEdge(v3s16 blockpos, bool ack_to_server=false, bool urgent=false);
303 void addUpdateMeshTaskForNode(v3s16 nodepos, bool ack_to_server=false, bool urgent=false);
304
305 void updateCameraOffset(v3s16 camera_offset);
306
307 bool hasClientEvents() const { return !m_client_event_queue.empty(); }
308 // Get event from queue. If queue is empty, it triggers an assertion failure.
310
311 bool accessDenied() const { return m_access_denied; }
312
314
315 void setFatalError(const std::string &reason)
316 {
317 m_access_denied = true;
318 m_access_denied_reason = reason;
319 }
320 inline void setFatalError(const LuaError &e)
321 {
322 setFatalError(std::string("Lua: ") + e.what());
323 }
324
325 // Renaming accessDeniedReason to better name could be good as it's used to
326 // disconnect client when CSM failed.
327 const std::string &accessDeniedReason() const { return m_access_denied_reason; }
328
329 bool itemdefReceived() const
330 { return m_itemdef_received; }
331 bool nodedefReceived() const
332 { return m_nodedef_received; }
333 bool mediaReceived() const
334 { return !m_media_downloader; }
337
338 u16 getProtoVersion() const
339 { return m_proto_ver; }
340
342
343 float mediaReceiveProgress();
344
345 void drawLoadScreen(const std::wstring &text, float dtime, int percent);
347 void showUpdateProgressTexture(void *args, u32 progress, u32 max_progress);
348
349 float getRTT();
350 float getCurRate();
351 // has the server ever replied to us, used for connection retry/fallback
352 bool hasServerReplied() const {
353 return getProtoVersion() != 0; // (set in TOCLIENT_HELLO)
354 }
355
357 void setCamera(Camera* camera) { m_camera = camera; }
358
359 Camera* getCamera () { return m_camera; }
360 scene::ISceneManager *getSceneManager();
361
362 // IGameDef interface
364 const NodeDefManager* getNodeDefManager() override;
368 u16 allocateUnknownNodeId(const std::string &name) override;
372 bool checkLocalPrivilege(const std::string &priv)
373 { return checkPrivilege(priv); }
374 virtual scene::IAnimatedMesh* getMesh(const std::string &filename, bool cache = false);
375 const std::string* getModFile(std::string filename);
377
378 // Migrates away old files-based mod storage if necessary
379 void migrateModStorage();
380
381 // The following set of functions is used by ClientMediaDownloader
382 // Insert a media file appropriately into the appropriate manager
383 bool loadMedia(const std::string &data, const std::string &filename,
384 bool from_media_push = false);
385
386 // Send a request for conventional media transfer
387 void request_media(const std::vector<std::string> &file_requests);
388
390
391 void makeScreenshot();
392
393 inline void pushToChatQueue(ChatMessage *cec)
394 {
395 m_chat_queue.push(cec);
396 }
397
399 bool modsLoaded() const { return m_mods_loaded; }
400
401 void pushToEventQueue(ClientEvent *event);
402
403 // IP and port we're connected to
405
406 // Hostname of the connected server (but can also be a numerical IP)
407 const std::string &getAddressName() const
408 {
409 return m_address_name;
410 }
411
412 inline u64 getCSMRestrictionFlags() const
413 {
415 }
416
418 {
419 return m_csm_restriction_flags & flag;
420 }
421
422 bool joinModChannel(const std::string &channel) override;
423 bool leaveModChannel(const std::string &channel) override;
424 bool sendModChannelMessage(const std::string &channel,
425 const std::string &message) override;
426 ModChannel *getModChannel(const std::string &channel) override;
427
428 const std::string &getFormspecPrepend() const;
429
431 {
432 return m_mesh_grid;
433 }
434
436
437private:
438 void loadMods();
439
440 // Virtual methods from con::PeerHandler
441 void peerAdded(con::IPeer *peer) override;
442 void deletingPeer(con::IPeer *peer, bool timeout) override;
443
444 void initLocalMapSaving(const Address &address,
445 const std::string &hostname,
446 bool is_local_server);
447
448 void ReceiveAll();
449
450 void sendPlayerPos();
451
452 void deleteAuthData();
453 // helper method shared with clientpackethandler
454 static AuthMechanism choseAuthMech(const u32 mechs);
455
456 void sendInit(const std::string &playerName);
457 void startAuth(AuthMechanism chosen_auth_mechanism);
458 void sendDeletedBlocks(std::vector<v3s16> &blocks);
459 void sendGotBlocks(const std::vector<v3s16> &blocks);
460 void sendRemovedSounds(const std::vector<s32> &soundList);
461
462 bool canSendChatMessage() const;
463
466 float m_avg_rtt_timer = 0.0f;
469
477
478
479 std::unique_ptr<MeshUpdateManager> m_mesh_update_manager;
481 std::unique_ptr<ParticleManager> m_particle_manager;
482 std::unique_ptr<con::IConnection> m_con;
483 std::string m_address_name;
485 Camera *m_camera = nullptr;
486 Minimap *m_minimap = nullptr;
487
488 // Server serialization version
490
491 // Used version of the protocol with server
492 // Values smaller than 25 only mean they are smaller than 25,
493 // and aren't accurate. We simply just don't know, because
494 // the server didn't send the version back then.
495 // If 0, server init hasn't been received yet.
496 u16 m_proto_ver = 0;
497
502 // Block mesh animation parameters
503 float m_animation_time = 0.0f;
506 // 0 <= m_daynight_i < DAYNIGHT_CACHE_COUNT
507 //s32 m_daynight_i;
508 //u32 m_daynight_ratio;
509 std::queue<std::wstring> m_out_chat_queue;
512 std::queue<ChatMessage *> m_chat_queue;
513
514 // The authentication methods we can use to enter sudo mode (=change password)
516
517 // The seed returned by the server in TOCLIENT_INIT is stored here
518 u64 m_map_seed = 0;
519
520 // Auth data
521 std::string m_playername;
522 std::string m_password;
523 // If set, this will be sent (and cleared) upon a TOCLIENT_ACCEPT_SUDO_MODE
524 std::string m_new_password;
525 // Usable by auth mechanisms.
527 void *m_auth_data = nullptr;
528
529 bool m_access_denied = false;
531 std::string m_access_denied_reason = "";
532 std::queue<ClientEvent *> m_client_event_queue;
533 bool m_itemdef_received = false;
534 bool m_nodedef_received = false;
536 bool m_mods_loaded = false;
537
538 std::vector<std::string> m_remote_media_servers;
539 // Media downloader, only exists during init
541 // Pending downloads of dynamic media (key: token)
542 std::vector<std::pair<u32, std::shared_ptr<SingleMediaDownloader>>> m_pending_media_downloads;
543
544 // time_of_day speed approximation for old protocol
545 bool m_time_of_day_set = false;
546 float m_last_time_of_day_f = -1.0f;
548
549 // An interval for generally sending object positions and stuff
551
552 // Sounds
554 // Mapping from server sound ids to our sound ids
555 std::unordered_map<s32, sound_handle_t> m_sounds_server_to_client;
556 // And the other way!
557 // This takes ownership for the sound handles.
558 std::unordered_map<sound_handle_t, s32> m_sounds_client_to_server;
559 // Relation of client id to object id
560 std::unordered_map<sound_handle_t, u16> m_sounds_to_objects;
561
562 // Privileges
563 std::unordered_set<std::string> m_privileges;
564
565 // Detached inventories
566 // key = name
567 std::unordered_map<std::string, Inventory*> m_detached_inventories;
568
569 // Storage for mesh data for creating multiple instances of the same mesh
571
572 // own state
574
576
577 // Used for saving server map to disk client-side
581
582 // Client modding
586 std::vector<ModSpec> m_mods;
588
589 bool m_shutdown = false;
590
591 // CSM restrictions byteflag
594
595 std::unique_ptr<ModChannelMgr> m_modchannel_mgr;
596
597 // The number of blocks the client will combine for mesh generation.
599};
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:105
void setFatalError(const std::string &reason)
Definition client.h:315
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:2037
ICraftDefManager * getCraftDefManager() override
Definition client.cpp:1975
void handleCommand_Privileges(NetworkPacket *pkt)
Definition clientpackethandler.cpp:908
bool activeObjectsReceived() const
Definition client.h:335
v3s16 getCrackPos()
Definition client.cpp:1634
void loadMods()
Definition client.cpp:166
void handleCommand_AuthAccept(NetworkPacket *pkt)
Definition clientpackethandler.cpp:131
MapDatabase * m_localdb
Definition client.h:578
void clearOutChatQueue()
Definition client.cpp:1323
void handleCommand_ModChannelMsg(NetworkPacket *pkt)
Definition clientpackethandler.cpp:1682
MtEventManager * getEventManager()
Definition client.cpp:2001
std::unique_ptr< ParticleManager > m_particle_manager
Definition client.h:481
void handleCommand_DetachedInventory(NetworkPacket *pkt)
Definition clientpackethandler.cpp:936
StringMap m_mesh_data
Definition client.h:570
bool loadMedia(const std::string &data, const std::string &filename, bool from_media_push=false)
Definition client.cpp:762
std::unordered_map< sound_handle_t, u16 > m_sounds_to_objects
Definition client.h:560
void handleCommand_AddNode(NetworkPacket *pkt)
Definition clientpackethandler.cpp:242
Minimap * m_minimap
Definition client.h:486
IItemDefManager * getItemDefManager() override
Definition client.cpp:1967
void sendHaveMedia(const std::vector< u32 > &tokens)
Definition client.cpp:1421
float m_connection_reinit_timer
Definition client.h:465
void connect(const Address &address, const std::string &address_name, bool is_local_server)
Definition client.cpp:368
float m_inventory_from_server_age
Definition client.h:500
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:2108
void interact(InteractAction action, const PointedThing &pointed)
Definition client.cpp:1056
ClientEnvironment & getEnv()
Definition client.h:244
void request_media(const std::vector< std::string > &file_requests)
Definition client.cpp:872
bool checkCSMRestrictionFlag(CSMRestrictionFlags flag) const
Definition client.h:417
void updateCameraOffset(v3s16 camera_offset)
Definition client.cpp:1752
void Stop()
Definition client.cpp:299
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:1468
void handleCommand_AnnounceMedia(NetworkPacket *pkt)
Definition clientpackethandler.cpp:650
ModStorageDatabase * getModStorageDatabase() override
Definition client.h:376
const ModSpec * getModSpec(const std::string &modname) const override
Definition client.cpp:294
u64 m_csm_restriction_flags
Definition client.h:592
scene::ISceneManager * getSceneManager()
Definition client.cpp:1559
std::queue< ClientEvent * > m_client_event_queue
Definition client.h:532
const Address getServerAddress()
Definition client.cpp:1767
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:1714
void handleCommand_ActiveObjectMessages(NetworkPacket *pkt)
Definition clientpackethandler.cpp:486
bool nodedefReceived() const
Definition client.h:331
void handleCommand_ItemDef(NetworkPacket *pkt)
Definition clientpackethandler.cpp:782
StringMap m_mod_vfs
Definition client.h:587
Camera * getCamera()
Definition client.h:359
IntervalLimiter m_map_timer_and_unload_interval
Definition client.h:468
float m_recommended_send_interval
Definition client.h:550
std::unordered_map< s32, sound_handle_t > m_sounds_server_to_client
Definition client.h:555
float m_avg_rtt_timer
Definition client.h:466
float m_mod_storage_save_timer
Definition client.h:585
static const std::string & getBuiltinLuaPath()
Definition client.cpp:276
void handleCommand_ChatMessage(NetworkPacket *pkt)
Definition clientpackethandler.cpp:403
IntervalLimiter m_localdb_save_interval
Definition client.h:579
MeshGrid getMeshGrid()
Definition client.h:430
void sendRemovedSounds(const std::vector< s32 > &soundList)
Definition client.cpp:1212
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:1726
NodeDefManager * m_nodedef
Definition client.h:473
void sendRespawnLegacy()
Definition client.cpp:1349
void sendUpdateClientInfo(const ClientDynamicInfo &info)
Definition client.cpp:1434
bool m_mods_loaded
Definition client.h:536
bool m_simple_singleplayer_mode
Definition client.h:341
void addNode(v3s16 p, MapNode n, bool remove_metadata=true)
Definition client.cpp:1505
void handleCommand_HudSetStars(NetworkPacket *pkt)
Definition clientpackethandler.cpp:1436
u32 m_sudo_auth_methods
Definition client.h:515
void handleCommand_Movement(NetworkPacket *pkt)
Definition clientpackethandler.cpp:516
std::vector< std::string > m_remote_media_servers
Definition client.h:538
void setCamera(Camera *camera)
Definition client.h:357
void handleCommand_HudSetMoon(NetworkPacket *pkt)
Definition clientpackethandler.cpp:1423
std::unordered_map< sound_handle_t, s32 > m_sounds_client_to_server
Definition client.h:558
float m_animation_time
Definition client.h:503
void pushToChatQueue(ChatMessage *cec)
Definition client.h:393
void setPlayerControl(PlayerControl &control)
Definition client.cpp:1523
LocalClientState m_state
Definition client.h:573
std::unique_ptr< con::IConnection > m_con
Definition client.h:482
std::vector< ModSpec > m_mods
Definition client.h:586
Camera * m_camera
Definition client.h:485
void handleCommand_LocalPlayerAnimations(NetworkPacket *pkt)
Definition clientpackethandler.cpp:1503
void sendInventoryFields(const std::string &formname, const StringMap &fields)
Definition client.cpp:1249
int m_crack_level
Definition client.h:504
IWritableShaderSource * m_shsrc
Definition client.h:471
std::unordered_map< std::string, Inventory * > m_detached_inventories
Definition client.h:567
void sendNodemetaFields(v3s16 p, const std::string &formname, const StringMap &fields)
Definition client.cpp:1227
void sendInit(const std::string &playerName)
Definition client.cpp:1127
void scanModIntoMemory(const std::string &mod_name, const std::string &mod_path)
Definition client.h:132
void handleCommand_Hello(NetworkPacket *pkt)
Definition clientpackethandler.cpp:61
void deleteAuthData()
Definition client.cpp:1093
static AuthMechanism choseAuthMech(const u32 mechs)
Definition client.cpp:1113
bool hasClientEvents() const
Definition client.h:307
void pushToEventQueue(ClientEvent *event)
Definition client.cpp:1960
std::string m_access_denied_reason
Definition client.h:531
bool itemdefReceived() const
Definition client.h:329
std::string m_password
Definition client.h:522
void inventoryAction(InventoryAction *a) override
Definition client.cpp:1608
std::string m_new_password
Definition client.h:524
void handleCommand_HudChange(NetworkPacket *pkt)
Definition clientpackethandler.cpp:1206
Inventory * getInventory(const InventoryLocation &loc) override
Definition client.cpp:1564
const std::unordered_set< std::string > & getPrivilegeList() const
Definition client.h:292
void typeChatMessage(const std::wstring &message)
Definition client.cpp:1697
IWritableTextureSource * m_tsrc
Definition client.h:470
const std::set< std::string > & getConnectedPlayerNames()
Definition client.h:276
RenderingEngine * m_rendering_engine
Definition client.h:476
void Send(NetworkPacket *pkt)
Definition client.cpp:1012
float mediaReceiveProgress()
Definition client.cpp:1772
float m_removed_sounds_check_timer
Definition client.h:553
bool modsLoaded() const
Definition client.h:399
bool checkPrivilege(const std::string &priv) const
Definition client.h:289
void sendDamage(u16 damage)
Definition client.cpp:1342
void handleCommand_EyeOffset(NetworkPacket *pkt)
Definition clientpackethandler.cpp:1523
std::queue< std::wstring > m_out_chat_queue
Definition client.h:509
u32 m_csm_restriction_noderange
Definition client.h:593
void handleCommand_FormspecPrepend(NetworkPacket *pkt)
Definition clientpackethandler.cpp:1591
int CSMClampRadius(v3s16 pos, int radius)
Definition client.cpp:1480
ClientEvent * getClientEvent()
Definition client.cpp:1757
void makeScreenshot()
Definition client.cpp:1891
bool mediaReceived() const
Definition client.h:333
void handleCommand_MovePlayer(NetworkPacket *pkt)
Definition clientpackethandler.cpp:601
ISoundManager * m_sound
Definition client.h:474
void handleCommand_NodemetaChanged(NetworkPacket *pkt)
Definition clientpackethandler.cpp:262
std::string m_playername
Definition client.h:521
float m_last_time_of_day_f
Definition client.h:546
void sendDeletedBlocks(std::vector< v3s16 > &blocks)
Definition client.cpp:1189
IWritableItemDefManager * m_itemdef
Definition client.h:472
bool checkLocalPrivilege(const std::string &priv)
Definition client.h:372
virtual ISoundManager * getSoundManager()
Definition client.cpp:1997
void ProcessData(NetworkPacket *pkt)
Definition client.cpp:967
bool sendModChannelMessage(const std::string &channel, const std::string &message) override
Definition client.cpp:2084
u16 getProtoVersion() const
Definition client.h:338
void handleCommand_PlaySound(NetworkPacket *pkt)
Definition clientpackethandler.cpp:801
void startAuth(AuthMechanism chosen_auth_mechanism)
Definition client.cpp:1138
void handleCommand_Null(NetworkPacket *pkt)
Definition client.h:162
bool joinModChannel(const std::string &channel) override
Definition client.cpp:2058
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:247
~Client()
Definition client.cpp:321
void handleCommand_MovePlayerRel(NetworkPacket *pkt)
Definition clientpackethandler.cpp:632
void removeNode(v3s16 p)
Definition client.cpp:1446
u64 getCSMRestrictionFlags() const
Definition client.h:412
void initLocalMapSaving(const Address &address, const std::string &hostname, bool is_local_server)
Definition client.cpp:896
std::vector< std::pair< u32, std::shared_ptr< SingleMediaDownloader > > > m_pending_media_downloads
Definition client.h:542
u16 m_proto_ver
Definition client.h:496
bool canSendChatMessage() const
Definition client.cpp:1284
ISoundManager * sound()
Definition client.h:246
void handleCommand_InventoryFormSpec(NetworkPacket *pkt)
Definition clientpackethandler.cpp:927
bool m_activeobjects_received
Definition client.h:535
GameUI * m_game_ui
Definition client.h:575
void sendChangePassword(const std::string &oldpassword, const std::string &newpassword)
Definition client.cpp:1328
u16 allocateUnknownNodeId(const std::string &name) override
Definition client.cpp:1989
void handleCommand_Deprecated(NetworkPacket *pkt)
Definition clientpackethandler.cpp:54
void sendReady()
Definition client.cpp:1355
u8 m_server_ser_ver
Definition client.h:489
void handleCommand_HudSetFlags(NetworkPacket *pkt)
Definition clientpackethandler.cpp:1260
void step(float dtime)
Definition client.cpp:393
bool accessDenied() const
Definition client.h:311
const std::vector< ModSpec > & getMods() const override
Definition client.cpp:288
ELoginRegister m_allow_login_or_register
Definition client.h:484
bool m_update_wielded_item
Definition client.h:498
float m_chat_message_allowance
Definition client.h:511
void sendPlayerPos()
Definition client.cpp:1368
void handleCommand_HudSetSun(NetworkPacket *pkt)
Definition clientpackethandler.cpp:1410
void * m_auth_data
Definition client.h:527
void setFatalError(const LuaError &e)
Definition client.h:320
PacketCounter m_packetcounter
Definition client.h:501
u64 getMapSeed()
Definition client.h:298
int getCrackLevel()
Definition client.cpp:1629
float m_time_of_day_update_timer
Definition client.h:547
u16 getHP()
Definition client.cpp:1659
void handleCommand_RemoveNode(NetworkPacket *pkt)
Definition clientpackethandler.cpp:232
void sendChatMessage(const std::wstring &message)
Definition client.cpp:1298
void handleCommand_Breath(NetworkPacket *pkt)
Definition clientpackethandler.cpp:589
MeshGrid m_mesh_grid
Definition client.h:598
std::unique_ptr< MeshUpdateManager > m_mesh_update_manager
Definition client.h:479
void handleCommand_BlockData(NetworkPacket *pkt)
Definition clientpackethandler.cpp:288
std::unique_ptr< ModChannelMgr > m_modchannel_mgr
Definition client.h:595
void afterContentReceived()
Definition client.cpp:1817
void handleCommand_HudRemove(NetworkPacket *pkt)
Definition clientpackethandler.cpp:1194
virtual IWritableShaderSource * getShaderSource()
Definition client.cpp:1984
float getCurRate()
Definition client.cpp:1884
void showUpdateProgressTexture(void *args, u32 progress, u32 max_progress)
Definition client.cpp:1793
void handleCommand_ActiveObjectRemoveAdd(NetworkPacket *pkt)
Definition clientpackethandler.cpp:439
bool m_shutdown
Definition client.h:589
bool isShutdown()
Definition client.cpp:316
void handleCommand_Inventory(NetworkPacket *pkt)
Definition clientpackethandler.cpp:335
void addUpdateMeshTaskForNode(v3s16 nodepos, bool ack_to_server=false, bool urgent=false)
Definition client.cpp:1731
ModStorageDatabase * m_mod_storage_database
Definition client.h:584
void handleCommand_OverrideDayNightRatio(NetworkPacket *pkt)
Definition clientpackethandler.cpp:1487
bool m_nodedef_received
Definition client.h:534
u64 m_map_seed
Definition client.h:518
Inventory * m_inventory_from_server
Definition client.h:499
void handleCommand_MinimapModes(NetworkPacket *pkt)
Definition clientpackethandler.cpp:1770
bool m_itemdef_received
Definition client.h:533
void setPlayerItem(u16 item)
Definition client.cpp:1530
LocalClientState getState()
Definition client.h:389
ClientMediaDownloader * m_media_downloader
Definition client.h:540
void migrateModStorage()
Definition client.cpp:139
float getRTT()
Definition client.cpp:1878
float m_playerpos_send_timer
Definition client.h:467
ModChannel * getModChannel(const std::string &channel) override
Definition client.cpp:2103
virtual scene::IAnimatedMesh * getMesh(const std::string &filename, bool cache=false)
Definition client.cpp:2011
bool m_access_denied
Definition client.h:529
bool inhibit_inventory_revert
Definition client.h:435
static const std::string & getClientModsLuaPath()
Definition client.cpp:282
Minimap * getMinimap()
Definition client.h:356
void handleCommand_AccessDenied(NetworkPacket *pkt)
Definition clientpackethandler.cpp:188
ITextureSource * getTextureSource()
Definition client.cpp:1980
void handleCommand_AddParticleSpawner(NetworkPacket *pkt)
Definition clientpackethandler.cpp:1000
const std::string & getAddressName() const
Definition client.h:407
void handleCommand_DeathScreenLegacy(NetworkPacket *pkt)
Definition clientpackethandler.cpp:643
u16 m_cache_save_interval
Definition client.h:580
void handleCommand_ModChannelSignal(NetworkPacket *pkt)
Definition clientpackethandler.cpp:1700
void handleCommand_CSMRestrictionFlags(NetworkPacket *pkt)
Definition clientpackethandler.cpp:1600
void deletingPeer(con::IPeer *peer, bool timeout) override
Definition client.cpp:851
bool leaveModChannel(const std::string &channel) override
Definition client.cpp:2071
bool hasServerReplied() const
Definition client.h:352
AuthMechanism m_chosen_auth_mech
Definition client.h:526
std::queue< ChatMessage * > m_chat_queue
Definition client.h:512
std::unordered_set< std::string > m_privileges
Definition client.h:563
void handleCommand_Fov(NetworkPacket *pkt)
Definition clientpackethandler.cpp:540
void peerAdded(con::IPeer *peer) override
Definition client.cpp:845
void sendGotBlocks(const std::vector< v3s16 > &blocks)
Definition client.cpp:1202
MtEventManager * m_event
Definition client.h:475
void handleCommand_SetLighting(NetworkPacket *pkt)
Definition clientpackethandler.cpp:1797
void handleCommand_MediaPush(NetworkPacket *pkt)
Definition clientpackethandler.cpp:1620
void handleCommand(NetworkPacket *pkt)
Definition client.cpp:958
void handleCommand_TimeOfDay(NetworkPacket *pkt)
Definition clientpackethandler.cpp:355
void setCrack(int level, v3s16 pos)
Definition client.cpp:1639
bool m_access_denied_reconnect
Definition client.h:530
bool updateWieldedItem()
Definition client.cpp:1542
bool reconnectRequested() const
Definition client.h:313
const NodeDefManager * getNodeDefManager() override
Definition client.cpp:1971
ClientScripting * getScript()
Definition client.h:398
void handleCommand_AcceptSudoMode(NetworkPacket *pkt)
Definition clientpackethandler.cpp:165
v3s16 m_crack_pos
Definition client.h:505
DISABLE_CLASS_COPY(Client)
bool getChatMessage(std::wstring &message)
Definition client.cpp:1666
ITextureSource * tsrc()
Definition client.h:245
float m_packetcounter_timer
Definition client.h:464
std::string m_address_name
Definition client.h:483
void drawLoadScreen(const std::wstring &text, float dtime, int percent)
Definition client.cpp:1780
ClientEnvironment m_env
Definition client.h:480
void ReceiveAll()
Definition client.cpp:929
void sendInventoryAction(InventoryAction *a)
Definition client.cpp:1269
void handleCommand_SpawnParticle(NetworkPacket *pkt)
Definition clientpackethandler.cpp:985
const std::string & accessDeniedReason() const
Definition client.h:327
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:510
void handleCommand_Media(NetworkPacket *pkt)
Definition clientpackethandler.cpp:701
bool m_time_of_day_set
Definition client.h:545
virtual ParticleManager * getParticleManager()
Definition client.cpp:2006
float getAnimationTime()
Definition client.cpp:1624
v3s16 CSMClampPos(v3s16 pos)
Definition client.cpp:1492
void handleCommand_FadeSound(NetworkPacket *pkt)
Definition clientpackethandler.cpp:893
void handleCommand_StopSound(NetworkPacket *pkt)
Definition clientpackethandler.cpp:880
ClientScripting * m_script
Definition client.h:583
Definition gameui.h:29
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:213
Definition texturesource.h:62
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:540
Definition client.h:75
std::map< u16, u32 > m_packets
Definition client.h:98
void print(std::ostream &o) const
Definition client.cpp:70
void add(u16 command)
Definition client.h:79
PacketCounter()=default
u32 sum() const
Definition client.cpp:62
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:65
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:53