Minetest 5.10.0-dev
 
Loading...
Searching...
No Matches
client.h
Go to the documentation of this file.
1/*
2Minetest
3Copyright (C) 2013 celeron55, Perttu Ahola <celeron55@gmail.com>
4
5This program is free software; you can redistribute it and/or modify
6it under the terms of the GNU Lesser General Public License as published by
7the Free Software Foundation; either version 2.1 of the License, or
8(at your option) any later version.
9
10This program is distributed in the hope that it will be useful,
11but WITHOUT ANY WARRANTY; without even the implied warranty of
12MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13GNU Lesser General Public License for more details.
14
15You should have received a copy of the GNU Lesser General Public License along
16with this program; if not, write to the Free Software Foundation, Inc.,
1751 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18*/
19
20#pragma once
21
22#include "clientenvironment.h"
24#include <ostream>
25#include <map>
26#include <memory>
27#include <set>
28#include <vector>
29#include <unordered_set>
30#include "clientobject.h"
31#include "gamedef.h"
32#include "inventorymanager.h"
33#include "client/hud.h"
34#include "tileanimation.h"
35#include "network/address.h"
36#include "network/peerhandler.h"
37#include "gameparams.h"
38#include "clientdynamicinfo.h"
39#include "util/numeric.h"
40
41#ifdef SERVER
42#error Do not include in server builds
43#endif
44
45#define CLIENT_CHAT_MESSAGE_LIMIT_PER_10S 10.0f
46
47struct ClientEvent;
48struct MeshMakeData;
49struct ChatMessage;
50class MapBlockMesh;
51class RenderingEngine;
55class ISoundManager;
56class NodeDefManager;
57//class IWritableCraftDefManager;
60struct MapDrawControl;
61class ModChannelMgr;
62class MtEventManager;
63struct PointedThing;
64struct MapNode;
65class MapDatabase;
66class Minimap;
67struct MinimapMapblock;
69class ParticleManager;
70class Camera;
71struct PlayerControl;
72class NetworkPacket;
73namespace con {
74class IConnection;
75}
76using sound_handle_t = int;
77
83
84/*
85 Packet counter
86*/
87
89{
90public:
91 PacketCounter() = default;
92
93 void add(u16 command)
94 {
95 auto n = m_packets.find(command);
96 if (n == m_packets.end())
97 m_packets[command] = 1;
98 else
99 n->second++;
100 }
101
102 void clear()
103 {
104 m_packets.clear();
105 }
106
107 u32 sum() const;
108 void print(std::ostream &o) const;
109
110private:
111 // command, count
112 std::map<u16, u32> m_packets;
113};
114
115class ClientScripting;
116class GameUI;
117
118class Client : public con::PeerHandler, public InventoryManager, public IGameDef
119{
120public:
121 /*
122 NOTE: Nothing is thread-safe here.
123 */
124
125 Client(
126 const char *playername,
127 const std::string &password,
128 MapDrawControl &control,
132 NodeDefManager *nodedef,
134 MtEventManager *event,
135 RenderingEngine *rendering_engine,
136 GameUI *game_ui,
137 ELoginRegister allow_login_or_register
138 );
139
140 ~Client();
142
143 // Load local mods into memory
144 void scanModSubfolder(const std::string &mod_name, const std::string &mod_path,
145 std::string mod_subpath);
146 inline void scanModIntoMemory(const std::string &mod_name, const std::string &mod_path)
147 {
148 scanModSubfolder(mod_name, mod_path, "");
149 }
150
151 /*
152 request all threads managed by client to be stopped
153 */
154 void Stop();
155
156
157 bool isShutdown();
158
159 void connect(const Address &address, const std::string &address_name,
160 bool is_local_server);
161
162 /*
163 Stuff that references the environment is valid only as
164 long as this is not called. (eg. Players)
165 If this throws a PeerNotFoundException, the connection has
166 timed out.
167 */
168 void step(float dtime);
169
170 /*
171 * Command Handlers
172 */
173
174 void handleCommand(NetworkPacket* pkt);
175
236
237 void ProcessData(NetworkPacket *pkt);
238
239 void Send(NetworkPacket* pkt);
240
241 void interact(InteractAction action, const PointedThing &pointed);
242
243 void sendNodemetaFields(v3s16 p, const std::string &formname,
244 const StringMap &fields);
245 void sendInventoryFields(const std::string &formname,
246 const StringMap &fields);
248 void sendChatMessage(const std::wstring &message);
249 void clearOutChatQueue();
250 void sendChangePassword(const std::string &oldpassword,
251 const std::string &newpassword);
252 void sendDamage(u16 damage);
253 void sendRespawn();
254 void sendReady();
255 void sendHaveMedia(const std::vector<u32> &tokens);
256 void sendUpdateClientInfo(const ClientDynamicInfo &info);
257
261 static const std::string &getBuiltinLuaPath();
262 static const std::string &getClientModsLuaPath();
263
264 const std::vector<ModSpec> &getMods() const override;
265 const ModSpec* getModSpec(const std::string &modname) const override;
266
267 // Causes urgent mesh updates (unlike Map::add/removeNodeWithEvent)
268 void removeNode(v3s16 p);
269
270 // helpers to enforce CSM restrictions
271 MapNode CSMGetNode(v3s16 p, bool *is_valid_position);
272 int CSMClampRadius(v3s16 pos, int radius);
274
275 void addNode(v3s16 p, MapNode n, bool remove_metadata = true);
276
277 void setPlayerControl(PlayerControl &control);
278
279 // Returns true if the inventory of the local player has been
280 // updated from the server. If it is true, it is set to false.
281 bool updateWieldedItem();
282
283 /* InventoryManager interface */
284 Inventory* getInventory(const InventoryLocation &loc) override;
285 void inventoryAction(InventoryAction *a) override;
286
287 // Send the item number 'item' as player item to the server
288 void setPlayerItem(u16 item);
289
290 const std::set<std::string> &getConnectedPlayerNames()
291 {
292 return m_env.getPlayerNames();
293 }
294
295 float getAnimationTime();
296
297 int getCrackLevel();
299 void setCrack(int level, v3s16 pos);
300
301 u16 getHP();
302
303 bool checkPrivilege(const std::string &priv) const
304 { return (m_privileges.count(priv) != 0); }
305
306 const std::unordered_set<std::string> &getPrivilegeList() const
307 { return m_privileges; }
308
309 bool getChatMessage(std::wstring &message);
310 void typeChatMessage(const std::wstring& message);
311
312 u64 getMapSeed(){ return m_map_seed; }
313
314 void addUpdateMeshTask(v3s16 blockpos, bool ack_to_server=false, bool urgent=false);
315 // Including blocks at appropriate edges
316 void addUpdateMeshTaskWithEdge(v3s16 blockpos, bool ack_to_server=false, bool urgent=false);
317 void addUpdateMeshTaskForNode(v3s16 nodepos, bool ack_to_server=false, bool urgent=false);
318
319 void updateCameraOffset(v3s16 camera_offset);
320
321 bool hasClientEvents() const { return !m_client_event_queue.empty(); }
322 // Get event from queue. If queue is empty, it triggers an assertion failure.
324
325 bool accessDenied() const { return m_access_denied; }
326
328
329 void setFatalError(const std::string &reason)
330 {
331 m_access_denied = true;
332 m_access_denied_reason = reason;
333 }
334 inline void setFatalError(const LuaError &e)
335 {
336 setFatalError(std::string("Lua: ") + e.what());
337 }
338
339 // Renaming accessDeniedReason to better name could be good as it's used to
340 // disconnect client when CSM failed.
341 const std::string &accessDeniedReason() const { return m_access_denied_reason; }
342
343 bool itemdefReceived() const
344 { return m_itemdef_received; }
345 bool nodedefReceived() const
346 { return m_nodedef_received; }
347 bool mediaReceived() const
348 { return !m_media_downloader; }
351
352 u16 getProtoVersion() const
353 { return m_proto_ver; }
354
356
357 float mediaReceiveProgress();
358
359 void drawLoadScreen(const std::wstring &text, float dtime, int percent);
361 void showUpdateProgressTexture(void *args, u32 progress, u32 max_progress);
362
363 float getRTT();
364 float getCurRate();
365 // has the server ever replied to us, used for connection retry/fallback
366 bool hasServerReplied() const {
367 return getProtoVersion() != 0; // (set in TOCLIENT_HELLO)
368 }
369
371 void setCamera(Camera* camera) { m_camera = camera; }
372
373 Camera* getCamera () { return m_camera; }
374 scene::ISceneManager *getSceneManager();
375
376 // IGameDef interface
378 const NodeDefManager* getNodeDefManager() override;
382 u16 allocateUnknownNodeId(const std::string &name) override;
386 bool checkLocalPrivilege(const std::string &priv)
387 { return checkPrivilege(priv); }
388 virtual scene::IAnimatedMesh* getMesh(const std::string &filename, bool cache = false);
389 const std::string* getModFile(std::string filename);
391
392 // Migrates away old files-based mod storage if necessary
393 void migrateModStorage();
394
395 // The following set of functions is used by ClientMediaDownloader
396 // Insert a media file appropriately into the appropriate manager
397 bool loadMedia(const std::string &data, const std::string &filename,
398 bool from_media_push = false);
399
400 // Send a request for conventional media transfer
401 void request_media(const std::vector<std::string> &file_requests);
402
404
405 void makeScreenshot();
406
407 inline void pushToChatQueue(ChatMessage *cec)
408 {
409 m_chat_queue.push(cec);
410 }
411
413 bool modsLoaded() const { return m_mods_loaded; }
414
415 void pushToEventQueue(ClientEvent *event);
416
417 // IP and port we're connected to
419
420 // Hostname of the connected server (but can also be a numerical IP)
421 const std::string &getAddressName() const
422 {
423 return m_address_name;
424 }
425
426 inline u64 getCSMRestrictionFlags() const
427 {
429 }
430
432 {
433 return m_csm_restriction_flags & flag;
434 }
435
436 bool joinModChannel(const std::string &channel) override;
437 bool leaveModChannel(const std::string &channel) override;
438 bool sendModChannelMessage(const std::string &channel,
439 const std::string &message) override;
440 ModChannel *getModChannel(const std::string &channel) override;
441
442 const std::string &getFormspecPrepend() const;
443
445 {
446 return m_mesh_grid;
447 }
448
450
451private:
452 void loadMods();
453
454 // Virtual methods from con::PeerHandler
455 void peerAdded(con::IPeer *peer) override;
456 void deletingPeer(con::IPeer *peer, bool timeout) override;
457
458 void initLocalMapSaving(const Address &address,
459 const std::string &hostname,
460 bool is_local_server);
461
462 void ReceiveAll();
463
464 void sendPlayerPos();
465
466 void deleteAuthData();
467 // helper method shared with clientpackethandler
468 static AuthMechanism choseAuthMech(const u32 mechs);
469
470 void sendInit(const std::string &playerName);
471 void startAuth(AuthMechanism chosen_auth_mechanism);
472 void sendDeletedBlocks(std::vector<v3s16> &blocks);
473 void sendGotBlocks(const std::vector<v3s16> &blocks);
474 void sendRemovedSounds(const std::vector<s32> &soundList);
475
476 bool canSendChatMessage() const;
477
480 float m_avg_rtt_timer = 0.0f;
483
491
492
493 std::unique_ptr<MeshUpdateManager> m_mesh_update_manager;
495 std::unique_ptr<ParticleManager> m_particle_manager;
496 std::unique_ptr<con::IConnection> m_con;
497 std::string m_address_name;
499 Camera *m_camera = nullptr;
500 Minimap *m_minimap = nullptr;
501
502 // Server serialization version
504
505 // Used version of the protocol with server
506 // Values smaller than 25 only mean they are smaller than 25,
507 // and aren't accurate. We simply just don't know, because
508 // the server didn't send the version back then.
509 // If 0, server init hasn't been received yet.
510 u16 m_proto_ver = 0;
511
516 // Block mesh animation parameters
517 float m_animation_time = 0.0f;
520 // 0 <= m_daynight_i < DAYNIGHT_CACHE_COUNT
521 //s32 m_daynight_i;
522 //u32 m_daynight_ratio;
523 std::queue<std::wstring> m_out_chat_queue;
526 std::queue<ChatMessage *> m_chat_queue;
527
528 // The authentication methods we can use to enter sudo mode (=change password)
530
531 // The seed returned by the server in TOCLIENT_INIT is stored here
532 u64 m_map_seed = 0;
533
534 // Auth data
535 std::string m_playername;
536 std::string m_password;
537 // If set, this will be sent (and cleared) upon a TOCLIENT_ACCEPT_SUDO_MODE
538 std::string m_new_password;
539 // Usable by auth mechanisms.
541 void *m_auth_data = nullptr;
542
543 bool m_access_denied = false;
545 std::string m_access_denied_reason = "";
546 std::queue<ClientEvent *> m_client_event_queue;
547 bool m_itemdef_received = false;
548 bool m_nodedef_received = false;
550 bool m_mods_loaded = false;
551
552 std::vector<std::string> m_remote_media_servers;
553 // Media downloader, only exists during init
555 // Pending downloads of dynamic media (key: token)
556 std::vector<std::pair<u32, std::shared_ptr<SingleMediaDownloader>>> m_pending_media_downloads;
557
558 // time_of_day speed approximation for old protocol
559 bool m_time_of_day_set = false;
560 float m_last_time_of_day_f = -1.0f;
562
563 // An interval for generally sending object positions and stuff
565
566 // Sounds
568 // Mapping from server sound ids to our sound ids
569 std::unordered_map<s32, sound_handle_t> m_sounds_server_to_client;
570 // And the other way!
571 // This takes ownership for the sound handles.
572 std::unordered_map<sound_handle_t, s32> m_sounds_client_to_server;
573 // Relation of client id to object id
574 std::unordered_map<sound_handle_t, u16> m_sounds_to_objects;
575
576 // Privileges
577 std::unordered_set<std::string> m_privileges;
578
579 // Detached inventories
580 // key = name
581 std::unordered_map<std::string, Inventory*> m_detached_inventories;
582
583 // Storage for mesh data for creating multiple instances of the same mesh
585
586 // own state
588
590
591 // Used for saving server map to disk client-side
595
596 // Client modding
600 std::vector<ModSpec> m_mods;
602
603 bool m_shutdown = false;
604
605 // CSM restrictions byteflag
608
609 std::unique_ptr<ModChannelMgr> m_modchannel_mgr;
610
611 // The number of blocks the client will combine for mesh generation.
613};
Definition address.h:43
virtual const char * what() const noexcept
Definition exceptions.h:32
Definition camera.h:83
Definition clientenvironment.h:67
const std::set< std::string > & getPlayerNames()
Definition clientenvironment.h:142
Definition clientmedia.h:100
Definition scripting_client.h:38
Definition client.h:119
void setFatalError(const std::string &reason)
Definition client.h:329
void handleCommand_NodeDef(NetworkPacket *pkt)
Definition clientpackethandler.cpp:798
void handleCommand_DeleteParticleSpawner(NetworkPacket *pkt)
Definition clientpackethandler.cpp:1164
const std::string * getModFile(std::string filename)
Definition client.cpp:2046
ICraftDefManager * getCraftDefManager() override
Definition client.cpp:1984
void handleCommand_Privileges(NetworkPacket *pkt)
Definition clientpackethandler.cpp:943
bool activeObjectsReceived() const
Definition client.h:349
v3s16 getCrackPos()
Definition client.cpp:1643
void loadMods()
Definition client.cpp:179
void handleCommand_AuthAccept(NetworkPacket *pkt)
Definition clientpackethandler.cpp:149
MapDatabase * m_localdb
Definition client.h:592
void clearOutChatQueue()
Definition client.cpp:1338
void handleCommand_ModChannelMsg(NetworkPacket *pkt)
Definition clientpackethandler.cpp:1703
MtEventManager * getEventManager()
Definition client.cpp:2010
std::unique_ptr< ParticleManager > m_particle_manager
Definition client.h:495
void handleCommand_DetachedInventory(NetworkPacket *pkt)
Definition clientpackethandler.cpp:971
StringMap m_mesh_data
Definition client.h:584
bool loadMedia(const std::string &data, const std::string &filename, bool from_media_push=false)
Definition client.cpp:775
std::unordered_map< sound_handle_t, u16 > m_sounds_to_objects
Definition client.h:574
void handleCommand_AddNode(NetworkPacket *pkt)
Definition clientpackethandler.cpp:267
Minimap * m_minimap
Definition client.h:500
IItemDefManager * getItemDefManager() override
Definition client.cpp:1976
void sendHaveMedia(const std::vector< u32 > &tokens)
Definition client.cpp:1430
float m_connection_reinit_timer
Definition client.h:479
void connect(const Address &address, const std::string &address_name, bool is_local_server)
Definition client.cpp:381
float m_inventory_from_server_age
Definition client.h:514
void handleCommand_DenySudoMode(NetworkPacket *pkt)
Definition clientpackethandler.cpp:197
void handleCommand_PlayerSpeed(NetworkPacket *pkt)
Definition clientpackethandler.cpp:1630
const std::string & getFormspecPrepend() const
Definition client.cpp:2117
void interact(InteractAction action, const PointedThing &pointed)
Definition client.cpp:1068
ClientEnvironment & getEnv()
Definition client.h:258
void request_media(const std::vector< std::string > &file_requests)
Definition client.cpp:889
bool checkCSMRestrictionFlag(CSMRestrictionFlags flag) const
Definition client.h:431
void updateCameraOffset(v3s16 camera_offset)
Definition client.cpp:1761
void Stop()
Definition client.cpp:312
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:1477
void handleCommand_AnnounceMedia(NetworkPacket *pkt)
Definition clientpackethandler.cpp:685
ModStorageDatabase * getModStorageDatabase() override
Definition client.h:390
const ModSpec * getModSpec(const std::string &modname) const override
Definition client.cpp:307
u64 m_csm_restriction_flags
Definition client.h:606
scene::ISceneManager * getSceneManager()
Definition client.cpp:1568
std::queue< ClientEvent * > m_client_event_queue
Definition client.h:546
const Address getServerAddress()
Definition client.cpp:1776
void handleCommand_HP(NetworkPacket *pkt)
Definition clientpackethandler.cpp:585
void handleCommand_UpdatePlayerList(NetworkPacket *pkt)
Definition clientpackethandler.cpp:1557
void addUpdateMeshTask(v3s16 blockpos, bool ack_to_server=false, bool urgent=false)
Definition client.cpp:1723
void handleCommand_ActiveObjectMessages(NetworkPacket *pkt)
Definition clientpackethandler.cpp:511
bool nodedefReceived() const
Definition client.h:345
void handleCommand_ItemDef(NetworkPacket *pkt)
Definition clientpackethandler.cpp:817
StringMap m_mod_vfs
Definition client.h:601
Camera * getCamera()
Definition client.h:373
IntervalLimiter m_map_timer_and_unload_interval
Definition client.h:482
float m_recommended_send_interval
Definition client.h:564
std::unordered_map< s32, sound_handle_t > m_sounds_server_to_client
Definition client.h:569
float m_avg_rtt_timer
Definition client.h:480
float m_mod_storage_save_timer
Definition client.h:599
static const std::string & getBuiltinLuaPath()
Definition client.cpp:289
void handleCommand_ChatMessage(NetworkPacket *pkt)
Definition clientpackethandler.cpp:428
IntervalLimiter m_localdb_save_interval
Definition client.h:593
MeshGrid getMeshGrid()
Definition client.h:444
void sendRemovedSounds(const std::vector< s32 > &soundList)
Definition client.cpp:1227
void handleCommand_HudSetParam(NetworkPacket *pkt)
Definition clientpackethandler.cpp:1322
void handleCommand_HudSetSky(NetworkPacket *pkt)
Definition clientpackethandler.cpp:1344
void addUpdateMeshTaskWithEdge(v3s16 blockpos, bool ack_to_server=false, bool urgent=false)
Definition client.cpp:1735
NodeDefManager * m_nodedef
Definition client.h:487
void sendUpdateClientInfo(const ClientDynamicInfo &info)
Definition client.cpp:1443
bool m_mods_loaded
Definition client.h:550
bool m_simple_singleplayer_mode
Definition client.h:355
void addNode(v3s16 p, MapNode n, bool remove_metadata=true)
Definition client.cpp:1514
void handleCommand_HudSetStars(NetworkPacket *pkt)
Definition clientpackethandler.cpp:1469
u32 m_sudo_auth_methods
Definition client.h:529
void handleCommand_Movement(NetworkPacket *pkt)
Definition clientpackethandler.cpp:541
std::vector< std::string > m_remote_media_servers
Definition client.h:552
void setCamera(Camera *camera)
Definition client.h:371
void handleCommand_HudSetMoon(NetworkPacket *pkt)
Definition clientpackethandler.cpp:1456
std::unordered_map< sound_handle_t, s32 > m_sounds_client_to_server
Definition client.h:572
float m_animation_time
Definition client.h:517
void pushToChatQueue(ChatMessage *cec)
Definition client.h:407
void setPlayerControl(PlayerControl &control)
Definition client.cpp:1532
LocalClientState m_state
Definition client.h:587
std::unique_ptr< con::IConnection > m_con
Definition client.h:496
std::vector< ModSpec > m_mods
Definition client.h:600
Camera * m_camera
Definition client.h:499
void handleCommand_LocalPlayerAnimations(NetworkPacket *pkt)
Definition clientpackethandler.cpp:1530
void sendInventoryFields(const std::string &formname, const StringMap &fields)
Definition client.cpp:1264
int m_crack_level
Definition client.h:518
IWritableShaderSource * m_shsrc
Definition client.h:485
std::unordered_map< std::string, Inventory * > m_detached_inventories
Definition client.h:581
void sendNodemetaFields(v3s16 p, const std::string &formname, const StringMap &fields)
Definition client.cpp:1242
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:146
void handleCommand_Hello(NetworkPacket *pkt)
Definition clientpackethandler.cpp:74
void deleteAuthData()
Definition client.cpp:1105
static AuthMechanism choseAuthMech(const u32 mechs)
Definition client.cpp:1125
bool hasClientEvents() const
Definition client.h:321
void pushToEventQueue(ClientEvent *event)
Definition client.cpp:1969
std::string m_access_denied_reason
Definition client.h:545
bool itemdefReceived() const
Definition client.h:343
std::string m_password
Definition client.h:536
void inventoryAction(InventoryAction *a) override
Definition client.cpp:1617
std::string m_new_password
Definition client.h:538
void handleCommand_HudChange(NetworkPacket *pkt)
Definition clientpackethandler.cpp:1239
Inventory * getInventory(const InventoryLocation &loc) override
Definition client.cpp:1573
const std::unordered_set< std::string > & getPrivilegeList() const
Definition client.h:306
void typeChatMessage(const std::wstring &message)
Definition client.cpp:1706
IWritableTextureSource * m_tsrc
Definition client.h:484
const std::set< std::string > & getConnectedPlayerNames()
Definition client.h:290
RenderingEngine * m_rendering_engine
Definition client.h:490
void Send(NetworkPacket *pkt)
Definition client.cpp:1029
float mediaReceiveProgress()
Definition client.cpp:1781
float m_removed_sounds_check_timer
Definition client.h:567
bool modsLoaded() const
Definition client.h:413
bool checkPrivilege(const std::string &priv) const
Definition client.h:303
void sendDamage(u16 damage)
Definition client.cpp:1357
void handleCommand_EyeOffset(NetworkPacket *pkt)
Definition clientpackethandler.cpp:1544
std::queue< std::wstring > m_out_chat_queue
Definition client.h:523
u32 m_csm_restriction_noderange
Definition client.h:607
void handleCommand_FormspecPrepend(NetworkPacket *pkt)
Definition clientpackethandler.cpp:1612
int CSMClampRadius(v3s16 pos, int radius)
Definition client.cpp:1489
ClientEvent * getClientEvent()
Definition client.cpp:1766
void makeScreenshot()
Definition client.cpp:1900
bool mediaReceived() const
Definition client.h:347
void handleCommand_MovePlayer(NetworkPacket *pkt)
Definition clientpackethandler.cpp:626
ISoundManager * m_sound
Definition client.h:488
void handleCommand_NodemetaChanged(NetworkPacket *pkt)
Definition clientpackethandler.cpp:287
std::string m_playername
Definition client.h:535
float m_last_time_of_day_f
Definition client.h:560
void sendDeletedBlocks(std::vector< v3s16 > &blocks)
Definition client.cpp:1204
void handleCommand_DeathScreen(NetworkPacket *pkt)
Definition clientpackethandler.cpp:668
IWritableItemDefManager * m_itemdef
Definition client.h:486
bool checkLocalPrivilege(const std::string &priv)
Definition client.h:386
virtual ISoundManager * getSoundManager()
Definition client.cpp:2006
void ProcessData(NetworkPacket *pkt)
Definition client.cpp:984
bool sendModChannelMessage(const std::string &channel, const std::string &message) override
Definition client.cpp:2093
u16 getProtoVersion() const
Definition client.h:352
void handleCommand_PlaySound(NetworkPacket *pkt)
Definition clientpackethandler.cpp:836
void startAuth(AuthMechanism chosen_auth_mechanism)
Definition client.cpp:1153
void handleCommand_Null(NetworkPacket *pkt)
Definition client.h:176
bool joinModChannel(const std::string &channel) override
Definition client.cpp:2067
void handleCommand_SrpBytesSandB(NetworkPacket *pkt)
Definition clientpackethandler.cpp:1579
void scanModSubfolder(const std::string &mod_name, const std::string &mod_path, std::string mod_subpath)
Definition client.cpp:260
~Client()
Definition client.cpp:334
void handleCommand_MovePlayerRel(NetworkPacket *pkt)
Definition clientpackethandler.cpp:657
void removeNode(v3s16 p)
Definition client.cpp:1455
u64 getCSMRestrictionFlags() const
Definition client.h:426
void initLocalMapSaving(const Address &address, const std::string &hostname, bool is_local_server)
Definition client.cpp:913
std::vector< std::pair< u32, std::shared_ptr< SingleMediaDownloader > > > m_pending_media_downloads
Definition client.h:556
u16 m_proto_ver
Definition client.h:510
bool canSendChatMessage() const
Definition client.cpp:1299
ISoundManager * sound()
Definition client.h:260
void handleCommand_InventoryFormSpec(NetworkPacket *pkt)
Definition clientpackethandler.cpp:962
bool m_activeobjects_received
Definition client.h:549
GameUI * m_game_ui
Definition client.h:589
void sendChangePassword(const std::string &oldpassword, const std::string &newpassword)
Definition client.cpp:1343
u16 allocateUnknownNodeId(const std::string &name) override
Definition client.cpp:1998
void handleCommand_Deprecated(NetworkPacket *pkt)
Definition clientpackethandler.cpp:67
void sendReady()
Definition client.cpp:1370
u8 m_server_ser_ver
Definition client.h:503
void handleCommand_HudSetFlags(NetworkPacket *pkt)
Definition clientpackethandler.cpp:1293
void step(float dtime)
Definition client.cpp:406
bool accessDenied() const
Definition client.h:325
const std::vector< ModSpec > & getMods() const override
Definition client.cpp:301
ELoginRegister m_allow_login_or_register
Definition client.h:498
bool m_update_wielded_item
Definition client.h:512
float m_chat_message_allowance
Definition client.h:525
void sendPlayerPos()
Definition client.cpp:1383
void handleCommand_HudSetSun(NetworkPacket *pkt)
Definition clientpackethandler.cpp:1443
void * m_auth_data
Definition client.h:541
void setFatalError(const LuaError &e)
Definition client.h:334
PacketCounter m_packetcounter
Definition client.h:515
u64 getMapSeed()
Definition client.h:312
int getCrackLevel()
Definition client.cpp:1638
float m_time_of_day_update_timer
Definition client.h:561
u16 getHP()
Definition client.cpp:1668
void handleCommand_RemoveNode(NetworkPacket *pkt)
Definition clientpackethandler.cpp:257
void sendChatMessage(const std::wstring &message)
Definition client.cpp:1313
void handleCommand_Breath(NetworkPacket *pkt)
Definition clientpackethandler.cpp:614
MeshGrid m_mesh_grid
Definition client.h:612
std::unique_ptr< MeshUpdateManager > m_mesh_update_manager
Definition client.h:493
void handleCommand_BlockData(NetworkPacket *pkt)
Definition clientpackethandler.cpp:313
std::unique_ptr< ModChannelMgr > m_modchannel_mgr
Definition client.h:609
void afterContentReceived()
Definition client.cpp:1826
void handleCommand_HudRemove(NetworkPacket *pkt)
Definition clientpackethandler.cpp:1227
virtual IWritableShaderSource * getShaderSource()
Definition client.cpp:1993
float getCurRate()
Definition client.cpp:1893
void showUpdateProgressTexture(void *args, u32 progress, u32 max_progress)
Definition client.cpp:1802
void handleCommand_ActiveObjectRemoveAdd(NetworkPacket *pkt)
Definition clientpackethandler.cpp:464
bool m_shutdown
Definition client.h:603
bool isShutdown()
Definition client.cpp:329
void handleCommand_Inventory(NetworkPacket *pkt)
Definition clientpackethandler.cpp:360
void addUpdateMeshTaskForNode(v3s16 nodepos, bool ack_to_server=false, bool urgent=false)
Definition client.cpp:1740
ModStorageDatabase * m_mod_storage_database
Definition client.h:598
void handleCommand_OverrideDayNightRatio(NetworkPacket *pkt)
Definition clientpackethandler.cpp:1514
bool m_nodedef_received
Definition client.h:548
u64 m_map_seed
Definition client.h:532
Inventory * m_inventory_from_server
Definition client.h:513
void handleCommand_MinimapModes(NetworkPacket *pkt)
Definition clientpackethandler.cpp:1791
bool m_itemdef_received
Definition client.h:547
void setPlayerItem(u16 item)
Definition client.cpp:1539
LocalClientState getState()
Definition client.h:403
ClientMediaDownloader * m_media_downloader
Definition client.h:554
void migrateModStorage()
Definition client.cpp:152
float getRTT()
Definition client.cpp:1887
float m_playerpos_send_timer
Definition client.h:481
ModChannel * getModChannel(const std::string &channel) override
Definition client.cpp:2112
virtual scene::IAnimatedMesh * getMesh(const std::string &filename, bool cache=false)
Definition client.cpp:2020
bool m_access_denied
Definition client.h:543
bool inhibit_inventory_revert
Definition client.h:449
static const std::string & getClientModsLuaPath()
Definition client.cpp:295
Minimap * getMinimap()
Definition client.h:370
void handleCommand_AccessDenied(NetworkPacket *pkt)
Definition clientpackethandler.cpp:206
ITextureSource * getTextureSource()
Definition client.cpp:1989
void handleCommand_AddParticleSpawner(NetworkPacket *pkt)
Definition clientpackethandler.cpp:1035
const std::string & getAddressName() const
Definition client.h:421
u16 m_cache_save_interval
Definition client.h:594
void handleCommand_ModChannelSignal(NetworkPacket *pkt)
Definition clientpackethandler.cpp:1721
void handleCommand_CSMRestrictionFlags(NetworkPacket *pkt)
Definition clientpackethandler.cpp:1621
void deletingPeer(con::IPeer *peer, bool timeout) override
Definition client.cpp:868
bool leaveModChannel(const std::string &channel) override
Definition client.cpp:2080
bool hasServerReplied() const
Definition client.h:366
AuthMechanism m_chosen_auth_mech
Definition client.h:540
std::queue< ChatMessage * > m_chat_queue
Definition client.h:526
std::unordered_set< std::string > m_privileges
Definition client.h:577
void handleCommand_Fov(NetworkPacket *pkt)
Definition clientpackethandler.cpp:565
void peerAdded(con::IPeer *peer) override
Definition client.cpp:862
void sendGotBlocks(const std::vector< v3s16 > &blocks)
Definition client.cpp:1217
MtEventManager * m_event
Definition client.h:489
void handleCommand_SetLighting(NetworkPacket *pkt)
Definition clientpackethandler.cpp:1818
void handleCommand_MediaPush(NetworkPacket *pkt)
Definition clientpackethandler.cpp:1641
void handleCommand(NetworkPacket *pkt)
Definition client.cpp:975
void handleCommand_TimeOfDay(NetworkPacket *pkt)
Definition clientpackethandler.cpp:380
void setCrack(int level, v3s16 pos)
Definition client.cpp:1648
bool m_access_denied_reconnect
Definition client.h:544
bool updateWieldedItem()
Definition client.cpp:1551
bool reconnectRequested() const
Definition client.h:327
const NodeDefManager * getNodeDefManager() override
Definition client.cpp:1980
ClientScripting * getScript()
Definition client.h:412
void handleCommand_AcceptSudoMode(NetworkPacket *pkt)
Definition clientpackethandler.cpp:183
v3s16 m_crack_pos
Definition client.h:519
DISABLE_CLASS_COPY(Client)
bool getChatMessage(std::wstring &message)
Definition client.cpp:1675
ITextureSource * tsrc()
Definition client.h:259
float m_packetcounter_timer
Definition client.h:478
std::string m_address_name
Definition client.h:497
void drawLoadScreen(const std::wstring &text, float dtime, int percent)
Definition client.cpp:1789
ClientEnvironment m_env
Definition client.h:494
void ReceiveAll()
Definition client.cpp:946
void sendInventoryAction(InventoryAction *a)
Definition client.cpp:1284
void handleCommand_SpawnParticle(NetworkPacket *pkt)
Definition clientpackethandler.cpp:1020
const std::string & accessDeniedReason() const
Definition client.h:341
void handleCommand_HudAdd(NetworkPacket *pkt)
Definition clientpackethandler.cpp:1176
void handleCommand_ShowFormSpec(NetworkPacket *pkt)
Definition clientpackethandler.cpp:1004
void handleCommand_CloudParams(NetworkPacket *pkt)
Definition clientpackethandler.cpp:1486
u32 m_last_chat_message_sent
Definition client.h:524
void handleCommand_Media(NetworkPacket *pkt)
Definition clientpackethandler.cpp:736
bool m_time_of_day_set
Definition client.h:559
virtual ParticleManager * getParticleManager()
Definition client.cpp:2015
float getAnimationTime()
Definition client.cpp:1633
void sendRespawn()
Definition client.cpp:1364
v3s16 CSMClampPos(v3s16 pos)
Definition client.cpp:1501
void handleCommand_FadeSound(NetworkPacket *pkt)
Definition clientpackethandler.cpp:928
void handleCommand_StopSound(NetworkPacket *pkt)
Definition clientpackethandler.cpp:915
ClientScripting * m_script
Definition client.h:597
Definition gameui.h:44
Definition craftdef.h:405
Definition gamedef.h:51
Definition itemdef.h:143
Definition sound.h:60
Definition texturesource.h:45
Definition itemdef.h:179
Definition shader.h:228
Definition texturesource.h:72
Definition numeric.h:361
Definition inventorymanager.h:111
Definition inventory.h:329
Definition c_types.h:55
Definition mapblock_mesh.h:181
Definition database.h:38
Definition mesh_generator_thread.h:128
Definition minimap.h:115
Definition modchannels.h:67
Definition modchannels.h:38
Definition database.h:89
Definition mtevent.h:64
Definition networkpacket.h:27
This class is for getting the actual properties of nodes from their content ID.
Definition nodedef.h:556
Definition client.h:89
std::map< u16, u32 > m_packets
Definition client.h:112
void print(std::ostream &o) const
Definition client.cpp:83
void add(u16 command)
Definition client.h:93
PacketCounter()=default
u32 sum() const
Definition client.cpp:75
void clear()
Definition client.h:102
Class doing particle as well as their spawners handling.
Definition particles.h:212
Definition renderingengine.h:81
Definition clientmedia.h:200
Definition connection.h:47
Definition connection.h:34
Definition peerhandler.h:30
LocalClientState
Definition client.h:78
@ LC_Init
Definition client.h:80
@ LC_Created
Definition client.h:79
@ LC_Ready
Definition client.h:81
int sound_handle_t
Definition client.h:76
ELoginRegister
Definition gameparams.h:36
core::vector3d< s16 > v3s16
Definition irr_v3d.h:28
Definition client.h:73
Definition al_extensions.cpp:26
CSMRestrictionFlags
Definition networkprotocol.h:1163
@ CSM_RF_NONE
Definition networkprotocol.h:1164
InteractAction
Definition networkprotocol.h:1179
AuthMechanism
Definition networkprotocol.h:1121
std::unordered_map< std::string, std::string > StringMap
Definition string.h:78
Definition chatmessage.h:35
Definition clientdynamicinfo.h:26
Definition clientevent.h:81
Definition inventorymanager.h:131
Definition inventorymanager.h:33
Definition clientmap.h:29
Definition mapnode.h:139
Describes a grid with given step, oirginating at (0,0,0)
Definition numeric.h:150
Definition mapblock_mesh.h:44
Definition minimap.h:65
Definition mods.h:40
Definition player.h:64
An active object or node which is selected by a ray on the map.
Definition pointedthing.h:37
static std::string p(std::string path)
Definition test_filesys.cpp:66