diff --git a/src/client/game.cpp b/src/client/game.cpp index e200a341d..a27bd8658 100644 --- a/src/client/game.cpp +++ b/src/client/game.cpp @@ -1023,6 +1023,7 @@ Game::~Game() delete draw_control; extendedResourceCleanup(); + setDisableTexturePacks(false); g_settings->deregisterChangedCallback("doubletap_jump", &settingChangedCallback, this); diff --git a/src/client/tile.cpp b/src/client/tile.cpp index d0b4ed9d4..c2c6a3aff 100644 --- a/src/client/tile.cpp +++ b/src/client/tile.cpp @@ -47,6 +47,7 @@ with this program; if not, write to the Free Software Foundation, Inc., A cache from texture name to texture path */ MutexedMap g_texturename_to_path_cache; +bool g_disable_texture_packs = false; /* Replaces the filename extension. @@ -2300,5 +2301,13 @@ video::ITexture *TextureSource::getShaderFlagsTexture(bool normalmap_present) std::vector getTextureDirs() { + if (g_disable_texture_packs) + return {}; return fs::GetRecursiveDirs(g_settings->get("texture_path")); } + + +void setDisableTexturePacks(const bool disable_texture_packs) +{ + g_disable_texture_packs = disable_texture_packs; +} diff --git a/src/client/tile.h b/src/client/tile.h index 50e7c26ae..171fb0fd4 100644 --- a/src/client/tile.h +++ b/src/client/tile.h @@ -322,3 +322,5 @@ struct TileSpec }; std::vector getTextureDirs(); + +void setDisableTexturePacks(const bool disable_texture_packs); diff --git a/src/defaultsettings.cpp b/src/defaultsettings.cpp index 4ae97cc5b..4dc61db38 100644 --- a/src/defaultsettings.cpp +++ b/src/defaultsettings.cpp @@ -382,6 +382,7 @@ void set_default_settings() // Server settings->setDefault("compat_player_model", "character.b3d,3d_armor_character.b3d,skinsdb_3d_armor_character_5.b3d"); settings->setDefault("compat_send_original_model", "true"); + settings->setDefault("disable_texture_packs", "false"); settings->setDefault("disable_escape_sequences", "false"); settings->setDefault("strip_color_codes", "false"); settings->setDefault("announce_mt", "true"); diff --git a/src/network/clientpackethandler.cpp b/src/network/clientpackethandler.cpp index 8dae63d91..fee04f7d3 100644 --- a/src/network/clientpackethandler.cpp +++ b/src/network/clientpackethandler.cpp @@ -34,6 +34,7 @@ with this program; if not, write to the Free Software Foundation, Inc., #include "util/strfnd.h" #include "client/clientevent.h" #include "client/sound.h" +#include "client/tile.h" #include "network/clientopcodes.h" #include "network/connection.h" #include "script/scripting_client.h" @@ -704,6 +705,7 @@ void Client::handleCommand_AnnounceMedia(NetworkPacket* pkt) m_media_downloader->addFile(name, sha1_raw); } + bool disable_texture_packs = false; try { std::string str; @@ -715,11 +717,16 @@ void Client::handleCommand_AnnounceMedia(NetworkPacket* pkt) if (!baseurl.empty()) m_media_downloader->addRemoteServer(baseurl); } + + if (pkt->getRemainingBytes() >= 1) + *pkt >> disable_texture_packs; } catch(SerializationError& e) { // not supported by server or turned off } + setDisableTexturePacks(disable_texture_packs); + m_media_downloader->step(this); } diff --git a/src/server.cpp b/src/server.cpp index 8977861b5..9a8f647d1 100644 --- a/src/server.cpp +++ b/src/server.cpp @@ -2724,6 +2724,9 @@ void Server::sendMediaAnnouncement(session_t peer_id, const std::string &lang_co } pkt << g_settings->get("remote_media"); + if (g_settings->getBool("disable_texture_packs")) + pkt << true; + Send(&pkt); verbosestream << "Server: Announcing files to id(" << peer_id