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 bool hasClientEvents() const { return !m_client_event_queue.empty(); }
304 // Get event from queue. If queue is empty, it triggers an assertion failure.
306
307 bool accessDenied() const { return m_access_denied; }
308
310
311 void setFatalError(const std::string &reason)
312 {
313 m_access_denied = true;
314 m_access_denied_reason = reason;
315 }
316 inline void setFatalError(const LuaError &e)
317 {
318 setFatalError(std::string("Lua: ") + e.what());
319 }
320
321 // Renaming accessDeniedReason to better name could be good as it's used to
322 // disconnect client when CSM failed.
323 const std::string &accessDeniedReason() const { return m_access_denied_reason; }
324
325 bool itemdefReceived() const
326 { return m_itemdef_received; }
327 bool nodedefReceived() const
328 { return m_nodedef_received; }
329 bool mediaReceived() const
330 { return !m_media_downloader; }
333
334 u16 getProtoVersion() const
335 { return m_proto_ver; }
336
338
339 float mediaReceiveProgress();
340
341 void drawLoadScreen(const std::wstring &text, float dtime, int percent);
343 void showUpdateProgressTexture(void *args, u32 progress, u32 max_progress);
344
345 float getRTT();
346 float getCurRate();
347 // has the server ever replied to us, used for connection retry/fallback
348 bool hasServerReplied() const {
349 return getProtoVersion() != 0; // (set in TOCLIENT_HELLO)
350 }
351
353 void setCamera(Camera* camera) { m_camera = camera; }
354
355 Camera* getCamera () { return m_camera; }
356 scene::ISceneManager *getSceneManager();
357
358 // IGameDef interface
360 const NodeDefManager* getNodeDefManager() override;
364 u16 allocateUnknownNodeId(const std::string &name) override;
368 bool checkLocalPrivilege(const std::string &priv)
369 { return checkPrivilege(priv); }
370 virtual scene::IAnimatedMesh* getMesh(const std::string &filename, bool cache = false);
371 const std::string* getModFile(std::string filename);
373
374 // Migrates away old files-based mod storage if necessary
375 void migrateModStorage();
376
377 // The following set of functions is used by ClientMediaDownloader
378 // Insert a media file appropriately into the appropriate manager
379 bool loadMedia(const std::string &data, const std::string &filename,
380 bool from_media_push = false);
381
382 // Send a request for conventional media transfer
383 void request_media(const std::vector<std::string> &file_requests);
384
386
387 void makeScreenshot();
388
389 inline void pushToChatQueue(ChatMessage *cec)
390 {
391 m_chat_queue.push(cec);
392 }
393
395 bool modsLoaded() const { return m_mods_loaded; }
396
397 void pushToEventQueue(ClientEvent *event);
398
399 // IP and port we're connected to
401
402 // Hostname of the connected server (but can also be a numerical IP)
403 const std::string &getAddressName() const
404 {
405 return m_address_name;
406 }
407
408 inline u64 getCSMRestrictionFlags() const
409 {
411 }
412
414 {
415 return m_csm_restriction_flags & flag;
416 }
417
418 bool joinModChannel(const std::string &channel) override;
419 bool leaveModChannel(const std::string &channel) override;
420 bool sendModChannelMessage(const std::string &channel,
421 const std::string &message) override;
422 ModChannel *getModChannel(const std::string &channel) override;
423
424 const std::string &getFormspecPrepend() const;
425
427 {
428 return m_mesh_grid;
429 }
430
432
433private:
434 void loadMods();
435
436 // Virtual methods from con::PeerHandler
437 void peerAdded(con::IPeer *peer) override;
438 void deletingPeer(con::IPeer *peer, bool timeout) override;
439
440 void initLocalMapSaving(const Address &address,
441 const std::string &hostname,
442 bool is_local_server);
443
444 void ReceiveAll();
445
446 void sendPlayerPos();
447
448 void deleteAuthData();
449 // helper method shared with clientpackethandler
450 static AuthMechanism choseAuthMech(const u32 mechs);
451
452 void sendInit(const std::string &playerName);
453 void startAuth(AuthMechanism chosen_auth_mechanism);
454 void sendDeletedBlocks(std::vector<v3s16> &blocks);
455 void sendGotBlocks(const std::vector<v3s16> &blocks);
456 void sendRemovedSounds(const std::vector<s32> &soundList);
457
458 bool canSendChatMessage() const;
459
462 float m_avg_rtt_timer = 0.0f;
465
473
474
475 std::unique_ptr<MeshUpdateManager> m_mesh_update_manager;
477 std::unique_ptr<ParticleManager> m_particle_manager;
478 std::unique_ptr<con::IConnection> m_con;
479 std::string m_address_name;
481 Camera *m_camera = nullptr;
482 Minimap *m_minimap = nullptr;
483
484 // Server serialization version
486
487 // Used version of the protocol with server
488 // Values smaller than 25 only mean they are smaller than 25,
489 // and aren't accurate. We simply just don't know, because
490 // the server didn't send the version back then.
491 // If 0, server init hasn't been received yet.
492 u16 m_proto_ver = 0;
493
498 // Block mesh animation parameters
499 float m_animation_time = 0.0f;
502 // 0 <= m_daynight_i < DAYNIGHT_CACHE_COUNT
503 //s32 m_daynight_i;
504 //u32 m_daynight_ratio;
505 std::queue<std::wstring> m_out_chat_queue;
508 std::queue<ChatMessage *> m_chat_queue;
509
510 // The authentication methods we can use to enter sudo mode (=change password)
512
513 // The seed returned by the server in TOCLIENT_INIT is stored here
514 u64 m_map_seed = 0;
515
516 // Auth data
517 std::string m_playername;
518 std::string m_password;
519 // If set, this will be sent (and cleared) upon a TOCLIENT_ACCEPT_SUDO_MODE
520 std::string m_new_password;
521 // Usable by auth mechanisms.
523 void *m_auth_data = nullptr;
524
525 bool m_access_denied = false;
527 std::string m_access_denied_reason = "";
528 std::queue<ClientEvent *> m_client_event_queue;
529 bool m_itemdef_received = false;
530 bool m_nodedef_received = false;
532 bool m_mods_loaded = false;
533
534 std::vector<std::string> m_remote_media_servers;
535 // Media downloader, only exists during init
537 // Pending downloads of dynamic media (key: token)
538 std::vector<std::pair<u32, std::shared_ptr<SingleMediaDownloader>>> m_pending_media_downloads;
539
540 // time_of_day speed approximation for old protocol
541 bool m_time_of_day_set = false;
542 float m_last_time_of_day_f = -1.0f;
544
545 // An interval for generally sending object positions and stuff
547
548 // Sounds
550 // Mapping from server sound ids to our sound ids
551 std::unordered_map<s32, sound_handle_t> m_sounds_server_to_client;
552 // And the other way!
553 // This takes ownership for the sound handles.
554 std::unordered_map<sound_handle_t, s32> m_sounds_client_to_server;
555 // Relation of client id to object id
556 std::unordered_map<sound_handle_t, u16> m_sounds_to_objects;
557
558 // Privileges
559 std::unordered_set<std::string> m_privileges;
560
561 // Detached inventories
562 // key = name
563 std::unordered_map<std::string, Inventory*> m_detached_inventories;
564
565 // Storage for mesh data for creating multiple instances of the same mesh
567
568 // own state
570
571 // Used for saving server map to disk client-side
575
576 // Client modding
580 std::vector<ModSpec> m_mods;
582
583 bool m_shutdown = false;
584
585 // CSM restrictions byteflag
588
589 std::unique_ptr<ModChannelMgr> m_modchannel_mgr;
590
591 // The number of blocks the client will combine for mesh generation.
593};
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:27
Definition client.h:104
void setFatalError(const std::string &reason)
Definition client.h:311
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:2044
ICraftDefManager * getCraftDefManager() override
Definition client.cpp:1982
void handleCommand_Privileges(NetworkPacket *pkt)
Definition clientpackethandler.cpp:908
bool activeObjectsReceived() const
Definition client.h:331
v3s16 getCrackPos()
Definition client.cpp:1646
void loadMods()
Definition client.cpp:165
void handleCommand_AuthAccept(NetworkPacket *pkt)
Definition clientpackethandler.cpp:131
MapDatabase * m_localdb
Definition client.h:572
void clearOutChatQueue()
Definition client.cpp:1335
void handleCommand_ModChannelMsg(NetworkPacket *pkt)
Definition clientpackethandler.cpp:1677
MtEventManager * getEventManager()
Definition client.cpp:2008
std::unique_ptr< ParticleManager > m_particle_manager
Definition client.h:477
void handleCommand_DetachedInventory(NetworkPacket *pkt)
Definition clientpackethandler.cpp:936
StringMap m_mesh_data
Definition client.h:566
bool loadMedia(const std::string &data, const std::string &filename, bool from_media_push=false)
Definition client.cpp:767
std::unordered_map< sound_handle_t, u16 > m_sounds_to_objects
Definition client.h:556
void handleCommand_AddNode(NetworkPacket *pkt)
Definition clientpackethandler.cpp:242
Minimap * m_minimap
Definition client.h:482
IItemDefManager * getItemDefManager() override
Definition client.cpp:1974
void sendHaveMedia(const std::vector< u32 > &tokens)
Definition client.cpp:1433
float m_connection_reinit_timer
Definition client.h:461
void connect(const Address &address, const std::string &address_name, bool is_local_server)
Definition client.cpp:370
float m_inventory_from_server_age
Definition client.h:496
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:2115
void interact(InteractAction action, const PointedThing &pointed)
Definition client.cpp:1068
ClientEnvironment & getEnv()
Definition client.h:242
void request_media(const std::vector< std::string > &file_requests)
Definition client.cpp:884
bool checkCSMRestrictionFlag(CSMRestrictionFlags flag) const
Definition client.h:413
void Stop()
Definition client.cpp:298
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:1480
void handleCommand_AnnounceMedia(NetworkPacket *pkt)
Definition clientpackethandler.cpp:650
ModStorageDatabase * getModStorageDatabase() override
Definition client.h:372
const ModSpec * getModSpec(const std::string &modname) const override
Definition client.cpp:293
u64 m_csm_restriction_flags
Definition client.h:586
scene::ISceneManager * getSceneManager()
Definition client.cpp:1571
std::queue< ClientEvent * > m_client_event_queue
Definition client.h:528
const Address getServerAddress()
Definition client.cpp:1774
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:1726
void handleCommand_ActiveObjectMessages(NetworkPacket *pkt)
Definition clientpackethandler.cpp:486
bool nodedefReceived() const
Definition client.h:327
void handleCommand_ItemDef(NetworkPacket *pkt)
Definition clientpackethandler.cpp:782
StringMap m_mod_vfs
Definition client.h:581
Camera * getCamera()
Definition client.h:355
IntervalLimiter m_map_timer_and_unload_interval
Definition client.h:464
float m_recommended_send_interval
Definition client.h:546
std::unordered_map< s32, sound_handle_t > m_sounds_server_to_client
Definition client.h:551
float m_avg_rtt_timer
Definition client.h:462
float m_mod_storage_save_timer
Definition client.h:579
static const std::string & getBuiltinLuaPath()
Definition client.cpp:275
void handleCommand_ChatMessage(NetworkPacket *pkt)
Definition clientpackethandler.cpp:403
IntervalLimiter m_localdb_save_interval
Definition client.h:573
MeshGrid getMeshGrid()
Definition client.h:426
void sendRemovedSounds(const std::vector< s32 > &soundList)
Definition client.cpp:1224
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:1738
NodeDefManager * m_nodedef
Definition client.h:469
void sendRespawnLegacy()
Definition client.cpp:1361
void sendUpdateClientInfo(const ClientDynamicInfo &info)
Definition client.cpp:1446
bool m_mods_loaded
Definition client.h:532
bool m_simple_singleplayer_mode
Definition client.h:337
void addNode(v3s16 p, MapNode n, bool remove_metadata=true)
Definition client.cpp:1517
void handleCommand_HudSetStars(NetworkPacket *pkt)
Definition clientpackethandler.cpp:1436
u32 m_sudo_auth_methods
Definition client.h:511
void handleCommand_Movement(NetworkPacket *pkt)
Definition clientpackethandler.cpp:516
std::vector< std::string > m_remote_media_servers
Definition client.h:534
void setCamera(Camera *camera)
Definition client.h:353
void handleCommand_HudSetMoon(NetworkPacket *pkt)
Definition clientpackethandler.cpp:1423
std::unordered_map< sound_handle_t, s32 > m_sounds_client_to_server
Definition client.h:554
float m_animation_time
Definition client.h:499
void pushToChatQueue(ChatMessage *cec)
Definition client.h:389
void setPlayerControl(PlayerControl &control)
Definition client.cpp:1535
LocalClientState m_state
Definition client.h:569
std::unique_ptr< con::IConnection > m_con
Definition client.h:478
std::vector< ModSpec > m_mods
Definition client.h:580
Camera * m_camera
Definition client.h:481
void handleCommand_LocalPlayerAnimations(NetworkPacket *pkt)
Definition clientpackethandler.cpp:1503
void sendInventoryFields(const std::string &formname, const StringMap &fields)
Definition client.cpp:1261
int m_crack_level
Definition client.h:500
IWritableShaderSource * m_shsrc
Definition client.h:467
std::unordered_map< std::string, Inventory * > m_detached_inventories
Definition client.h:563
void sendNodemetaFields(v3s16 p, const std::string &formname, const StringMap &fields)
Definition client.cpp:1239
void sendInit(const std::string &playerName)
Definition client.cpp:1139
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:1105
static AuthMechanism choseAuthMech(const u32 mechs)
Definition client.cpp:1125
bool hasClientEvents() const
Definition client.h:303
void pushToEventQueue(ClientEvent *event)
Definition client.cpp:1967
std::string m_access_denied_reason
Definition client.h:527
bool itemdefReceived() const
Definition client.h:325
std::string m_password
Definition client.h:518
void inventoryAction(InventoryAction *a) override
Definition client.cpp:1620
std::string m_new_password
Definition client.h:520
void handleCommand_HudChange(NetworkPacket *pkt)
Definition clientpackethandler.cpp:1206
Inventory * getInventory(const InventoryLocation &loc) override
Definition client.cpp:1576
const std::unordered_set< std::string > & getPrivilegeList() const
Definition client.h:290
void typeChatMessage(const std::wstring &message)
Definition client.cpp:1709
IWritableTextureSource * m_tsrc
Definition client.h:466
const std::set< std::string > & getConnectedPlayerNames()
Definition client.h:274
RenderingEngine * m_rendering_engine
Definition client.h:472
void Send(NetworkPacket *pkt)
Definition client.cpp:1024
float mediaReceiveProgress()
Definition client.cpp:1779
float m_removed_sounds_check_timer
Definition client.h:549
bool modsLoaded() const
Definition client.h:395
bool checkPrivilege(const std::string &priv) const
Definition client.h:287
void sendDamage(u16 damage)
Definition client.cpp:1354
void handleCommand_EyeOffset(NetworkPacket *pkt)
Definition clientpackethandler.cpp:1523
std::queue< std::wstring > m_out_chat_queue
Definition client.h:505
u32 m_csm_restriction_noderange
Definition client.h:587
void handleCommand_FormspecPrepend(NetworkPacket *pkt)
Definition clientpackethandler.cpp:1591
int CSMClampRadius(v3s16 pos, int radius)
Definition client.cpp:1492
ClientEvent * getClientEvent()
Definition client.cpp:1764
void makeScreenshot()
Definition client.cpp:1898
bool mediaReceived() const
Definition client.h:329
void handleCommand_MovePlayer(NetworkPacket *pkt)
Definition clientpackethandler.cpp:601
ISoundManager * m_sound
Definition client.h:470
void handleCommand_NodemetaChanged(NetworkPacket *pkt)
Definition clientpackethandler.cpp:262
std::string m_playername
Definition client.h:517
float m_last_time_of_day_f
Definition client.h:542
void sendDeletedBlocks(std::vector< v3s16 > &blocks)
Definition client.cpp:1201
IWritableItemDefManager * m_itemdef
Definition client.h:468
bool checkLocalPrivilege(const std::string &priv)
Definition client.h:368
virtual ISoundManager * getSoundManager()
Definition client.cpp:2004
void ProcessData(NetworkPacket *pkt)
Definition client.cpp:979
bool sendModChannelMessage(const std::string &channel, const std::string &message) override
Definition client.cpp:2091
u16 getProtoVersion() const
Definition client.h:334
void handleCommand_PlaySound(NetworkPacket *pkt)
Definition clientpackethandler.cpp:801
void startAuth(AuthMechanism chosen_auth_mechanism)
Definition client.cpp:1150
void handleCommand_Null(NetworkPacket *pkt)
Definition client.h:160
bool joinModChannel(const std::string &channel) override
Definition client.cpp:2065
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:246
~Client()
Definition client.cpp:320
void handleCommand_MovePlayerRel(NetworkPacket *pkt)
Definition clientpackethandler.cpp:632
void removeNode(v3s16 p)
Definition client.cpp:1458
u64 getCSMRestrictionFlags() const
Definition client.h:408
void initLocalMapSaving(const Address &address, const std::string &hostname, bool is_local_server)
Definition client.cpp:908
std::vector< std::pair< u32, std::shared_ptr< SingleMediaDownloader > > > m_pending_media_downloads
Definition client.h:538
u16 m_proto_ver
Definition client.h:492
bool canSendChatMessage() const
Definition client.cpp:1296
ISoundManager * sound()
Definition client.h:244
void handleCommand_InventoryFormSpec(NetworkPacket *pkt)
Definition clientpackethandler.cpp:927
bool m_activeobjects_received
Definition client.h:531
void sendChangePassword(const std::string &oldpassword, const std::string &newpassword)
Definition client.cpp:1340
u16 allocateUnknownNodeId(const std::string &name) override
Definition client.cpp:1996
void handleCommand_Deprecated(NetworkPacket *pkt)
Definition clientpackethandler.cpp:54
void sendReady()
Definition client.cpp:1367
u8 m_server_ser_ver
Definition client.h:485
void handleCommand_HudSetFlags(NetworkPacket *pkt)
Definition clientpackethandler.cpp:1260
void step(float dtime)
Definition client.cpp:395
bool accessDenied() const
Definition client.h:307
const std::vector< ModSpec > & getMods() const override
Definition client.cpp:287
ELoginRegister m_allow_login_or_register
Definition client.h:480
bool m_update_wielded_item
Definition client.h:494
float m_chat_message_allowance
Definition client.h:507
void sendPlayerPos()
Definition client.cpp:1380
void handleCommand_HudSetSun(NetworkPacket *pkt)
Definition clientpackethandler.cpp:1410
void * m_auth_data
Definition client.h:523
void setFatalError(const LuaError &e)
Definition client.h:316
PacketCounter m_packetcounter
Definition client.h:497
u64 getMapSeed()
Definition client.h:296
int getCrackLevel()
Definition client.cpp:1641
float m_time_of_day_update_timer
Definition client.h:543
u16 getHP()
Definition client.cpp:1671
void handleCommand_RemoveNode(NetworkPacket *pkt)
Definition clientpackethandler.cpp:232
void sendChatMessage(const std::wstring &message)
Definition client.cpp:1310
void handleCommand_Breath(NetworkPacket *pkt)
Definition clientpackethandler.cpp:589
MeshGrid m_mesh_grid
Definition client.h:592
std::unique_ptr< MeshUpdateManager > m_mesh_update_manager
Definition client.h:475
void handleCommand_BlockData(NetworkPacket *pkt)
Definition clientpackethandler.cpp:288
std::unique_ptr< ModChannelMgr > m_modchannel_mgr
Definition client.h:589
void afterContentReceived()
Definition client.cpp:1824
void handleCommand_HudRemove(NetworkPacket *pkt)
Definition clientpackethandler.cpp:1194
virtual IWritableShaderSource * getShaderSource()
Definition client.cpp:1991
float getCurRate()
Definition client.cpp:1891
void showUpdateProgressTexture(void *args, u32 progress, u32 max_progress)
Definition client.cpp:1800
void handleCommand_ActiveObjectRemoveAdd(NetworkPacket *pkt)
Definition clientpackethandler.cpp:439
bool m_shutdown
Definition client.h:583
bool isShutdown()
Definition client.cpp:315
void handleCommand_Inventory(NetworkPacket *pkt)
Definition clientpackethandler.cpp:335
void addUpdateMeshTaskForNode(v3s16 nodepos, bool ack_to_server=false, bool urgent=false)
Definition client.cpp:1743
ModStorageDatabase * m_mod_storage_database
Definition client.h:578
void handleCommand_OverrideDayNightRatio(NetworkPacket *pkt)
Definition clientpackethandler.cpp:1487
bool m_nodedef_received
Definition client.h:530
u64 m_map_seed
Definition client.h:514
Inventory * m_inventory_from_server
Definition client.h:495
void handleCommand_MinimapModes(NetworkPacket *pkt)
Definition clientpackethandler.cpp:1765
bool m_itemdef_received
Definition client.h:529
void setPlayerItem(u16 item)
Definition client.cpp:1542
LocalClientState getState()
Definition client.h:385
ClientMediaDownloader * m_media_downloader
Definition client.h:536
void migrateModStorage()
Definition client.cpp:138
float getRTT()
Definition client.cpp:1885
float m_playerpos_send_timer
Definition client.h:463
ModChannel * getModChannel(const std::string &channel) override
Definition client.cpp:2110
virtual scene::IAnimatedMesh * getMesh(const std::string &filename, bool cache=false)
Definition client.cpp:2018
bool m_access_denied
Definition client.h:525
bool inhibit_inventory_revert
Definition client.h:431
static const std::string & getClientModsLuaPath()
Definition client.cpp:281
Minimap * getMinimap()
Definition client.h:352
void handleCommand_AccessDenied(NetworkPacket *pkt)
Definition clientpackethandler.cpp:188
ITextureSource * getTextureSource()
Definition client.cpp:1987
void handleCommand_AddParticleSpawner(NetworkPacket *pkt)
Definition clientpackethandler.cpp:1000
const std::string & getAddressName() const
Definition client.h:403
void handleCommand_DeathScreenLegacy(NetworkPacket *pkt)
Definition clientpackethandler.cpp:643
u16 m_cache_save_interval
Definition client.h:574
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:863
bool leaveModChannel(const std::string &channel) override
Definition client.cpp:2078
bool hasServerReplied() const
Definition client.h:348
AuthMechanism m_chosen_auth_mech
Definition client.h:522
std::queue< ChatMessage * > m_chat_queue
Definition client.h:508
std::unordered_set< std::string > m_privileges
Definition client.h:559
void handleCommand_Fov(NetworkPacket *pkt)
Definition clientpackethandler.cpp:540
void peerAdded(con::IPeer *peer) override
Definition client.cpp:857
void sendGotBlocks(const std::vector< v3s16 > &blocks)
Definition client.cpp:1214
MtEventManager * m_event
Definition client.h:471
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:970
void handleCommand_TimeOfDay(NetworkPacket *pkt)
Definition clientpackethandler.cpp:355
void setCrack(int level, v3s16 pos)
Definition client.cpp:1651
bool m_access_denied_reconnect
Definition client.h:526
bool updateWieldedItem()
Definition client.cpp:1554
bool reconnectRequested() const
Definition client.h:309
const NodeDefManager * getNodeDefManager() override
Definition client.cpp:1978
ClientScripting * getScript()
Definition client.h:394
void handleCommand_AcceptSudoMode(NetworkPacket *pkt)
Definition clientpackethandler.cpp:165
v3s16 m_crack_pos
Definition client.h:501
DISABLE_CLASS_COPY(Client)
bool getChatMessage(std::wstring &message)
Definition client.cpp:1678
ITextureSource * tsrc()
Definition client.h:243
float m_packetcounter_timer
Definition client.h:460
std::string m_address_name
Definition client.h:479
void drawLoadScreen(const std::wstring &text, float dtime, int percent)
Definition client.cpp:1787
ClientEnvironment m_env
Definition client.h:476
void ReceiveAll()
Definition client.cpp:941
void sendInventoryAction(InventoryAction *a)
Definition client.cpp:1281
void handleCommand_SpawnParticle(NetworkPacket *pkt)
Definition clientpackethandler.cpp:985
const std::string & accessDeniedReason() const
Definition client.h:323
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:506
void handleCommand_Media(NetworkPacket *pkt)
Definition clientpackethandler.cpp:701
bool m_time_of_day_set
Definition client.h:541
virtual ParticleManager * getParticleManager()
Definition client.cpp:2013
float getAnimationTime()
Definition client.cpp:1636
v3s16 CSMClampPos(v3s16 pos)
Definition client.cpp:1504
void handleCommand_FadeSound(NetworkPacket *pkt)
Definition clientpackethandler.cpp:893
void handleCommand_StopSound(NetworkPacket *pkt)
Definition clientpackethandler.cpp:880
ClientScripting * m_script
Definition client.h:577
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:33
Definition mapblock_mesh.h:180
Definition database.h:23
Definition mesh_generator_thread.h:111
Definition minimap.h:118
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:530
Definition client.h:75
std::map< u16, u32 > m_packets
Definition client.h:98
void print(std::ostream &o) const
Definition client.cpp:71
void add(u16 command)
Definition client.h:79
PacketCounter()=default
u32 sum() const
Definition client.cpp:63
void clear()
Definition client.h:88
Class doing particle as well as their spawners handling.
Definition particles.h:209
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:68
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:37
Definition minimap.h:68
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