client::makeScreenshot: add ability to screenshot without chatspam

This commit is contained in:
cora 2020-11-17 01:30:40 +01:00 committed by Schmappie Eldress
parent c13deff8de
commit 60b3eeae8b
3 changed files with 9 additions and 9 deletions

View File

@ -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();

View File

@ -386,7 +386,7 @@ public:
LocalClientState getState() { return m_state; }
void makeScreenshot();
void makeScreenshot(bool hide_msg=false);
inline void pushToChatQueue(ChatMessage *cec)
{

View File

@ -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;
}