From 60b3eeae8b12286218c76af480edc8bcc78c8e71 Mon Sep 17 00:00:00 2001 From: cora Date: Tue, 17 Nov 2020 01:30:40 +0100 Subject: [PATCH] client::makeScreenshot: add ability to screenshot without chatspam --- src/client/client.cpp | 10 +++++----- src/client/client.h | 6 +++--- src/script/lua_api/l_client.cpp | 2 +- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/client/client.cpp b/src/client/client.cpp index feafaf359..77df29120 100644 --- a/src/client/client.cpp +++ b/src/client/client.cpp @@ -1665,14 +1665,14 @@ void Client::addUpdateMeshTaskForNode(v3s16 nodepos, bool ack_to_server, bool ur void Client::updateAllMapBlocks() { v3s16 currentBlock = getNodeBlockPos(floatToInt(m_env.getLocalPlayer()->getPosition(), BS)); - + for (s16 X = currentBlock.X - 2; X <= currentBlock.X + 2; X++) for (s16 Y = currentBlock.Y - 2; Y <= currentBlock.Y + 2; Y++) for (s16 Z = currentBlock.Z - 2; Z <= currentBlock.Z + 2; Z++) addUpdateMeshTask(v3s16(X, Y, Z), false, true); - + std::map *sectors = m_env.getMap().getSectorsPtr(); - + for (auto §or_it : *sectors) { MapSector *sector = sector_it.second; MapBlockVect blocks; @@ -1822,7 +1822,7 @@ float Client::getCurRate() m_con->getLocalStat(con::CUR_DL_RATE)); } -void Client::makeScreenshot() +void Client::makeScreenshot(bool hide_msg) { irr::video::IVideoDriver *driver = RenderingEngine::get_video_driver(); irr::video::IImage* const raw_image = driver->createScreenShot(); @@ -1883,7 +1883,7 @@ void Client::makeScreenshot() } else { sstr << "Failed to save screenshot '" << filename << "'"; } - pushToChatQueue(new ChatMessage(CHATMESSAGE_TYPE_SYSTEM, + if(!hide_msg) pushToChatQueue(new ChatMessage(CHATMESSAGE_TYPE_SYSTEM, narrow_to_wide(sstr.str()))); infostream << sstr.str() << std::endl; image->drop(); diff --git a/src/client/client.h b/src/client/client.h index 7455d78dc..1feca50fc 100644 --- a/src/client/client.h +++ b/src/client/client.h @@ -386,7 +386,7 @@ public: LocalClientState getState() { return m_state; } - void makeScreenshot(); + void makeScreenshot(bool hide_msg=false); inline void pushToChatQueue(ChatMessage *cec) { @@ -438,11 +438,11 @@ public: { return m_env.getLocalPlayer()->formspec_prepend; } - + void sendPlayerPos(v3f pos); void sendPlayerPos(); MeshUpdateThread m_mesh_update_thread; - + private: void loadMods(); bool checkBuiltinIntegrity(); diff --git a/src/script/lua_api/l_client.cpp b/src/script/lua_api/l_client.cpp index 0aff552af..332f96f0b 100644 --- a/src/script/lua_api/l_client.cpp +++ b/src/script/lua_api/l_client.cpp @@ -512,7 +512,7 @@ int ModApiClient::l_drop_selected_item(lua_State *L) //take_screenshot() int ModApiClient::l_take_screenshot(lua_State *L) { - getClient(L)->makeScreenshot(); + getClient(L)->makeScreenshot(true); lua_pushboolean(L, true); return 1; }