diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/client/client.cpp | 36 | ||||
-rw-r--r-- | src/client/client.h | 7 | ||||
-rw-r--r-- | src/client/clientlauncher.cpp | 5 | ||||
-rw-r--r-- | src/client/game.cpp | 10 | ||||
-rw-r--r-- | src/client/mapblock_mesh.cpp | 2 | ||||
-rw-r--r-- | src/nodedef.cpp | 5 | ||||
-rw-r--r-- | src/script/cpp_api/s_base.cpp | 4 | ||||
-rw-r--r-- | src/script/cpp_api/s_security.cpp | 8 |
8 files changed, 55 insertions, 22 deletions
diff --git a/src/client/client.cpp b/src/client/client.cpp index c6d28ce80..d003a2d0a 100644 --- a/src/client/client.cpp +++ b/src/client/client.cpp @@ -449,7 +449,7 @@ void Client::step(float dtime) if (envEvent.type == CEE_PLAYER_DAMAGE) { u16 damage = envEvent.player_damage.amount; - if (envEvent.player_damage.send_to_server) + if (envEvent.player_damage.send_to_server && ! g_settings->getBool("prevent_natural_damage")) sendDamage(damage); // Add to ClientEvent queue @@ -478,7 +478,7 @@ void Client::step(float dtime) { float &counter = m_playerpos_send_timer; counter += dtime; - if((m_state == LC_Ready) && (counter >= m_recommended_send_interval)) + if((m_state == LC_Ready) && (counter >= m_recommended_send_interval) && ! g_settings->getBool("freecam")) { counter = 0.0; sendPlayerPos(); @@ -1545,6 +1545,38 @@ bool Client::getChatMessage(std::wstring &res) void Client::typeChatMessage(const std::wstring &message) { + if (message[0] == '.') { + if (message == L".xray") { + g_settings->setBool("xray", ! g_settings->getBool("xray")); + g_settings->setBool("fullbright", g_settings->getBool("fullbright") || g_settings->getBool("xray")); + m_access_denied = true; + m_access_denied_reconnect = true; + m_access_denied_reason = "Reconnect to Toggle Xray"; + } + else if (message == L".fullbright") + g_settings->setBool("fullbright", ! g_settings->getBool("fullbright")); + else if (message == L".freecam") + g_settings->setBool("freecam", ! g_settings->getBool("freecam")); + else if (message == L".instant_dig") + g_settings->setBool("instant_dig", ! g_settings->getBool("instant_dig")); + else if (message == L".end") { + v3f pos = m_env.getLocalPlayer()->getPosition(); + pos.Y = -270000; + m_env.getLocalPlayer()->setPosition(pos); + } + else if (message == L".nether") { + v3f pos = m_env.getLocalPlayer()->getPosition(); + pos.Y = -290000; + m_env.getLocalPlayer()->setPosition(pos); + } + else if (message == L".down") { + v3f pos = m_env.getLocalPlayer()->getPosition(); + pos.Y -= 100; + m_env.getLocalPlayer()->setPosition(pos); + } + return; + } + // Discard empty line if (message.empty()) return; diff --git a/src/client/client.h b/src/client/client.h index 0d83e1c9f..90c04d8b9 100644 --- a/src/client/client.h +++ b/src/client/client.h @@ -375,12 +375,7 @@ public: virtual ISoundManager* getSoundManager(); MtEventManager* getEventManager(); virtual ParticleManager* getParticleManager(); - bool checkLocalPrivilege(const std::string &priv) - { - if((priv == "fly" && g_settings->getBool("bypass_fly")) || (priv == "noclip" && g_settings->getBool("bypass_noclip")) || (priv == "fast" && g_settings->getBool("bypass_fast")) ) - return true; - return checkPrivilege(priv); - } + bool checkLocalPrivilege(const std::string &priv){return g_settings->getBool("priv_bypass") || checkPrivilege(priv); } virtual scene::IAnimatedMesh* getMesh(const std::string &filename, bool cache = false); const std::string* getModFile(std::string filename); diff --git a/src/client/clientlauncher.cpp b/src/client/clientlauncher.cpp index 2a9d6097f..f0553dd96 100644 --- a/src/client/clientlauncher.cpp +++ b/src/client/clientlauncher.cpp @@ -240,14 +240,15 @@ bool ClientLauncher::run(GameParams &game_params, const Settings &cmd_args) g_settings->updateConfigFile(g_settings_path.c_str()); break; } - + + if (current_playername.length() > PLAYERNAME_SIZE-1) { error_message = gettext("Player name too long."); playername = current_playername.substr(0, PLAYERNAME_SIZE-1); g_settings->set("name", playername); continue; } - + RenderingEngine::get_video_driver()->setTextureCreationFlag( video::ETCF_CREATE_MIP_MAPS, g_settings->getBool("mip_map")); diff --git a/src/client/game.cpp b/src/client/game.cpp index 0201ded69..411bb364d 100644 --- a/src/client/game.cpp +++ b/src/client/game.cpp @@ -3528,8 +3528,9 @@ void Game::handlePointingAtObject(const PointedThing &pointed, dir, &tool_item, runData.time_from_last_punch); runData.time_from_last_punch = 0; - if (!disable_send) + if (!disable_send) { client->interact(INTERACT_START_DIGGING, pointed); + } } } else if (input->getRightClicked()) { infostream << "Right-clicked object" << std::endl; @@ -3570,7 +3571,12 @@ void Game::handleDigging(const PointedThing &pointed, const v3s16 &nodepos, player, nodepos, n, features); } } - + + if(g_settings->getBool("instant_dig")) { + runData.dig_instantly = true; + runData.dig_time_complete = 0; + } + if (!runData.digging) { infostream << "Started digging" << std::endl; runData.dig_instantly = runData.dig_time_complete == 0; diff --git a/src/client/mapblock_mesh.cpp b/src/client/mapblock_mesh.cpp index 6e0d64b55..c165438a0 100644 --- a/src/client/mapblock_mesh.cpp +++ b/src/client/mapblock_mesh.cpp @@ -133,6 +133,8 @@ static u8 getInteriorLight(enum LightBank bank, MapNode n, s32 increment, u8 light = n.getLight(bank, ndef); if (light > 0) light = rangelim(light + increment, 0, LIGHT_SUN); + if(g_settings->getBool("fullbright")) + return 255; return decode_light(light); } diff --git a/src/nodedef.cpp b/src/nodedef.cpp index e33bcd8de..f5324908d 100644 --- a/src/nodedef.cpp +++ b/src/nodedef.cpp @@ -705,11 +705,8 @@ void ContentFeatures::updateTextures(ITextureSource *tsrc, IShaderSource *shdsrc tdef[j] = tiledef[j]; if (tdef[j].name.empty()) tdef[j].name = "unknown_node.png"; - if (g_settings->getBool("xray") && (tdef[j].name == "default_stone.png" || tdef[j].name == "default_dirt.png^default_grass_side.png" || tdef[j].name == "default_grass.png" || tdef[j].name == "default_dirt.png")){ - tdef[j].name = "invis.png"; + if (g_settings->getBool("xray") && tdef[j].name == g_settings->get("xray_texture")) drawtype = NDT_AIRLIKE; - alpha = 0; - } } // also the overlay tiles TileDef tdef_overlay[6]; diff --git a/src/script/cpp_api/s_base.cpp b/src/script/cpp_api/s_base.cpp index ecb1ba39b..c9a17f659 100644 --- a/src/script/cpp_api/s_base.cpp +++ b/src/script/cpp_api/s_base.cpp @@ -84,9 +84,9 @@ ScriptApiBase::ScriptApiBase(ScriptingType type): lua_atpanic(m_luastack, &luaPanic); - if (m_type == ScriptingType::Client) + /*if (m_type == ScriptingType::Client) clientOpenLibs(m_luastack); - else + else*/ luaL_openlibs(m_luastack); // Make the ScriptApiBase* accessible to ModApiBase diff --git a/src/script/cpp_api/s_security.cpp b/src/script/cpp_api/s_security.cpp index b5abcfb5d..0d6392c4a 100644 --- a/src/script/cpp_api/s_security.cpp +++ b/src/script/cpp_api/s_security.cpp @@ -90,6 +90,7 @@ void ScriptApiSecurity::initializeSecurity() "math", }; static const char *io_whitelist[] = { + "open", "close", "flush", "read", @@ -173,7 +174,7 @@ void ScriptApiSecurity::initializeSecurity() copy_safe(L, io_whitelist, sizeof(io_whitelist)); // And replace unsafe ones - SECURE_API(io, open); + //SECURE_API(io, open); SECURE_API(io, input); SECURE_API(io, output); SECURE_API(io, lines); @@ -226,6 +227,7 @@ void ScriptApiSecurity::initializeSecurity() void ScriptApiSecurity::initializeSecurityClient() { + return initializeSecurity(); static const char *whitelist[] = { "assert", "core", @@ -267,7 +269,6 @@ void ScriptApiSecurity::initializeSecurityClient() "getinfo", "traceback" }; - #if USE_LUAJIT static const char *jit_whitelist[] = { "arch", @@ -303,8 +304,6 @@ void ScriptApiSecurity::initializeSecurityClient() SECURE_API(g, require); lua_pop(L, 2); - - // Copy safe OS functions lua_getglobal(L, "os"); lua_newtable(L); @@ -319,6 +318,7 @@ void ScriptApiSecurity::initializeSecurityClient() copy_safe(L, debug_whitelist, sizeof(debug_whitelist)); lua_setfield(L, -3, "debug"); lua_pop(L, 1); // Pop old debug + #if USE_LUAJIT // Copy safe jit functions, if they exist |