14#include <unordered_set>
27#error Do not include in server builds
30#define CLIENT_CHAT_MESSAGE_LIMIT_PER_10S 10.0f
94 void print(std::ostream &o)
const;
112 const char *playername,
113 const std::string &password,
130 void scanModSubfolder(
const std::string &mod_name,
const std::string &mod_path,
131 std::string mod_subpath);
145 void connect(
const Address &address,
const std::string &address_name,
146 bool is_local_server);
154 void step(
float dtime);
237 const std::string &newpassword);
250 const std::vector<ModSpec> &
getMods()
const override;
345 void drawLoadScreen(
const std::wstring &text,
float dtime,
int percent);
374 virtual scene::IAnimatedMesh*
getMesh(
const std::string &filename,
bool cache =
false);
375 const std::string*
getModFile(std::string filename);
383 bool loadMedia(
const std::string &data,
const std::string &filename,
384 bool from_media_push =
false);
387 void request_media(
const std::vector<std::string> &file_requests);
425 const std::string &message)
override;
445 const std::string &hostname,
446 bool is_local_server);
456 void sendInit(
const std::string &playerName);
482 std::unique_ptr<con::IConnection>
m_con;
virtual const char * what() const noexcept
Definition exceptions.h:17
Definition clientenvironment.h:54
const std::set< std::string > & getPlayerNames()
Definition clientenvironment.h:129
Definition scripting_client.h:23
void setFatalError(const std::string &reason)
Definition client.h:315
void handleCommand_NodeDef(NetworkPacket *pkt)
Definition clientpackethandler.cpp:762
void handleCommand_DeleteParticleSpawner(NetworkPacket *pkt)
Definition clientpackethandler.cpp:1128
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:907
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:130
MapDatabase * m_localdb
Definition client.h:578
void clearOutChatQueue()
Definition client.cpp:1323
void handleCommand_ModChannelMsg(NetworkPacket *pkt)
Definition clientpackethandler.cpp:1679
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:935
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:241
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:178
void handleCommand_PlayerSpeed(NetworkPacket *pkt)
Definition clientpackethandler.cpp:1606
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:649
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:559
void handleCommand_UpdatePlayerList(NetworkPacket *pkt)
Definition clientpackethandler.cpp:1533
void addUpdateMeshTask(v3s16 blockpos, bool ack_to_server=false, bool urgent=false)
Definition client.cpp:1714
void handleCommand_ActiveObjectMessages(NetworkPacket *pkt)
Definition clientpackethandler.cpp:485
bool nodedefReceived() const
Definition client.h:331
void handleCommand_ItemDef(NetworkPacket *pkt)
Definition clientpackethandler.cpp:781
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:402
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:1286
void handleCommand_HudSetSky(NetworkPacket *pkt)
Definition clientpackethandler.cpp:1308
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:1433
u32 m_sudo_auth_methods
Definition client.h:515
void handleCommand_Movement(NetworkPacket *pkt)
Definition clientpackethandler.cpp:515
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:1420
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:1500
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:60
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:1203
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:1520
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:1588
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:600
ISoundManager * m_sound
Definition client.h:474
void handleCommand_NodemetaChanged(NetworkPacket *pkt)
Definition clientpackethandler.cpp:261
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:800
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:1555
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:631
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:926
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:53
void sendReady()
Definition client.cpp:1355
u8 m_server_ser_ver
Definition client.h:489
void handleCommand_HudSetFlags(NetworkPacket *pkt)
Definition clientpackethandler.cpp:1257
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:1407
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:231
void sendChatMessage(const std::wstring &message)
Definition client.cpp:1298
void handleCommand_Breath(NetworkPacket *pkt)
Definition clientpackethandler.cpp:588
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:287
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:1191
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:438
bool m_shutdown
Definition client.h:589
bool isShutdown()
Definition client.cpp:316
void handleCommand_Inventory(NetworkPacket *pkt)
Definition clientpackethandler.cpp:334
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:1484
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:1767
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:187
ITextureSource * getTextureSource()
Definition client.cpp:1980
void handleCommand_AddParticleSpawner(NetworkPacket *pkt)
Definition clientpackethandler.cpp:999
const std::string & getAddressName() const
Definition client.h:407
void handleCommand_DeathScreenLegacy(NetworkPacket *pkt)
Definition clientpackethandler.cpp:642
u16 m_cache_save_interval
Definition client.h:580
void handleCommand_ModChannelSignal(NetworkPacket *pkt)
Definition clientpackethandler.cpp:1697
void handleCommand_CSMRestrictionFlags(NetworkPacket *pkt)
Definition clientpackethandler.cpp:1597
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:539
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:1794
void handleCommand_MediaPush(NetworkPacket *pkt)
Definition clientpackethandler.cpp:1617
void handleCommand(NetworkPacket *pkt)
Definition client.cpp:958
void handleCommand_TimeOfDay(NetworkPacket *pkt)
Definition clientpackethandler.cpp:354
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:164
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:984
const std::string & accessDeniedReason() const
Definition client.h:327
void handleCommand_HudAdd(NetworkPacket *pkt)
Definition clientpackethandler.cpp:1140
void handleCommand_ShowFormSpec(NetworkPacket *pkt)
Definition clientpackethandler.cpp:968
void handleCommand_CloudParams(NetworkPacket *pkt)
Definition clientpackethandler.cpp:1450
u32 m_last_chat_message_sent
Definition client.h:510
void handleCommand_Media(NetworkPacket *pkt)
Definition clientpackethandler.cpp:700
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:892
void handleCommand_StopSound(NetworkPacket *pkt)
Definition clientpackethandler.cpp:879
ClientScripting * m_script
Definition client.h:583
Definition craftdef.h:390
Definition texturesource.h:36
Definition texturesource.h:62
Definition inventorymanager.h:96
Definition inventory.h:314
Definition mapblock_mesh.h:165
Definition mesh_generator_thread.h:113
Definition modchannels.h:52
Definition modchannels.h:23
Definition networkpacket.h:14
This class is for getting the actual properties of nodes from their content ID.
Definition nodedef.h:541
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
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:197
Definition renderingengine.h:68
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 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
Describes a grid with given step, oirginating at (0,0,0)
Definition numeric.h:136
Definition mapblock_mesh.h:30
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