From c893958bb1a7b6ef08b15914e081ba3df5153693 Mon Sep 17 00:00:00 2001 From: MetaDucky Date: Sun, 26 May 2013 12:06:35 +0200 Subject: Fix some nullptr exceptions when handling invalid node inventories --- src/script/lua_api/l_inventory.cpp | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/src/script/lua_api/l_inventory.cpp b/src/script/lua_api/l_inventory.cpp index 1404c3c8a..f57a4e8cd 100644 --- a/src/script/lua_api/l_inventory.cpp +++ b/src/script/lua_api/l_inventory.cpp @@ -121,6 +121,9 @@ int InvRef::l_set_size(lua_State *L) const char *listname = luaL_checkstring(L, 2); int newsize = luaL_checknumber(L, 3); Inventory *inv = getinv(L, ref); + if(inv == NULL){ + return 0; + } if(newsize == 0){ inv->deleteList(listname); reportInventoryChange(L, ref); @@ -144,6 +147,9 @@ int InvRef::l_set_width(lua_State *L) const char *listname = luaL_checkstring(L, 2); int newwidth = luaL_checknumber(L, 3); Inventory *inv = getinv(L, ref); + if(inv == NULL){ + return 0; + } InventoryList *list = inv->getList(listname); if(list){ list->setWidth(newwidth); @@ -195,7 +201,11 @@ int InvRef::l_get_list(lua_State *L) InvRef *ref = checkobject(L, 1); const char *listname = luaL_checkstring(L, 2); Inventory *inv = getinv(L, ref); - push_inventory_list(inv, listname, L); + if(inv){ + push_inventory_list(inv, listname, L); + } else { + lua_pushnil(L); + } return 1; } @@ -206,6 +216,9 @@ int InvRef::l_set_list(lua_State *L) InvRef *ref = checkobject(L, 1); const char *listname = luaL_checkstring(L, 2); Inventory *inv = getinv(L, ref); + if(inv == NULL){ + return 0; + } InventoryList *list = inv->getList(listname); if(list) read_inventory_list(inv, listname, L, 3, -- cgit v1.2.3 From c25102a4f728124b31400ced51cab27eb2f9a5d1 Mon Sep 17 00:00:00 2001 From: sapier Date: Sun, 26 May 2013 18:23:22 +0200 Subject: Fix missing find_path and line_of_sight --- src/script/lua_api/l_env.cpp | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/src/script/lua_api/l_env.cpp b/src/script/lua_api/l_env.cpp index 58cf337ed..a287281a9 100644 --- a/src/script/lua_api/l_env.cpp +++ b/src/script/lua_api/l_env.cpp @@ -550,7 +550,7 @@ int ModApiEnvMod::l_line_of_sight(lua_State *L) { GET_ENV_PTR; // read position 1 from lua - v3f pos1 = checkFloatPos(L, 2); + v3f pos1 = checkFloatPos(L, 1); // read position 2 from lua v3f pos2 = checkFloatPos(L, 2); //read step size from lua @@ -566,14 +566,14 @@ int ModApiEnvMod::l_find_path(lua_State *L) { GET_ENV_PTR; - v3s16 pos1 = read_v3s16(L, 2); - v3s16 pos2 = read_v3s16(L, 3); - unsigned int searchdistance = luaL_checkint(L, 4); - unsigned int max_jump = luaL_checkint(L, 5); - unsigned int max_drop = luaL_checkint(L, 6); + v3s16 pos1 = read_v3s16(L, 1); + v3s16 pos2 = read_v3s16(L, 2); + unsigned int searchdistance = luaL_checkint(L, 3); + unsigned int max_jump = luaL_checkint(L, 4); + unsigned int max_drop = luaL_checkint(L, 5); algorithm algo = A_PLAIN_NP; - if(! lua_isnil(L, 7)) { - std::string algorithm = luaL_checkstring(L,7); + if(! lua_isnil(L, 6)) { + std::string algorithm = luaL_checkstring(L,6); if (algorithm == "A*") algo = A_PLAIN; @@ -680,6 +680,8 @@ bool ModApiEnvMod::Initialize(lua_State *L,int top) retval &= API_FCT(get_perlin_map); retval &= API_FCT(clear_objects); retval &= API_FCT(spawn_tree); + retval &= API_FCT(find_path); + retval &= API_FCT(line_of_sight); return retval; } -- cgit v1.2.3 From 6f9d3843112ea04dd159984af4470fa8456b18f0 Mon Sep 17 00:00:00 2001 From: Kahrl Date: Sun, 2 Jun 2013 17:38:53 +0200 Subject: Replace c55.me links --- doc/lua_api.txt | 3 ++- doc/minetest.6 | 2 +- doc/minetestserver.6 | 2 +- minetest.conf.example | 2 +- 4 files changed, 5 insertions(+), 4 deletions(-) diff --git a/doc/lua_api.txt b/doc/lua_api.txt index 5143c2ef3..6411aae32 100644 --- a/doc/lua_api.txt +++ b/doc/lua_api.txt @@ -1,6 +1,7 @@ Minetest Lua Modding API Reference 0.4.6 ======================================== -More information at http://c55.me/minetest/ +More information at http://www.minetest.net/ +Developer Wiki: http://dev.minetest.net/ Introduction ------------- diff --git a/doc/minetest.6 b/doc/minetest.6 index 64dfdd149..c690229df 100644 --- a/doc/minetest.6 +++ b/doc/minetest.6 @@ -88,7 +88,7 @@ This man page was originally written by Juhani Numminen . .SH WWW -http://c55.me/minetest/ +http://www.minetest.net/ .SH "SEE ALSO" .BR minetestserver(6) diff --git a/doc/minetestserver.6 b/doc/minetestserver.6 index 93c354e79..5a9b0a08b 100644 --- a/doc/minetestserver.6 +++ b/doc/minetestserver.6 @@ -64,7 +64,7 @@ This man page was originally written by Juhani Numminen . .SH WWW -http://c55.me/minetest/ +http://www.minetest.net/ .SH "SEE ALSO" .BR minetest(6) diff --git a/minetest.conf.example b/minetest.conf.example index 1f9780f40..af75438ff 100644 --- a/minetest.conf.example +++ b/minetest.conf.example @@ -8,7 +8,7 @@ # Uncomment settings by removing the preceding #. # # Further documentation: -# http://c55.me/minetest/wiki/doku.php +# http://wiki.minetest.com/ # # NOTE: This file might not be up-to-date, refer to the # defaultsettings.cpp file for an up-to-date list: -- cgit v1.2.3 From 64befefcfcf6f9631d361d1326c53c8968b88e59 Mon Sep 17 00:00:00 2001 From: bcnjr5 Date: Thu, 25 Apr 2013 09:56:40 -0400 Subject: Add Code::Blocks project and build files to .gitignore --- .gitignore | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.gitignore b/.gitignore index c8f21e504..db131c29f 100644 --- a/.gitignore +++ b/.gitignore @@ -59,4 +59,7 @@ CPackSourceConfig.cmake Makefile cmake_install.cmake locale/ +*.cbp +*.layout +*.o -- cgit v1.2.3 From 9fe74a34ead5b774d8d0bf95d4ec83f9b323c9c6 Mon Sep 17 00:00:00 2001 From: Kahrl Date: Sun, 2 Jun 2013 17:53:20 +0200 Subject: Call m_menumgr->deletingMenu from quitMenu in addition to destructor This fixes the bug where noMenuActive() keeps returning false after closing a menu until the mouse is moved, rendering the keyboard unusable (the_game calls input->clear() every frame when noMenuActive() is false). --- src/modalMenu.h | 1 + 1 file changed, 1 insertion(+) diff --git a/src/modalMenu.h b/src/modalMenu.h index d19b4e27c..62bfabc06 100644 --- a/src/modalMenu.h +++ b/src/modalMenu.h @@ -99,6 +99,7 @@ public: allowFocusRemoval(true); // This removes Environment's grab on us Environment->removeFocus(this); + m_menumgr->deletingMenu(this); this->remove(); } -- cgit v1.2.3 From b89c79e905fb6d8187c066652657c70ccb18b07d Mon Sep 17 00:00:00 2001 From: Kahrl Date: Mon, 3 Jun 2013 01:53:43 +0200 Subject: Delay deleting replaced textures (m_texture_trash) --- src/tile.cpp | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/src/tile.cpp b/src/tile.cpp index 5f25e123b..098a963a8 100644 --- a/src/tile.cpp +++ b/src/tile.cpp @@ -440,6 +440,10 @@ private: // Queued texture fetches (to be processed by the main thread) RequestQueue m_get_texture_queue; + + // Textures that have been overwritten with other ones + // but can't be deleted because the ITexture* might still be used + std::list m_texture_trash; }; IWritableTextureSource* createTextureSource(IrrlichtDevice *device) @@ -485,6 +489,16 @@ TextureSource::~TextureSource() } m_atlaspointer_cache.clear(); + for (std::list::iterator iter = + m_texture_trash.begin(); iter != m_texture_trash.end(); + iter++) + { + video::ITexture *t = *iter; + + //cleanup trashed texture + driver->removeTexture(t); + } + infostream << "~TextureSource() "<< textures_before << "/" << driver->getTextureCount() << std::endl; } @@ -870,7 +884,7 @@ void TextureSource::rebuildImagesAndTextures() sap->intsize = img->getDimension(); if (t_old != 0) - driver->removeTexture(t_old); + m_texture_trash.push_back(t_old); } } -- cgit v1.2.3 From e988df0fbdd9d568889a28640c189ae022e99f8e Mon Sep 17 00:00:00 2001 From: Kahrl Date: Sun, 2 Jun 2013 15:35:29 +0200 Subject: Add and implement setting max_clearobjects_extra_loaded_blocks. Now Environment::clearAllObjects() unloads unused blocks in an interval defined by max_clearobjects_extra_loaded_blocks (default 4096). --- minetest.conf.example | 4 ++++ src/defaultsettings.cpp | 1 + src/environment.cpp | 39 +++++++++++++++++++++++++++++++++++++++ src/map.cpp | 25 +++++++++++++++++++++++++ src/map.h | 8 +++++++- 5 files changed, 76 insertions(+), 1 deletion(-) diff --git a/minetest.conf.example b/minetest.conf.example index af75438ff..4fd443db7 100644 --- a/minetest.conf.example +++ b/minetest.conf.example @@ -254,6 +254,10 @@ #max_block_send_distance = 10 # From how far blocks are generated for clients (value * 16 nodes) #max_block_generate_distance = 6 +# Number of extra blocks that can be loaded by /clearobjects at once +# This is a trade-off between sqlite transaction overhead and +# memory consumption (4096=100MB, as a rule of thumb) +#max_clearobjects_extra_loaded_blocks = 4096 # Interval of sending time of day to clients #time_send_interval = 5 # Length of day/night cycle. 72=20min, 360=4min, 1=24hour, 0=day/night/whatever stays unchanged diff --git a/src/defaultsettings.cpp b/src/defaultsettings.cpp index f270a47aa..d2bed7ed8 100644 --- a/src/defaultsettings.cpp +++ b/src/defaultsettings.cpp @@ -175,6 +175,7 @@ void set_default_settings(Settings *settings) settings->setDefault("max_simultaneous_block_sends_server_total", "20"); settings->setDefault("max_block_send_distance", "9"); settings->setDefault("max_block_generate_distance", "7"); + settings->setDefault("max_clearobjects_extra_loaded_blocks", "4096"); settings->setDefault("time_send_interval", "5"); settings->setDefault("time_speed", "72"); settings->setDefault("server_unload_unused_data_timeout", "29"); diff --git a/src/environment.cpp b/src/environment.cpp index 83ae59014..ab6a6d3d3 100644 --- a/src/environment.cpp +++ b/src/environment.cpp @@ -945,6 +945,16 @@ void ServerEnvironment::clearAllObjects() m_active_objects.erase(*i); } + // Get list of loaded blocks + std::list loaded_blocks; + infostream<<"ServerEnvironment::clearAllObjects(): " + <<"Listing all loaded blocks"<listAllLoadedBlocks(loaded_blocks); + infostream<<"ServerEnvironment::clearAllObjects(): " + <<"Done listing all loaded blocks: " + < loadable_blocks; infostream<<"ServerEnvironment::clearAllObjects(): " <<"Listing all loadable blocks"<::iterator i = loaded_blocks.begin(); + i != loaded_blocks.end(); ++i) + { + v3s16 p = *i; + MapBlock *block = m_map->getBlockNoCreateNoEx(p); + assert(block); + block->refGrab(); + } + + // Remove objects in all loadable blocks + u32 unload_interval = g_settings->getS32("max_clearobjects_extra_loaded_blocks"); + unload_interval = MYMAX(unload_interval, 1); u32 report_interval = loadable_blocks.size() / 10; u32 num_blocks_checked = 0; u32 num_blocks_cleared = 0; @@ -987,7 +1011,22 @@ void ServerEnvironment::clearAllObjects() <<" in "<unloadUnreferencedBlocks(); + } } + m_map->unloadUnreferencedBlocks(); + + // Drop references that were added above + for(std::list::iterator i = loaded_blocks.begin(); + i != loaded_blocks.end(); ++i) + { + v3s16 p = *i; + MapBlock *block = m_map->getBlockNoCreateNoEx(p); + assert(block); + block->refDrop(); + } + infostream<<"ServerEnvironment::clearAllObjects(): " <<"Finished: Cleared "< *unloaded_blocks) +{ + timerUpdate(0.0, -1.0, unloaded_blocks); +} + void Map::deleteSectors(std::list &list) { for(std::list::iterator j = list.begin(); @@ -3409,6 +3414,26 @@ void ServerMap::listAllLoadableBlocks(std::list &dst) } } +void ServerMap::listAllLoadedBlocks(std::list &dst) +{ + for(std::map::iterator si = m_sectors.begin(); + si != m_sectors.end(); ++si) + { + MapSector *sector = si->second; + + std::list blocks; + sector->getBlocks(blocks); + + for(std::list::iterator i = blocks.begin(); + i != blocks.end(); ++i) + { + MapBlock *block = (*i); + v3s16 p = block->getPos(); + dst.push_back(p); + } + } +} + void ServerMap::saveMapMeta() { DSTACK(__FUNCTION_NAME); diff --git a/src/map.h b/src/map.h index 31001e4c3..530d81e7a 100644 --- a/src/map.h +++ b/src/map.h @@ -279,6 +279,12 @@ public: void timerUpdate(float dtime, float unload_timeout, std::list *unloaded_blocks=NULL); + /* + Unloads all blocks with a zero refCount(). + Saves modified blocks before unloading on MAPTYPE_SERVER. + */ + void unloadUnreferencedBlocks(std::list *unloaded_blocks=NULL); + // Deletes sectors and their blocks from memory // Takes cache into account // If deleted sector is in sector cache, clears cache @@ -433,8 +439,8 @@ public: void endSave(); void save(ModifiedState save_level); - //void loadAll(); void listAllLoadableBlocks(std::list &dst); + void listAllLoadedBlocks(std::list &dst); // Saves map seed and possibly other stuff void saveMapMeta(); void loadMapMeta(); -- cgit v1.2.3 From 601ab852261e8db3edfbd75fe9664296513e6f97 Mon Sep 17 00:00:00 2001 From: sweetbomber Date: Mon, 3 Jun 2013 15:59:13 +0100 Subject: Corrected segfault when registering new biomes. --- src/script/lua_api/luaapi.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/script/lua_api/luaapi.cpp b/src/script/lua_api/luaapi.cpp index b75304b3a..6d7e32730 100644 --- a/src/script/lua_api/luaapi.cpp +++ b/src/script/lua_api/luaapi.cpp @@ -178,9 +178,9 @@ int ModApiBasic::l_register_biome(lua_State *L) b->flags = 0; //reserved b->c_top = CONTENT_IGNORE; b->c_filler = CONTENT_IGNORE; + verbosestream << "register_biome: " << b->name << std::endl; bmgr->addBiome(b); - verbosestream << "register_biome: " << b->name << std::endl; return 0; } -- cgit v1.2.3 From 649dca4d16786ed4e5b74878f56b86dea4f02542 Mon Sep 17 00:00:00 2001 From: stujones11 Date: Wed, 22 May 2013 20:20:05 +0100 Subject: Fix multiple texture support for animated meshnodes. --- src/content_cao.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/content_cao.cpp b/src/content_cao.cpp index f79d0d6f6..57bbb30b9 100644 --- a/src/content_cao.cpp +++ b/src/content_cao.cpp @@ -1308,7 +1308,7 @@ public: } // Set material flags and texture - m_animated_meshnode->setMaterialTexture(i, texture); + m_animated_meshnode->getMaterial(i).TextureLayer[0].Texture = texture; video::SMaterial& material = m_animated_meshnode->getMaterial(i); material.setFlag(video::EMF_LIGHTING, false); material.setFlag(video::EMF_BILINEAR_FILTER, false); -- cgit v1.2.3 From 4f6bec19bc0d838db6d1236e7815c0113bd05e81 Mon Sep 17 00:00:00 2001 From: Kahrl Date: Tue, 4 Jun 2013 07:44:19 +0200 Subject: Only add ^[forcesingle to get raw texture if atlas is used --- src/tile.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/tile.cpp b/src/tile.cpp index 098a963a8..f176d1549 100644 --- a/src/tile.cpp +++ b/src/tile.cpp @@ -364,14 +364,14 @@ public: // Gets a separate texture video::ITexture* getTextureRaw(const std::string &name) { - AtlasPointer ap = getTexture(name + "^[forcesingle"); + AtlasPointer ap = getTexture(name + m_forcesingle_suffix); return ap.atlas; } // Gets a separate texture atlas pointer AtlasPointer getTextureRawAP(const AtlasPointer &ap) { - return getTexture(getTextureName(ap.id) + "^[forcesingle"); + return getTexture(getTextureName(ap.id) + m_forcesingle_suffix); } // Returns a pointer to the irrlicht device @@ -437,6 +437,7 @@ private: // Main texture atlas. This is filled at startup and is then not touched. video::IImage *m_main_atlas_image; video::ITexture *m_main_atlas_texture; + std::string m_forcesingle_suffix; // Queued texture fetches (to be processed by the main thread) RequestQueue m_get_texture_queue; @@ -1137,6 +1138,8 @@ void TextureSource::buildMainAtlas(class IGameDef *gamedef) <writeImageToFile(atlas_img, atlaspath.c_str());*/ + + m_forcesingle_suffix = "^[forcesingle"; } video::IImage* generate_image_from_scratch(std::string name, -- cgit v1.2.3 From 7cb521725569b7eda98af40f7e4b4eb63afff633 Mon Sep 17 00:00:00 2001 From: "Esteban I. Ruiz Moreno" Date: Tue, 4 Jun 2013 23:26:52 -0300 Subject: Close console when it loses focus but it is still on screen --- src/game.cpp | 4 ++++ src/guiChatConsole.cpp | 5 +++++ src/guiChatConsole.h | 3 +++ 3 files changed, 12 insertions(+) diff --git a/src/game.cpp b/src/game.cpp index 22bd8c429..2d43d05b8 100644 --- a/src/game.cpp +++ b/src/game.cpp @@ -1684,6 +1684,10 @@ void the_game( { input->clear(); } + if (!guienv->hasFocus(gui_chat_console) && gui_chat_console->isOpen()) + { + gui_chat_console->closeConsoleAtOnce(); + } // Input handler step() (used by the random input generator) input->step(dtime); diff --git a/src/guiChatConsole.cpp b/src/guiChatConsole.cpp index 3dfd0090a..c1219fb80 100644 --- a/src/guiChatConsole.cpp +++ b/src/guiChatConsole.cpp @@ -134,6 +134,11 @@ void GUIChatConsole::openConsole(f32 height) reformatConsole(); } +bool GUIChatConsole::isOpen() const +{ + return m_open; +} + bool GUIChatConsole::isOpenInhibited() const { return m_open_inhibited > 0; diff --git a/src/guiChatConsole.h b/src/guiChatConsole.h index c896aae28..5991157b2 100644 --- a/src/guiChatConsole.h +++ b/src/guiChatConsole.h @@ -39,6 +39,9 @@ public: // This doesn't open immediately but initiates an animation. // You should call isOpenInhibited() before this. void openConsole(f32 height); + + bool isOpen() const; + // Check if the console should not be opened at the moment // This is to avoid reopening the console immediately after closing bool isOpenInhibited() const; -- cgit v1.2.3 From bfa608b85ed18a0d00fc0e77b223b01f3522ce34 Mon Sep 17 00:00:00 2001 From: PilzAdam Date: Thu, 6 Jun 2013 17:13:41 +0000 Subject: Revert "Fix multiple texture support for animated meshnodes." (broke existing models) This reverts commit 649dca4d16786ed4e5b74878f56b86dea4f02542. --- src/content_cao.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/content_cao.cpp b/src/content_cao.cpp index 57bbb30b9..f79d0d6f6 100644 --- a/src/content_cao.cpp +++ b/src/content_cao.cpp @@ -1308,7 +1308,7 @@ public: } // Set material flags and texture - m_animated_meshnode->getMaterial(i).TextureLayer[0].Texture = texture; + m_animated_meshnode->setMaterialTexture(i, texture); video::SMaterial& material = m_animated_meshnode->getMaterial(i); material.setFlag(video::EMF_LIGHTING, false); material.setFlag(video::EMF_BILINEAR_FILTER, false); -- cgit v1.2.3 From 6b3e553dd5ca7f31a5e9fc68a3b7f3b59b85e511 Mon Sep 17 00:00:00 2001 From: PilzAdam Date: Thu, 6 Jun 2013 17:14:26 +0000 Subject: Bump version to 0.4.7 --- CMakeLists.txt | 2 +- doc/lua_api.txt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 446fff075..c4072bae3 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -12,7 +12,7 @@ set(VERSION_EXTRA "" CACHE STRING "Stuff to append to version string") # Also remember to set PROTOCOL_VERSION in clientserver.h when releasing set(VERSION_MAJOR 0) set(VERSION_MINOR 4) -set(VERSION_PATCH 6) +set(VERSION_PATCH 7) if(VERSION_EXTRA) set(VERSION_PATCH ${VERSION_PATCH}-${VERSION_EXTRA}) endif() diff --git a/doc/lua_api.txt b/doc/lua_api.txt index 6411aae32..93e2d5c9f 100644 --- a/doc/lua_api.txt +++ b/doc/lua_api.txt @@ -1,4 +1,4 @@ -Minetest Lua Modding API Reference 0.4.6 +Minetest Lua Modding API Reference 0.4.7 ======================================== More information at http://www.minetest.net/ Developer Wiki: http://dev.minetest.net/ -- cgit v1.2.3 From 773471750dbea73431934ac3736c23564da986b5 Mon Sep 17 00:00:00 2001 From: Kahrl Date: Thu, 6 Jun 2013 22:57:38 +0200 Subject: Fix class/struct forward declaration inconsistencies (good on ya, MSVC) --- src/script/common/c_content.h | 22 +++++++++++----------- src/script/cpp_api/s_entity.h | 4 ++-- src/script/cpp_api/s_inventory.h | 2 +- src/script/cpp_api/s_item.h | 6 +++--- src/script/cpp_api/s_node.h | 2 +- src/script/cpp_api/s_nodemeta.h | 2 +- 6 files changed, 19 insertions(+), 19 deletions(-) diff --git a/src/script/common/c_content.h b/src/script/common/c_content.h index 251a72e27..58be7118c 100644 --- a/src/script/common/c_content.h +++ b/src/script/common/c_content.h @@ -39,19 +39,19 @@ extern "C" { #include "irrlichttypes_bloated.h" #include "util/string.h" -class MapNode; +struct MapNode; class INodeDefManager; -class PointedThing; -class ItemStack; -class ItemDefinition; -class ToolCapabilities; -class ObjectProperties; -class SimpleSoundSpec; -class ServerSoundParams; +struct PointedThing; +struct ItemStack; +struct ItemDefinition; +struct ToolCapabilities; +struct ObjectProperties; +struct SimpleSoundSpec; +struct ServerSoundParams; class Inventory; -class NodeBox; -class ContentFeatures; -class TileDef; +struct NodeBox; +struct ContentFeatures; +struct TileDef; class Server; struct DigParams; struct HitParams; diff --git a/src/script/cpp_api/s_entity.h b/src/script/cpp_api/s_entity.h index b95b6b4b4..8df9d7f00 100644 --- a/src/script/cpp_api/s_entity.h +++ b/src/script/cpp_api/s_entity.h @@ -23,8 +23,8 @@ with this program; if not, write to the Free Software Foundation, Inc., #include "cpp_api/s_base.h" #include "irr_v3d.h" -class ObjectProperties; -class ToolCapabilities; +struct ObjectProperties; +struct ToolCapabilities; class ScriptApiEntity : virtual public ScriptApiBase diff --git a/src/script/cpp_api/s_inventory.h b/src/script/cpp_api/s_inventory.h index bf3b5de85..d1a81de80 100644 --- a/src/script/cpp_api/s_inventory.h +++ b/src/script/cpp_api/s_inventory.h @@ -22,7 +22,7 @@ with this program; if not, write to the Free Software Foundation, Inc., #include "cpp_api/s_base.h" -class ItemStack; +struct ItemStack; class ScriptApiDetached : virtual public ScriptApiBase diff --git a/src/script/cpp_api/s_item.h b/src/script/cpp_api/s_item.h index 28ac444f6..0f2b16042 100644 --- a/src/script/cpp_api/s_item.h +++ b/src/script/cpp_api/s_item.h @@ -23,10 +23,10 @@ with this program; if not, write to the Free Software Foundation, Inc., #include "cpp_api/s_base.h" #include "irr_v3d.h" -class PointedThing; -class ItemStack; +struct PointedThing; +struct ItemStack; class ServerActiveObject; -class ItemDefinition; +struct ItemDefinition; class LuaItemStack; class ModApiItemMod; diff --git a/src/script/cpp_api/s_node.h b/src/script/cpp_api/s_node.h index bff6072b9..a8c9b3a79 100644 --- a/src/script/cpp_api/s_node.h +++ b/src/script/cpp_api/s_node.h @@ -26,7 +26,7 @@ with this program; if not, write to the Free Software Foundation, Inc., #include "cpp_api/s_base.h" #include "cpp_api/s_nodemeta.h" -class MapNode; +struct MapNode; class ServerActiveObject; class ScriptApiNode diff --git a/src/script/cpp_api/s_nodemeta.h b/src/script/cpp_api/s_nodemeta.h index 9be126c62..c2ebeba6d 100644 --- a/src/script/cpp_api/s_nodemeta.h +++ b/src/script/cpp_api/s_nodemeta.h @@ -24,7 +24,7 @@ with this program; if not, write to the Free Software Foundation, Inc., #include "cpp_api/s_item.h" #include "irr_v3d.h" -class ItemStack; +struct ItemStack; class ScriptApiNodemeta : virtual public ScriptApiBase, -- cgit v1.2.3 From 2cdf0ff4abaa045545440c8694b47371766a7b64 Mon Sep 17 00:00:00 2001 From: PilzAdam Date: Wed, 17 Apr 2013 20:13:47 +0200 Subject: Play player_damage.ogg when recieving damage and additionally play player_falling_damage.ogg when recieving falling damage --- src/environment.cpp | 6 +++++- src/game.cpp | 17 +++++++++++++++++ 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/src/environment.cpp b/src/environment.cpp index ab6a6d3d3..af05371ca 100644 --- a/src/environment.cpp +++ b/src/environment.cpp @@ -40,6 +40,7 @@ with this program; if not, write to the Free Software Foundation, Inc., #ifndef SERVER #include "clientmap.h" #include "localplayer.h" +#include "event.h" #endif #include "daynightratio.h" #include "map.h" @@ -2190,8 +2191,11 @@ void ClientEnvironment::step(float dtime) { f32 damage_f = (speed - tolerance)/BS * post_factor; u16 damage = (u16)(damage_f+0.5); - if(damage != 0) + if(damage != 0){ damageLocalPlayer(damage, true); + MtEvent *e = new SimpleTriggerEvent("PlayerFallingDamage"); + m_gamedef->event()->put(e); + } } } diff --git a/src/game.cpp b/src/game.cpp index 2d43d05b8..baf161e88 100644 --- a/src/game.cpp +++ b/src/game.cpp @@ -729,6 +729,18 @@ public: sm->m_sound->playSound(sm->m_ndef->get(nde->n).sound_dug, false); } + static void playerDamage(MtEvent *e, void *data) + { + SoundMaker *sm = (SoundMaker*)data; + sm->m_sound->playSound(SimpleSoundSpec("player_damage", 0.5), false); + } + + static void playerFallingDamage(MtEvent *e, void *data) + { + SoundMaker *sm = (SoundMaker*)data; + sm->m_sound->playSound(SimpleSoundSpec("player_falling_damage", 0.5), false); + } + void registerReceiver(MtEventManager *mgr) { mgr->reg("ViewBobbingStep", SoundMaker::viewBobbingStep, this); @@ -737,6 +749,8 @@ public: mgr->reg("CameraPunchLeft", SoundMaker::cameraPunchLeft, this); mgr->reg("CameraPunchRight", SoundMaker::cameraPunchRight, this); mgr->reg("NodeDug", SoundMaker::nodeDug, this); + mgr->reg("PlayerDamage", SoundMaker::playerDamage, this); + mgr->reg("PlayerFallingDamage", SoundMaker::playerFallingDamage, this); } void step(float dtime) @@ -2202,6 +2216,9 @@ void the_game( player->hurt_tilt_timer = 1.5; player->hurt_tilt_strength = event.player_damage.amount/2; player->hurt_tilt_strength = rangelim(player->hurt_tilt_strength, 2.0, 10.0); + + MtEvent *e = new SimpleTriggerEvent("PlayerDamage"); + gamedef->event()->put(e); } else if(event.type == CE_PLAYER_FORCE_MOVE) { -- cgit v1.2.3 From 21d6b39fd734af632aa4847935ac5f2a4ad6dc61 Mon Sep 17 00:00:00 2001 From: Kahrl Date: Thu, 13 Jun 2013 14:32:53 +0200 Subject: Enable word wrapping in profiler IGUIStaticText (freetype needs this) --- src/game.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/game.cpp b/src/game.cpp index baf161e88..cbb0d9183 100644 --- a/src/game.cpp +++ b/src/game.cpp @@ -1380,6 +1380,7 @@ void the_game( false, false); guitext_profiler->setBackgroundColor(video::SColor(120,0,0,0)); guitext_profiler->setVisible(false); + guitext_profiler->setWordWrap(true); /* Some statistics are collected in these -- cgit v1.2.3 From 7a58c1d4ca7a59f05043ff3c2caeab16c0a78a0d Mon Sep 17 00:00:00 2001 From: PilzAdam Date: Thu, 13 Jun 2013 12:41:23 +0000 Subject: Reset dig_time when switching to a tool that cant dig the current node --- src/game.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/game.cpp b/src/game.cpp index cbb0d9183..30d9c7faf 100644 --- a/src/game.cpp +++ b/src/game.cpp @@ -2706,7 +2706,12 @@ void the_game( gamedef->event()->put(e); } - dig_time += dtime; + if(dig_time_complete < 100000.0) + dig_time += dtime; + else { + dig_time = 0; + client.setCrack(-1, nodepos); + } camera.setDigging(0); // left click animation } -- cgit v1.2.3 From 40b2f36eb8a93557c0e0957267992534452e091f Mon Sep 17 00:00:00 2001 From: MetaDucky Date: Sun, 26 May 2013 09:49:02 +0200 Subject: Fixes cmake-gui causing RUN_IN_PLACE to be always off --- CMakeLists.txt | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index c4072bae3..5c8753e78 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -28,6 +28,13 @@ else() set(RUN_IN_PLACE 0 CACHE BOOL "Run directly in source directory structure") endif() +# RUN_IN_PLACE is exported as a #define value, ensure it's 1/0 instead of ON/OFF +if(RUN_IN_PLACE) + set(RUN_IN_PLACE 1) +else() + set(RUN_IN_PLACE 0) +endif() + set(BUILD_CLIENT 1 CACHE BOOL "Build client") if(WIN32) set(BUILD_SERVER 0 CACHE BOOL "Build server") -- cgit v1.2.3 From 3e4f1462bcccedddf67fa30574c5e4e740f82262 Mon Sep 17 00:00:00 2001 From: khonkhortisan Date: Sat, 8 Jun 2013 19:15:26 -0600 Subject: Fix crash in dump() when index is a table --- builtin/misc_helpers.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/builtin/misc_helpers.lua b/builtin/misc_helpers.lua index 8b0db6c5a..526be0492 100644 --- a/builtin/misc_helpers.lua +++ b/builtin/misc_helpers.lua @@ -57,7 +57,7 @@ function dump(o, dumped) dumped[o] = true local t = {} for k,v in pairs(o) do - t[#t+1] = "" .. k .. " = " .. dump(v, dumped) + t[#t+1] = "" .. dump(k, dumped) .. " = " .. dump(v, dumped) end return "{" .. table.concat(t, ", ") .. "}" elseif type(o) == "boolean" then -- cgit v1.2.3 From 93dfc3ec70007ab684ef71487081f0335eae0635 Mon Sep 17 00:00:00 2001 From: "Esteban I. Ruiz Moreno" Date: Tue, 4 Jun 2013 22:14:31 -0300 Subject: Add basic unicode support to the console (linux workaround) --- src/guiChatConsole.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/guiChatConsole.cpp b/src/guiChatConsole.cpp index c1219fb80..daec18efc 100644 --- a/src/guiChatConsole.cpp +++ b/src/guiChatConsole.cpp @@ -550,7 +550,13 @@ bool GUIChatConsole::OnEvent(const SEvent& event) } else if(event.KeyInput.Char != 0 && !event.KeyInput.Control) { - m_chat_backend->getPrompt().input(event.KeyInput.Char); + #if (defined(linux) || defined(__linux)) + wchar_t wc = L'_'; + mbtowc( &wc, (char *) &event.KeyInput.Char, sizeof(event.KeyInput.Char) ); + m_chat_backend->getPrompt().input(wc); + #else + m_chat_backend->getPrompt().input(event.KeyInput.Char); + #endif return true; } } -- cgit v1.2.3 From 0413f8ad9d0c1457819f42909ee169287effe772 Mon Sep 17 00:00:00 2001 From: sweetbomber Date: Sat, 15 Jun 2013 17:44:59 +0100 Subject: Removed a redundant step which degraded performance --- src/mapblock_mesh.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/mapblock_mesh.cpp b/src/mapblock_mesh.cpp index 0f83e863c..293d93a4c 100644 --- a/src/mapblock_mesh.cpp +++ b/src/mapblock_mesh.cpp @@ -717,8 +717,7 @@ TileSpec getNodeTile(MapNode mn, v3s16 p, v3s16 dir, MeshMakeData *data) u16 tile_index=facedir*16 + dir_i; TileSpec spec = getNodeTileN(mn, p, dir_to_tile[tile_index], data); spec.rotation=dir_to_tile[tile_index + 1]; - std::string name = data->m_gamedef->tsrc()->getTextureName(spec.texture.id); - spec.texture = data->m_gamedef->tsrc()->getTexture(name); + spec.texture = data->m_gamedef->tsrc()->getTexture(spec.texture.id); return spec; } -- cgit v1.2.3 From 44053101840594e133886986d28e557bdfb57e8b Mon Sep 17 00:00:00 2001 From: Kahrl Date: Sun, 16 Jun 2013 14:07:12 +0200 Subject: Lazy sunday typo fixing. s/unban_player_of_ip/unban_player_or_ip/g --- src/script/lua_api/luaapi.cpp | 4 ++-- src/script/lua_api/luaapi.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/script/lua_api/luaapi.cpp b/src/script/lua_api/luaapi.cpp index 6d7e32730..180a44b26 100644 --- a/src/script/lua_api/luaapi.cpp +++ b/src/script/lua_api/luaapi.cpp @@ -72,7 +72,7 @@ bool ModApiBasic::Initialize(lua_State* L,int top) { retval &= API_FCT(get_ban_list); retval &= API_FCT(get_ban_description); retval &= API_FCT(ban_player); - retval &= API_FCT(unban_player_of_ip); + retval &= API_FCT(unban_player_or_ip); retval &= API_FCT(get_password_hash); retval &= API_FCT(notify_authentication_modified); @@ -353,7 +353,7 @@ int ModApiBasic::l_ban_player(lua_State *L) } // unban_player_or_ip() -int ModApiBasic::l_unban_player_of_ip(lua_State *L) +int ModApiBasic::l_unban_player_or_ip(lua_State *L) { NO_MAP_LOCK_REQUIRED; const char * ip_or_name = luaL_checkstring(L, 1); diff --git a/src/script/lua_api/luaapi.h b/src/script/lua_api/luaapi.h index 592046965..9623502c2 100644 --- a/src/script/lua_api/luaapi.h +++ b/src/script/lua_api/luaapi.h @@ -85,7 +85,7 @@ private: static int l_ban_player(lua_State *L); // unban_player_or_ip() - static int l_unban_player_of_ip(lua_State *L); + static int l_unban_player_or_ip(lua_State *L); // show_formspec(playername,formname,formspec) static int l_show_formspec(lua_State *L); -- cgit v1.2.3 From b5918760fb52d7cbaf459012d64251b012923c1e Mon Sep 17 00:00:00 2001 From: Kahrl Date: Sun, 16 Jun 2013 17:01:21 +0200 Subject: Tweak IDropAction restriction handling in server.cpp --- src/server.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/server.cpp b/src/server.cpp index 4268bb809..7963aeaae 100644 --- a/src/server.cpp +++ b/src/server.cpp @@ -2401,6 +2401,18 @@ void Server::ProcessData(u8 *data, u32 datasize, u16 peer_id) setInventoryModified(da->from_inv); + /* + Disable dropping items out of craftpreview + */ + if(da->from_list == "craftpreview") + { + infostream<<"Ignoring IDropAction from " + <<(da->from_inv.dump())<<":"<from_list + <<" because src is "<from_list<getName(), "interact")) { -- cgit v1.2.3 From eccd1fdbeddce60717f8fcbecded5b36387e3b38 Mon Sep 17 00:00:00 2001 From: Kahrl Date: Mon, 17 Jun 2013 02:09:50 +0200 Subject: Extend a delay in TestConnection from 50 to 100 milliseconds. The 50 ms delay causes frequent test failures on certain systems with slow network stacks, these failures go away with the 100 ms variant. --- src/test.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/test.cpp b/src/test.cpp index 3a0316e17..5267b2768 100644 --- a/src/test.cpp +++ b/src/test.cpp @@ -1452,7 +1452,7 @@ struct TestConnection: public TestBase // Server should not have added client yet UASSERT(hand_server.count == 0); - sleep_ms(50); + sleep_ms(100); try { -- cgit v1.2.3 From 0a8519a26fc7c10b4e7415746e9045caa3ae978f Mon Sep 17 00:00:00 2001 From: kwolekr Date: Sat, 15 Jun 2013 22:23:06 -0400 Subject: Add initial Decoration support, many misc. improvements & modifications --- doc/lua_api.txt | 49 +++++- src/biome.cpp | 10 ++ src/biome.h | 1 + src/defaultsettings.cpp | 2 +- src/emerge.cpp | 4 + src/emerge.h | 1 + src/mapgen.cpp | 378 ++++++++++++++++++++++++++++++++++++++---- src/mapgen.h | 91 ++++++++++ src/mapgen_v6.cpp | 23 +-- src/mapgen_v6.h | 1 - src/mapgen_v7.cpp | 33 ++-- src/mapgen_v7.h | 2 - src/script/lua_api/luaapi.cpp | 142 ++++++++++++++-- src/script/lua_api/luaapi.h | 9 +- 14 files changed, 659 insertions(+), 87 deletions(-) diff --git a/doc/lua_api.txt b/doc/lua_api.txt index 93e2d5c9f..b6981582e 100644 --- a/doc/lua_api.txt +++ b/doc/lua_api.txt @@ -410,6 +410,18 @@ Currently supported flags: absheight Also produce this same ore between the height range of -height_max and -height_min. Useful for having ore in sky realms without having to duplicate ore entries. +Decoration types +------------------- +The varying types of decorations that can be placed. +The default value is simple, and is currently the only type supported. + +- simple + Creates a 1xHx1 column of a specified node (or a random node from a list, if a decoration + list is specified). Can specify a certain node it must spawn next to, such as water or lava, + for example. Can also generate a decoration of random height between a specified lower and + upper bound. This type of decoration is intended for placement of grass, flowers, cacti, + papyrus, and so on. + HUD element types ------------------- The position field is used for all element types. @@ -946,6 +958,7 @@ minetest.register_craftitem(name, item definition) minetest.register_alias(name, convert_to) minetest.register_craft(recipe) minetest.register_ore(ore definition) +minetest.register_decoration(decoration definition) Global callback registration functions: (Call these only at load time) minetest.register_globalstep(func(dtime)) @@ -1835,7 +1848,7 @@ Recipe for register_craft (furnace fuel) Ore definition (register_ore) { - ore_type = "scatter" -- See "Ore types" + ore_type = "scatter", -- See "Ore types" ore = "default:stone_with_coal", wherein = "default:stone", clust_scarcity = 8*8*8, @@ -1857,6 +1870,40 @@ Ore definition (register_ore) ^ Needed for sheet ore_type. Omit from scatter ore_type for a uniform ore distribution } +Decoration definition (register_decoration) +{ + deco_type = "simple", -- See "Decoration types" + place_on = "default:dirt_with_grass", + ^ Node that decoration can be placed on + divlen = 8, + ^ Number of divisions made in the chunk being generated + fill_ratio = 0.02, + ^ Ratio of the area to be uniformly filled by the decoration. + ^ Used only if noise_params is not specified. + noise_params = {offset=0, scale=.45, spread={x=100, y=100, z=100}, seed=354, octaves=3, persist=0.7}, + ^ NoiseParams structure describing the perlin noise used for decoration distribution. + ^ The result of this is multiplied by the 2d area of the division being decorated. + biomes = {"Oceanside", "Hills", "Plains"}, + ^ List of biomes in which this decoration occurs. Occurs in all biomes if this is omitted, + ^ and ignored if the Mapgen being used does not support biomes. + + ----- Simple-type parameters + decoration = "default:grass", + ^ The node name used as the decoration. + ^ If instead a list of strings, a randomly selected node from the list is placed as the decoration. + height = 1, + ^ Number of nodes high the decoration is made. + ^ If height_max is not 0, this is the lower bound of the randomly selected height. + height_max = 0, + ^ Number of nodes the decoration can be at maximum. + ^ If absent, the parameter 'height' is used as a constant. + spawn_by = "default:water", + ^ Node that the decoration only spawns next to, in a 1-node square radius. + num_spawn_by = 1, + ^ Number of spawn_by nodes that must be surrounding the decoration position to occur. + ^ If absent or -1, decorations occur next to any nodes. +} + Chatcommand definition (register_chatcommand) { params = " ", -- short parameter description diff --git a/src/biome.cpp b/src/biome.cpp index b50c562a0..bc84d4bc1 100644 --- a/src/biome.cpp +++ b/src/biome.cpp @@ -168,3 +168,13 @@ Biome *BiomeDefManager::getBiome(float heat, float humidity, s16 y) { return biome_closest ? biome_closest : biomes[0]; } + + +u8 BiomeDefManager::getBiomeIdByName(const char *name) { + for (size_t i = 0; i != biomes.size(); i++) { + if (!strcasecmp(name, biomes[i]->name.c_str())) + return i; + } + + return 0; +} diff --git a/src/biome.h b/src/biome.h index 17703db5a..535dc4989 100644 --- a/src/biome.h +++ b/src/biome.h @@ -84,6 +84,7 @@ public: void addBiome(Biome *b); void resolveNodeNames(INodeDefManager *ndef); + u8 getBiomeIdByName(const char *name); }; #endif diff --git a/src/defaultsettings.cpp b/src/defaultsettings.cpp index d2bed7ed8..71c283241 100644 --- a/src/defaultsettings.cpp +++ b/src/defaultsettings.cpp @@ -239,7 +239,7 @@ void set_default_settings(Settings *settings) settings->setDefault("mgv7_np_terrain_mod", "0, 1, (350, 350, 350), 85039, 5, 0.6"); settings->setDefault("mgv7_np_terrain_persist", "0, 1, (500, 500, 500), 539, 3, 0.6"); settings->setDefault("mgv7_np_height_select", "0.5, 0.5, (250, 250, 250), 4213, 5, 0.69"); - settings->setDefault("mgv7_np_ridge", "0.5, 1, (100, 100, 100), 6467, 4, 0.75"); + settings->setDefault("mgv7_np_ridge", "0, 1, (100, 100, 100), 6467, 4, 0.75"); settings->setDefault("mgindev_np_terrain_base", "-4, 20, (250, 250, 250), 82341, 5, 0.6, 10, 10"); settings->setDefault("mgindev_np_terrain_higher", "20, 16, (500, 500, 500), 85039, 5, 0.6, 10, 10"); diff --git a/src/emerge.cpp b/src/emerge.cpp index fd6c0e91f..2c94d46c1 100644 --- a/src/emerge.cpp +++ b/src/emerge.cpp @@ -101,6 +101,10 @@ EmergeManager::~EmergeManager() { for (unsigned int i = 0; i < ores.size(); i++) delete ores[i]; ores.clear(); + + for (unsigned int i = 0; i < decorations.size(); i++) + delete decorations[i]; + decorations.clear(); for (std::map::iterator iter = mglist.begin(); iter != mglist.end(); iter ++) { diff --git a/src/emerge.h b/src/emerge.h index b42e82d38..084956932 100644 --- a/src/emerge.h +++ b/src/emerge.h @@ -87,6 +87,7 @@ public: //Mapgen-related structures BiomeDefManager *biomedef; std::vector ores; + std::vector decorations; EmergeManager(IGameDef *gamedef); ~EmergeManager(); diff --git a/src/mapgen.cpp b/src/mapgen.cpp index 835c14be1..49ac827e1 100644 --- a/src/mapgen.cpp +++ b/src/mapgen.cpp @@ -87,7 +87,7 @@ void Ore::resolveNodeNames(INodeDefManager *ndef) { wherein = CONTENT_AIR; } } - + if (wherein == CONTENT_IGNORE) { wherein = ndef->getId(wherein_name); if (wherein == CONTENT_IGNORE) { @@ -110,9 +110,8 @@ void Ore::placeOre(Mapgen *mg, u32 blockseed, v3s16 nmin, v3s16 nmax) { return; resolveNodeNames(mg->ndef); - + int ymin, ymax; - if (in_range & ORE_RANGE_MIRROR) { ymin = MYMAX(nmin.Y, -height_max); ymax = MYMIN(nmax.Y, -height_min); @@ -122,7 +121,7 @@ void Ore::placeOre(Mapgen *mg, u32 blockseed, v3s16 nmin, v3s16 nmax) { } if (clust_size >= ymax - ymin + 1) return; - + nmin.Y = ymin; nmax.Y = ymax; generate(mg->vm, mg->seed, blockseed, nmin, nmax); @@ -130,7 +129,7 @@ void Ore::placeOre(Mapgen *mg, u32 blockseed, v3s16 nmin, v3s16 nmax) { void OreScatter::generate(ManualMapVoxelManipulator *vm, int seed, - u32 blockseed, v3s16 nmin, v3s16 nmax) { + u32 blockseed, v3s16 nmin, v3s16 nmax) { PseudoRandom pr(blockseed); MapNode n_ore(ore, 0, ore_param2); @@ -145,16 +144,16 @@ void OreScatter::generate(ManualMapVoxelManipulator *vm, int seed, int x0 = pr.range(nmin.X, nmax.X - csize + 1); int y0 = pr.range(nmin.Y, nmax.Y - csize + 1); int z0 = pr.range(nmin.Z, nmax.Z - csize + 1); - + if (np && (NoisePerlin3D(np, x0, y0, z0, seed) < nthresh)) continue; - + for (int z1 = 0; z1 != csize; z1++) for (int y1 = 0; y1 != csize; y1++) for (int x1 = 0; x1 != csize; x1++) { if (pr.range(1, orechance) != 1) continue; - + u32 i = vm->m_area.index(x0 + x1, y0 + y1, z0 + z1); if (vm->m_data[i].getContent() == wherein) vm->m_data[i] = n_ore; @@ -167,10 +166,10 @@ void OreSheet::generate(ManualMapVoxelManipulator *vm, int seed, u32 blockseed, v3s16 nmin, v3s16 nmax) { PseudoRandom pr(blockseed + 4234); MapNode n_ore(ore, 0, ore_param2); - + int max_height = clust_size; int y_start = pr.range(nmin.Y, nmax.Y - max_height); - + if (!noise) { int sx = nmax.X - nmin.X + 1; int sz = nmax.Z - nmin.Z + 1; @@ -178,14 +177,14 @@ void OreSheet::generate(ManualMapVoxelManipulator *vm, int seed, } noise->seed = seed + y_start; noise->perlinMap2D(nmin.X, nmin.Z); - + int index = 0; for (int z = nmin.Z; z <= nmax.Z; z++) for (int x = nmin.X; x <= nmax.X; x++) { float noiseval = noise->result[index++]; if (noiseval < nthresh) continue; - + int height = max_height * (1. / pr.range(1, 3)); int y0 = y_start + np->scale * noiseval; //pr.range(1, 3) - 1; int y1 = y0 + height; @@ -193,7 +192,7 @@ void OreSheet::generate(ManualMapVoxelManipulator *vm, int seed, u32 i = vm->m_area.index(x, y, z); if (!vm->m_area.contains(i)) continue; - + if (vm->m_data[i].getContent() == wherein) vm->m_data[i] = n_ore; } @@ -201,6 +200,316 @@ void OreSheet::generate(ManualMapVoxelManipulator *vm, int seed, } +Decoration *createDecoration(DecorationType type) { + switch (type) { + case DECO_SIMPLE: + return new DecoSimple; + //case DECO_SCHEMATIC: + // return new DecoSchematic; + //case DECO_LSYSTEM: + // return new DecoLSystem; + default: + return NULL; + } +} + + +Decoration::~Decoration() { + delete np; +} + + +void Decoration::resolveNodeNames(INodeDefManager *ndef) { + if (c_place_on == CONTENT_IGNORE) + c_place_on = ndef->getId(place_on_name); +} + + +void Decoration::placeDeco(Mapgen *mg, u32 blockseed, v3s16 nmin, v3s16 nmax) { + resolveNodeNames(mg->ndef); + + PseudoRandom ps(blockseed + 53); + int carea_size = nmax.X - nmin.X + 1; + + // Divide area into parts + s16 sidelen = carea_size / divlen; + float area = sidelen * sidelen; + + for (s16 z0 = 0; z0 < divlen; z0++) + for (s16 x0 = 0; x0 < divlen; x0++) { + v2s16 p2d_center( // Center position of part of division + nmin.X + sidelen / 2 + sidelen * x0, + nmin.Z + sidelen / 2 + sidelen * z0 + ); + v2s16 p2d_min( // Minimum edge of part of division + nmin.X + sidelen * x0, + nmin.Z + sidelen * z0 + ); + v2s16 p2d_max( // Maximum edge of part of division + nmin.X + sidelen + sidelen * x0 - 1, + nmin.Z + sidelen + sidelen * z0 - 1 + ); + + // Amount of decorations + float nval = np ? + NoisePerlin2D(np, p2d_center.X, p2d_center.Y, mapseed) : + fill_ratio; + u32 deco_count = area * MYMAX(nval, 0.f); + + for (u32 i = 0; i < deco_count; i++) { + s16 x = ps.range(p2d_min.X, p2d_max.X); + s16 z = ps.range(p2d_min.Y, p2d_max.Y); + + int mapindex = carea_size * (z - nmin.Z) + (x - nmin.X); + + s16 y = mg->heightmap ? + mg->heightmap[mapindex] : + mg->findGroundLevel(v2s16(x, z), nmin.Y, nmax.Y); + + if (y < nmin.Y || y > nmax.Y) + continue; + + int height = getHeight(); + int max_y = nmax.Y + MAP_BLOCKSIZE; + if (y + 1 + height > max_y) { + continue; +#if 0 + printf("Decoration at (%d %d %d) cut off\n", x, y, z); + //add to queue + JMutexAutoLock cutofflock(cutoff_mutex); + cutoffs.push_back(CutoffData(x, y, z, height)); +#endif + } + + if (mg->biomemap) { + std::set::iterator iter; + + if (biomes.size()) { + iter = biomes.find(mg->biomemap[mapindex]); + if (iter == biomes.end()) + continue; + } + } + + generate(mg, &ps, max_y, 0, v3s16(x, y, z)); + } + } +} + + +#if 0 +void Decoration::placeCutoffs(Mapgen *mg, u32 blockseed, v3s16 nmin, v3s16 nmax) { + PseudoRandom pr(blockseed + 53); + std::vector handled_cutoffs; + + // Copy over the cutoffs we're interested in so we don't needlessly hold a lock + { + JMutexAutoLock cutofflock(cutoff_mutex); + for (std::list::iterator i = cutoffs.begin(); + i != cutoffs.end(); ++i) { + CutoffData cutoff = *i; + v3s16 p = cutoff.p; + s16 height = cutoff.height; + if (p.X < nmin.X || p.X > nmax.X || + p.Z < nmin.Z || p.Z > nmax.Z) + continue; + if (p.Y + height < nmin.Y || p.Y > nmax.Y) + continue; + + handled_cutoffs.push_back(cutoff); + } + } + + // Generate the cutoffs + for (size_t i = 0; i != handled_cutoffs.size(); i++) { + v3s16 p = handled_cutoffs[i].p; + s16 height = handled_cutoffs[i].height; + + if (p.Y + height > nmax.Y) { + //printf("Decoration at (%d %d %d) cut off again!\n", p.X, p.Y, p.Z); + cuttoffs.push_back(v3s16(p.X, p.Y, p.Z)); + } + + generate(mg, &pr, nmax.Y, nmin.Y - p.Y, v3s16(p.X, nmin.Y, p.Z)); + } + + // Remove cutoffs that were handled from the cutoff list + { + JMutexAutoLock cutofflock(cutoff_mutex); + for (std::list::iterator i = cutoffs.begin(); + i != cutoffs.end(); ++i) { + + for (size_t j = 0; j != handled_cutoffs.size(); j++) { + CutoffData coff = *i; + if (coff.p == handled_cutoffs[j].p) + i = cutoffs.erase(i); + } + } + } +} +#endif + + +void DecoSimple::resolveNodeNames(INodeDefManager *ndef) { + Decoration::resolveNodeNames(ndef); + + if (c_deco == CONTENT_IGNORE) { + c_deco = ndef->getId(deco_name); + if (c_deco == CONTENT_IGNORE) { + errorstream << "DecoSimple::resolveNodeNames: decoration node '" + << deco_name << "' not defined"; + c_deco = CONTENT_AIR; + } + } + if (c_spawnby == CONTENT_IGNORE) { + c_spawnby = ndef->getId(spawnby_name); + if (c_spawnby == CONTENT_IGNORE) { + errorstream << "DecoSimple::resolveNodeNames: spawnby node '" + << deco_name << "' not defined"; + nspawnby = -1; + c_spawnby = CONTENT_AIR; + } + } + + if (c_decolist.size()) + return; + + for (size_t i = 0; i != decolist_names.size(); i++) { + content_t c = ndef->getId(decolist_names[i]); + if (c == CONTENT_IGNORE) { + errorstream << "DecoSimple::resolveNodeNames: decolist node '" + << decolist_names[i] << "' not defined"; + c = CONTENT_AIR; + } + c_decolist.push_back(c); + } +} + + +void DecoSimple::generate(Mapgen *mg, PseudoRandom *pr, s16 max_y, s16 start_y, v3s16 p) { + ManualMapVoxelManipulator *vm = mg->vm; + + u32 vi = vm->m_area.index(p); + if (vm->m_data[vi].getContent() != c_place_on && + c_place_on != CONTENT_IGNORE) + return; + + if (nspawnby != -1) { + int nneighs = 0; + v3s16 dirs[8] = { // a Moore neighborhood + v3s16( 0, 0, 1), + v3s16( 0, 0, -1), + v3s16( 1, 0, 0), + v3s16(-1, 0, 0), + v3s16( 1, 0, 1), + v3s16(-1, 0, 1), + v3s16(-1, 0, -1), + v3s16( 1, 0, -1) + }; + + for (int i = 0; i != 8; i++) { + u32 index = vm->m_area.index(p + dirs[i]); + if (vm->m_area.contains(index) && + vm->m_data[index].getContent() == c_spawnby) + nneighs++; + } + + if (nneighs < nspawnby) + return; + } + + size_t ndecos = c_decolist.size(); + content_t c = ndecos ? c_decolist[pr->range(0, ndecos - 1)] : c_deco; + + s16 height = (deco_height_max > 0) ? + pr->range(deco_height, deco_height_max) : deco_height; + + height = MYMIN(height, max_y - p.Y); + + v3s16 em = vm->m_area.getExtent(); + for (int i = start_y; i < height; i++) { + vm->m_area.add_y(em, vi, 1); + vm->m_data[vi] = MapNode(c); + } +} + + +int DecoSimple::getHeight() { + return (deco_height_max > 0) ? deco_height_max : deco_height; +} + + +std::string DecoSimple::getName() { + return deco_name; +} + + +/////////////////////////////////////////////////////////////////////////////// + + +Mapgen::Mapgen() { + seed = 0; + water_level = 0; + generating = false; + id = -1; + vm = NULL; + ndef = NULL; + heightmap = NULL; + biomemap = NULL; +} + + +// Returns Y one under area minimum if not found +s16 Mapgen::findGroundLevelFull(v2s16 p2d) { + v3s16 em = vm->m_area.getExtent(); + s16 y_nodes_max = vm->m_area.MaxEdge.Y; + s16 y_nodes_min = vm->m_area.MinEdge.Y; + u32 i = vm->m_area.index(p2d.X, y_nodes_max, p2d.Y); + s16 y; + + for (y = y_nodes_max; y >= y_nodes_min; y--) { + MapNode &n = vm->m_data[i]; + if (ndef->get(n).walkable) + break; + + vm->m_area.add_y(em, i, -1); + } + return (y >= y_nodes_min) ? y : y_nodes_min - 1; +} + + +s16 Mapgen::findGroundLevel(v2s16 p2d, s16 ymin, s16 ymax) { + v3s16 em = vm->m_area.getExtent(); + u32 i = vm->m_area.index(p2d.X, ymax, p2d.Y); + s16 y; + + for (y = ymax; y >= ymin; y--) { + MapNode &n = vm->m_data[i]; + if (ndef->get(n).walkable) + break; + + vm->m_area.add_y(em, i, -1); + } + return y; +} + + +void Mapgen::updateHeightmap(v3s16 nmin, v3s16 nmax) { + if (!heightmap) + return; + + //TimeTaker t("Mapgen::updateHeightmap", NULL, PRECISION_MICRO); + int index = 0; + for (s16 z = nmin.Z; z <= nmax.Z; z++) { + for (s16 x = nmin.X; x <= nmax.X; x++) { + s16 y = findGroundLevel(v2s16(x, z), nmin.Y, nmax.Y); + heightmap[index++] = y; + } + } + //printf("updateHeightmap: %dus\n", t.stop()); +} + + void Mapgen::updateLiquid(UniqueQueue *trans_liquid, v3s16 nmin, v3s16 nmax) { bool isliquid, wasliquid; v3s16 em = vm->m_area.getExtent(); @@ -208,11 +517,11 @@ void Mapgen::updateLiquid(UniqueQueue *trans_liquid, v3s16 nmin, v3s16 nm for (s16 z = nmin.Z; z <= nmax.Z; z++) { for (s16 x = nmin.X; x <= nmax.X; x++) { wasliquid = true; - + u32 i = vm->m_area.index(x, nmax.Y, z); for (s16 y = nmax.Y; y >= nmin.Y; y--) { isliquid = ndef->get(vm->m_data[i]).isLiquid(); - + // there was a change between liquid and nonliquid, add to queue if (isliquid != wasliquid) trans_liquid->push_back(v3s16(x, y, z)); @@ -242,7 +551,7 @@ void Mapgen::setLighting(v3s16 nmin, v3s16 nmax, u8 light) { void Mapgen::lightSpread(VoxelArea &a, v3s16 p, u8 light) { if (light <= 1 || !a.contains(p)) return; - + u32 vi = vm->m_area.index(p); MapNode &nn = vm->m_data[vi]; @@ -250,9 +559,9 @@ void Mapgen::lightSpread(VoxelArea &a, v3s16 p, u8 light) { // should probably compare masked, but doesn't seem to make a difference if (light <= nn.param1 || !ndef->get(nn).light_propagates) return; - + nn.param1 = light; - + lightSpread(a, p + v3s16(0, 0, 1), light); lightSpread(a, p + v3s16(0, 1, 0), light); lightSpread(a, p + v3s16(1, 0, 0), light); @@ -282,7 +591,7 @@ void Mapgen::calcLighting(v3s16 nmin, v3s16 nmax) { continue; } vm->m_area.add_y(em, i, -1); - + for (int y = a.MaxEdge.Y; y >= a.MinEdge.Y; y--) { MapNode &n = vm->m_data[i]; if (!ndef->get(n).sunlight_propagates) @@ -292,7 +601,7 @@ void Mapgen::calcLighting(v3s16 nmin, v3s16 nmax) { } } } - + // now spread the sunlight and light up any sources for (int z = a.MinEdge.Z; z <= a.MaxEdge.Z; z++) { for (int y = a.MinEdge.Y; y <= a.MaxEdge.Y; y++) { @@ -302,11 +611,11 @@ void Mapgen::calcLighting(v3s16 nmin, v3s16 nmax) { if (n.getContent() == CONTENT_IGNORE || !ndef->get(n).light_propagates) continue; - + u8 light_produced = ndef->get(n).light_source & 0x0F; if (light_produced) n.param1 = light_produced; - + u8 light = n.param1 & 0x0F; if (light) { lightSpread(a, v3s16(x, y, z + 1), light); @@ -319,7 +628,7 @@ void Mapgen::calcLighting(v3s16 nmin, v3s16 nmax) { } } } - + //printf("updateLighting: %dms\n", t.stop()); } @@ -331,24 +640,24 @@ void Mapgen::calcLightingOld(v3s16 nmin, v3s16 nmax) { bool sunlight = !block_is_underground; ScopeProfiler sp(g_profiler, "EmergeThread: mapgen lighting update", SPT_AVG); - + for (int i = 0; i < 2; i++) { enum LightBank bank = banks[i]; std::set light_sources; std::map unlight_from; voxalgo::clearLightAndCollectSources(*vm, a, bank, ndef, - light_sources, unlight_from); + light_sources, unlight_from); voxalgo::propagateSunlight(*vm, a, sunlight, light_sources, ndef); vm->unspreadLight(bank, unlight_from, light_sources, ndef); vm->spreadLight(bank, light_sources, ndef); } } - - + + //////////////////////// Mapgen V6 parameter read/write - + bool MapgenV6Params::readParams(Settings *settings) { freq_desert = settings->getFloat("mgv6_freq_desert"); freq_beach = settings->getFloat("mgv6_freq_beach"); @@ -367,12 +676,12 @@ bool MapgenV6Params::readParams(Settings *settings) { settings->getNoiseParams("mgv6_np_apple_trees", np_apple_trees); return success; } - - + + void MapgenV6Params::writeParams(Settings *settings) { settings->setFloat("mgv6_freq_desert", freq_desert); settings->setFloat("mgv6_freq_beach", freq_beach); - + settings->setNoiseParams("mgv6_np_terrain_base", np_terrain_base); settings->setNoiseParams("mgv6_np_terrain_higher", np_terrain_higher); settings->setNoiseParams("mgv6_np_steepness", np_steepness); @@ -411,7 +720,6 @@ void MapgenV7Params::writeParams(Settings *settings) { /////////////////////////////////// legacy static functions for farmesh - s16 Mapgen::find_ground_level_from_noise(u64 seed, v2s16 p2d, s16 precision) { //just need to return something s16 level = 5; @@ -421,9 +729,9 @@ s16 Mapgen::find_ground_level_from_noise(u64 seed, v2s16 p2d, s16 precision) { bool Mapgen::get_have_beach(u64 seed, v2s16 p2d) { double sandnoise = noise2d_perlin( - 0.2+(float)p2d.X/250, 0.7+(float)p2d.Y/250, - seed+59420, 3, 0.50); - + 0.2+(float)p2d.X/250, 0.7+(float)p2d.Y/250, + seed+59420, 3, 0.50); + return (sandnoise > 0.15); } diff --git a/src/mapgen.h b/src/mapgen.h index 5d1e3bdf0..e8252cbbf 100644 --- a/src/mapgen.h +++ b/src/mapgen.h @@ -86,9 +86,15 @@ public: int id; ManualMapVoxelManipulator *vm; INodeDefManager *ndef; + s16 *heightmap; + u8 *biomemap; + Mapgen(); virtual ~Mapgen() {} + s16 findGroundLevelFull(v2s16 p2d); + s16 findGroundLevel(v2s16 p2d, s16 ymin, s16 ymax); + void updateHeightmap(v3s16 nmin, v3s16 nmax); void updateLiquid(UniqueQueue *trans_liquid, v3s16 nmin, v3s16 nmax); void setLighting(v3s16 nmin, v3s16 nmax, u8 light); void lightSpread(VoxelArea &a, v3s16 p, u8 light); @@ -166,5 +172,90 @@ class OreSheet : public Ore { Ore *createOre(OreType type); + +enum DecorationType { + DECO_SIMPLE, + DECO_SCHEMATIC, + DECO_LSYSTEM +}; + +#if 0 +struct CutoffData { + VoxelArea a; + Decoration *deco; + //v3s16 p; + //v3s16 size; + //s16 height; + + CutoffData(s16 x, s16 y, s16 z, s16 h) { + p = v3s16(x, y, z); + height = h; + } +}; +#endif + +class Decoration { +public: + int mapseed; + std::string place_on_name; + content_t c_place_on; + s16 divlen; + float fill_ratio; + NoiseParams *np; + + std::set biomes; + //std::list cutoffs; + //JMutex cutoff_mutex; + + virtual ~Decoration(); + + virtual void resolveNodeNames(INodeDefManager *ndef); + void placeDeco(Mapgen *mg, u32 blockseed, v3s16 nmin, v3s16 nmax); + void placeCutoffs(Mapgen *mg, u32 blockseed, v3s16 nmin, v3s16 nmax); + + virtual void generate(Mapgen *mg, PseudoRandom *pr, s16 max_y, + s16 start_y, v3s16 p) = 0; + virtual int getHeight() = 0; + virtual std::string getName() = 0; +}; + +class DecoSimple : public Decoration { +public: + std::string deco_name; + std::string spawnby_name; + content_t c_deco; + content_t c_spawnby; + s16 deco_height; + s16 deco_height_max; + s16 nspawnby; + + std::vector decolist_names; + std::vector c_decolist; + + ~DecoSimple() {} + + void resolveNodeNames(INodeDefManager *ndef); + virtual void generate(Mapgen *mg, PseudoRandom *pr, s16 max_y, + s16 start_y, v3s16 p); + virtual int getHeight(); + virtual std::string getName(); +}; + +/* +class DecoSchematic : public Decoration { +public: + virtual void generate(Mapgen *mg, u32 blockseed, v3s16 nmin, v3s16 nmax); +}; +*/ + +/* +class DecoLSystem : public Decoration { +public: + virtual void generate(Mapgen *mg, u32 blockseed, v3s16 nmin, v3s16 nmax); +}; +*/ + +Decoration *createDecoration(DecorationType type); + #endif diff --git a/src/mapgen_v6.cpp b/src/mapgen_v6.cpp index eaca33988..a411f966b 100644 --- a/src/mapgen_v6.cpp +++ b/src/mapgen_v6.cpp @@ -79,7 +79,7 @@ MapgenV6::MapgenV6(int mapgenid, MapgenV6Params *params, EmergeManager *emerge) this->freq_beach = params->freq_beach; this->ystride = csize.X; //////fix this - + np_cave = ¶ms->np_cave; np_humidity = ¶ms->np_humidity; np_trees = ¶ms->np_trees; @@ -108,23 +108,6 @@ MapgenV6::~MapgenV6() { //////////////////////// Some helper functions for the map generator -// Returns Y one under area minimum if not found -s16 MapgenV6::find_ground_level(v2s16 p2d) { - v3s16 em = vm->m_area.getExtent(); - s16 y_nodes_max = vm->m_area.MaxEdge.Y; - s16 y_nodes_min = vm->m_area.MinEdge.Y; - u32 i = vm->m_area.index(p2d.X, y_nodes_max, p2d.Y); - s16 y; - - for (y = y_nodes_max; y >= y_nodes_min; y--) { - MapNode &n = vm->m_data[i]; - if(ndef->get(n).walkable) - break; - - vm->m_area.add_y(em, i, -1); - } - return (y >= y_nodes_min) ? y : y_nodes_min - 1; -} // Returns Y one under area minimum if not found s16 MapgenV6::find_stone_level(v2s16 p2d) { @@ -849,7 +832,7 @@ void MapgenV6::placeTreesAndJungleGrass() { s16 x = grassrandom.range(p2d_min.X, p2d_max.X); s16 z = grassrandom.range(p2d_min.Y, p2d_max.Y); - s16 y = find_ground_level(v2s16(x, z)); ////////////////optimize this! + s16 y = findGroundLevelFull(v2s16(x, z)); ////////////////optimize this! if (y < water_level || y < node_min.Y || y > node_max.Y) continue; @@ -866,7 +849,7 @@ void MapgenV6::placeTreesAndJungleGrass() { for (u32 i = 0; i < tree_count; i++) { s16 x = myrand_range(p2d_min.X, p2d_max.X); s16 z = myrand_range(p2d_min.Y, p2d_max.Y); - s16 y = find_ground_level(v2s16(x, z)); ////////////////////optimize this! + s16 y = findGroundLevelFull(v2s16(x, z)); ////////////////////optimize this! // Don't make a tree under water level // Don't make a tree so high that it doesn't fit if(y < water_level || y > node_max.Y - 6) diff --git a/src/mapgen_v6.h b/src/mapgen_v6.h index 8f456fd3f..f4ffd25f3 100644 --- a/src/mapgen_v6.h +++ b/src/mapgen_v6.h @@ -132,7 +132,6 @@ public: virtual float baseTerrainLevelFromMap(v2s16 p); virtual float baseTerrainLevelFromMap(int index); - s16 find_ground_level(v2s16 p2d); s16 find_stone_level(v2s16 p2d); bool block_is_underground(u64 seed, v3s16 blockpos); s16 find_ground_level_from_noise(u64 seed, v2s16 p2d, s16 precision); diff --git a/src/mapgen_v7.cpp b/src/mapgen_v7.cpp index 6daa5fc6a..2439c95b3 100644 --- a/src/mapgen_v7.cpp +++ b/src/mapgen_v7.cpp @@ -52,7 +52,7 @@ NoiseParams nparams_v7_def_terrain_persist = NoiseParams nparams_v7_def_height_select = {0.5, 0.5, v3f(250.0, 250.0, 250.0), 4213, 5, 0.69}; NoiseParams nparams_v7_def_ridge = - {0.5, 1.0, v3f(100.0, 100.0, 100.0), 6467, 4, 0.75}; + {0, 1.0, v3f(100.0, 100.0, 100.0), 6467, 4, 0.75}; /* NoiseParams nparams_v6_def_beach = {0.0, 1.0, v3f(250.0, 250.0, 250.0), 59420, 3, 0.50}; @@ -121,15 +121,19 @@ int MapgenV7::getGroundLevelAtPoint(v2s16 p) { Biome *b = bmgr->getBiome(heat, humidity, groundlevel); s16 y = groundlevel; - if (y > water_level) { - int iters = 1024; // don't even bother iterating more than 1024 times.. - while (iters--) { - float ridgenoise = NoisePerlin3D(noise_ridge->np, p.X, y, p.Y, seed); - if (ridgenoise * (float)(y * y) < 15.0) - break; - y--; - } + int iters = 1024; // don't even bother iterating more than 64 times.. + while (iters--) { + if (y <= water_level) + break; + + float ridgenoise = NoisePerlin3D(noise_ridge->np, p.X, y, p.Y, seed); + if (ridgenoise * (float)(y * y) < 15.0) + break; + + y--; } + if (iters == 0) + printf("iters exhausted at %d %d\n", p.X, p.Y); return y + b->top_depth; } @@ -182,15 +186,24 @@ void MapgenV7::makeChunk(BlockMakeData *data) { generateTerrain(); carveRidges(); + + if (flags & MG_CAVES) + generateCaves(stone_surface_max_y); - generateCaves(stone_surface_max_y); addTopNodes(); + + updateHeightmap(node_min, node_max); if (flags & MG_DUNGEONS) { DungeonGen dgen(ndef, data->seed, water_level); dgen.generate(vm, blockseed, full_node_min, full_node_max); } + for (size_t i = 0; i != emerge->decorations.size(); i++) { + Decoration *deco = emerge->decorations[i]; + deco->placeDeco(this, blockseed + i, node_min, node_max); + } + for (size_t i = 0; i != emerge->ores.size(); i++) { Ore *ore = emerge->ores[i]; ore->placeOre(this, blockseed + i, node_min, node_max); diff --git a/src/mapgen_v7.h b/src/mapgen_v7.h index b6b03689d..d7177862d 100644 --- a/src/mapgen_v7.h +++ b/src/mapgen_v7.h @@ -67,9 +67,7 @@ public: v3s16 full_node_min; v3s16 full_node_max; - s16 *heightmap; s16 *ridge_heightmap; - u8 *biomemap; Noise *noise_terrain_base; Noise *noise_terrain_alt; diff --git a/src/script/lua_api/luaapi.cpp b/src/script/lua_api/luaapi.cpp index 180a44b26..75139861b 100644 --- a/src/script/lua_api/luaapi.cpp +++ b/src/script/lua_api/luaapi.cpp @@ -43,6 +43,14 @@ struct EnumString ModApiBasic::es_OreType[] = {0, NULL}, }; +struct EnumString ModApiBasic::es_DecorationType[] = +{ + {DECO_SIMPLE, "simple"}, + {DECO_SCHEMATIC, "schematic"}, + {DECO_LSYSTEM, "lsystem"}, + {0, NULL}, +}; + ModApiBasic::ModApiBasic() : ModApiBase() { } @@ -92,6 +100,7 @@ bool ModApiBasic::Initialize(lua_State* L,int top) { retval &= API_FCT(rollback_revert_actions_by); retval &= API_FCT(register_ore); + retval &= API_FCT(register_decoration); return retval; } @@ -162,21 +171,21 @@ int ModApiBasic::l_register_biome(lua_State *L) } enum BiomeTerrainType terrain = (BiomeTerrainType)getenumfield(L, index, - "terrain_type", es_BiomeTerrainType, BIOME_TERRAIN_NORMAL); + "terrain_type", es_BiomeTerrainType, BIOME_TERRAIN_NORMAL); Biome *b = bmgr->createBiome(terrain); - b->name = getstringfield_default(L, index, "name", ""); - b->top_nodename = getstringfield_default(L, index, "top_node", ""); - b->top_depth = getintfield_default(L, index, "top_depth", 0); + b->name = getstringfield_default(L, index, "name", ""); + b->top_nodename = getstringfield_default(L, index, "top_node", ""); + b->top_depth = getintfield_default(L, index, "top_depth", 0); b->filler_nodename = getstringfield_default(L, index, "filler_node", ""); - b->filler_height = getintfield_default(L, index, "filler_height", 0); - b->height_min = getintfield_default(L, index, "height_min", 0); - b->height_max = getintfield_default(L, index, "height_max", 0); - b->heat_point = getfloatfield_default(L, index, "heat_point", 0.); - b->humidity_point = getfloatfield_default(L, index, "humidity_point", 0.); - - b->flags = 0; //reserved - b->c_top = CONTENT_IGNORE; + b->filler_height = getintfield_default(L, index, "filler_height", 0); + b->height_min = getintfield_default(L, index, "height_min", 0); + b->height_max = getintfield_default(L, index, "height_max", 0); + b->heat_point = getfloatfield_default(L, index, "heat_point", 0.); + b->humidity_point = getfloatfield_default(L, index, "humidity_point", 0.); + + b->flags = 0; //reserved + b->c_top = CONTENT_IGNORE; b->c_filler = CONTENT_IGNORE; verbosestream << "register_biome: " << b->name << std::endl; bmgr->addBiome(b); @@ -184,8 +193,6 @@ int ModApiBasic::l_register_biome(lua_State *L) return 0; } - - // setting_set(name, value) int ModApiBasic::l_setting_set(lua_State *L) { @@ -650,4 +657,111 @@ int ModApiBasic::l_register_ore(lua_State *L) return 0; } +// register_decoration({lots of stuff}) +int ModApiBasic::l_register_decoration(lua_State *L) +{ + int index = 1; + luaL_checktype(L, index, LUA_TTABLE); + + EmergeManager *emerge = getServer(L)->getEmergeManager(); + BiomeDefManager *bdef = emerge->biomedef; + + enum DecorationType decotype = (DecorationType)getenumfield(L, index, + "deco_type", es_DecorationType, -1); + if (decotype == -1) { + errorstream << "register_decoration: unrecognized " + "decoration placement type"; + return 0; + } + + Decoration *deco = createDecoration(decotype); + if (!deco) { + errorstream << "register_decoration: decoration placement type " + << decotype << " not implemented"; + return 0; + } + + deco->c_place_on = CONTENT_IGNORE; + deco->place_on_name = getstringfield_default(L, index, "place_on", "ignore"); + deco->divlen = getintfield_default(L, index, "divlen", 8); + deco->fill_ratio = getfloatfield_default(L, index, "fill_ratio", 0.02); + + lua_getfield(L, index, "noise_params"); + deco->np = read_noiseparams(L, -1); + lua_pop(L, 1); + + lua_getfield(L, index, "biomes"); + if (lua_istable(L, -1)) { + lua_pushnil(L); + while (lua_next(L, -2)) { + const char *s = lua_tostring(L, -1); + u8 biomeid = bdef->getBiomeIdByName(s); + if (biomeid) + deco->biomes.insert(biomeid); + + lua_pop(L, 1); + } + lua_pop(L, 1); + } + + switch (decotype) { + case DECO_SIMPLE: { + DecoSimple *dsimple = (DecoSimple *)deco; + dsimple->c_deco = CONTENT_IGNORE; + dsimple->c_spawnby = CONTENT_IGNORE; + dsimple->spawnby_name = getstringfield_default(L, index, "spawn_by", "air"); + dsimple->deco_height = getintfield_default(L, index, "height", 1); + dsimple->deco_height_max = getintfield_default(L, index, "height_max", 0); + dsimple->nspawnby = getintfield_default(L, index, "num_spawn_by", -1); + + lua_getfield(L, index, "decoration"); + if (lua_istable(L, -1)) { + lua_pushnil(L); + while (lua_next(L, -2)) { + const char *s = lua_tostring(L, -1); + std::string str(s); + dsimple->decolist_names.push_back(str); + + lua_pop(L, 1); + } + } else if (lua_isstring(L, -1)) { + dsimple->deco_name = std::string(lua_tostring(L, -1)); + } else { + dsimple->deco_name = std::string("air"); + } + lua_pop(L, 1); + + if (dsimple->deco_height <= 0) { + errorstream << "register_decoration: simple decoration height" + " must be greater than 0" << std::endl; + delete dsimple; + return 0; + } + + break; } + case DECO_SCHEMATIC: { + //DecoSchematic *decoschematic = (DecoSchematic *)deco; + + break; } + case DECO_LSYSTEM: { + //DecoLSystem *decolsystem = (DecoLSystem *)deco; + + break; } + } + + if (deco->divlen <= 0) { + errorstream << "register_decoration: divlen must be " + "greater than 0" << std::endl; + delete deco; + return 0; + } + + emerge->decorations.push_back(deco); + + verbosestream << "register_decoration: decoration '" << deco->getName() + << "' registered" << std::endl; + return 0; +} + + ModApiBasic modapibasic_prototype; diff --git a/src/script/lua_api/luaapi.h b/src/script/lua_api/luaapi.h index 9623502c2..d03c14117 100644 --- a/src/script/lua_api/luaapi.h +++ b/src/script/lua_api/luaapi.h @@ -45,9 +45,6 @@ private: // get_server_status() static int l_get_server_status(lua_State *L); - // register_biome_groups({frequencies}) - static int l_register_biome_groups(lua_State *L); - // register_biome({lots of stuff}) static int l_register_biome(lua_State *L); @@ -130,9 +127,15 @@ private: // rollback_revert_actions_by(actor, seconds) -> bool, log messages static int l_rollback_revert_actions_by(lua_State *L); + // register_ore(oredesc) static int l_register_ore(lua_State *L); + + // register_decoration(deco) + static int l_register_decoration(lua_State *L); static struct EnumString es_OreType[]; + static struct EnumString es_DecorationType[]; + }; -- cgit v1.2.3 From 56093b6614a47b181bbce6d4e35d213a4e04120c Mon Sep 17 00:00:00 2001 From: kwolekr Date: Mon, 17 Jun 2013 18:23:31 -0400 Subject: Decoration: Change divlen to sidelen --- doc/lua_api.txt | 5 +++-- src/mapgen.cpp | 10 ++++++++-- src/mapgen.h | 2 +- src/script/lua_api/luaapi.cpp | 6 +++--- 4 files changed, 15 insertions(+), 8 deletions(-) diff --git a/doc/lua_api.txt b/doc/lua_api.txt index b6981582e..85f6ca5a6 100644 --- a/doc/lua_api.txt +++ b/doc/lua_api.txt @@ -1875,8 +1875,9 @@ Decoration definition (register_decoration) deco_type = "simple", -- See "Decoration types" place_on = "default:dirt_with_grass", ^ Node that decoration can be placed on - divlen = 8, - ^ Number of divisions made in the chunk being generated + sidelen = 8, + ^ Size of divisions made in the chunk being generated. + ^ If the chunk size is not evenly divisible by sidelen, sidelen is made equal to the chunk size. fill_ratio = 0.02, ^ Ratio of the area to be uniformly filled by the decoration. ^ Used only if noise_params is not specified. diff --git a/src/mapgen.cpp b/src/mapgen.cpp index 49ac827e1..17afcf350 100644 --- a/src/mapgen.cpp +++ b/src/mapgen.cpp @@ -232,8 +232,14 @@ void Decoration::placeDeco(Mapgen *mg, u32 blockseed, v3s16 nmin, v3s16 nmax) { int carea_size = nmax.X - nmin.X + 1; // Divide area into parts - s16 sidelen = carea_size / divlen; - float area = sidelen * sidelen; + if (carea_size % sidelen) { + errorstream << "Decoration::placeDeco: chunk size is not divisible by " + "sidelen; setting sidelen to " << carea_size << std::endl; + sidelen = carea_size; + } + + s16 divlen = carea_size / sidelen; + int area = sidelen * sidelen; for (s16 z0 = 0; z0 < divlen; z0++) for (s16 x0 = 0; x0 < divlen; x0++) { diff --git a/src/mapgen.h b/src/mapgen.h index e8252cbbf..f3d90a14e 100644 --- a/src/mapgen.h +++ b/src/mapgen.h @@ -199,7 +199,7 @@ public: int mapseed; std::string place_on_name; content_t c_place_on; - s16 divlen; + s16 sidelen; float fill_ratio; NoiseParams *np; diff --git a/src/script/lua_api/luaapi.cpp b/src/script/lua_api/luaapi.cpp index 75139861b..667a3afcf 100644 --- a/src/script/lua_api/luaapi.cpp +++ b/src/script/lua_api/luaapi.cpp @@ -683,7 +683,7 @@ int ModApiBasic::l_register_decoration(lua_State *L) deco->c_place_on = CONTENT_IGNORE; deco->place_on_name = getstringfield_default(L, index, "place_on", "ignore"); - deco->divlen = getintfield_default(L, index, "divlen", 8); + deco->sidelen = getintfield_default(L, index, "sidelen", 8); deco->fill_ratio = getfloatfield_default(L, index, "fill_ratio", 0.02); lua_getfield(L, index, "noise_params"); @@ -749,8 +749,8 @@ int ModApiBasic::l_register_decoration(lua_State *L) break; } } - if (deco->divlen <= 0) { - errorstream << "register_decoration: divlen must be " + if (deco->sidelen <= 0) { + errorstream << "register_decoration: sidelen must be " "greater than 0" << std::endl; delete deco; return 0; -- cgit v1.2.3 From 0b20768a242851364ba645a99c24a85c23544f86 Mon Sep 17 00:00:00 2001 From: kwolekr Date: Mon, 17 Jun 2013 18:51:29 -0400 Subject: Decoration, Ore: Resolve node names on Mapgen init --- src/emerge.cpp | 6 +++++- src/mapgen.cpp | 4 ---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/emerge.cpp b/src/emerge.cpp index 2c94d46c1..9edc42b7b 100644 --- a/src/emerge.cpp +++ b/src/emerge.cpp @@ -123,9 +123,13 @@ void EmergeManager::initMapgens(MapgenParams *mgparams) { return; biomedef->resolveNodeNames(ndef); + for (size_t i = 0; i != ores.size(); i++) + ores[i]->resolveNodeNames(ndef); + for (size_t i = 0; i != decorations.size(); i++) + decorations[i]->resolveNodeNames(ndef); this->params = mgparams; - for (unsigned int i = 0; i != emergethread.size(); i++) { + for (size_t i = 0; i != emergethread.size(); i++) { mg = createMapgen(params->mg_name, 0, params); if (!mg) { infostream << "EmergeManager: falling back to mapgen v6" << std::endl; diff --git a/src/mapgen.cpp b/src/mapgen.cpp index 17afcf350..d2bde0063 100644 --- a/src/mapgen.cpp +++ b/src/mapgen.cpp @@ -109,8 +109,6 @@ void Ore::placeOre(Mapgen *mg, u32 blockseed, v3s16 nmin, v3s16 nmax) { if (!in_range) return; - resolveNodeNames(mg->ndef); - int ymin, ymax; if (in_range & ORE_RANGE_MIRROR) { ymin = MYMAX(nmin.Y, -height_max); @@ -226,8 +224,6 @@ void Decoration::resolveNodeNames(INodeDefManager *ndef) { void Decoration::placeDeco(Mapgen *mg, u32 blockseed, v3s16 nmin, v3s16 nmax) { - resolveNodeNames(mg->ndef); - PseudoRandom ps(blockseed + 53); int carea_size = nmax.X - nmin.X + 1; -- cgit v1.2.3 From 816ffa99ba3e11eb5d5c50a21fe019bb657c48d3 Mon Sep 17 00:00:00 2001 From: "Esteban I. Ruiz Moreno" Date: Sat, 15 Jun 2013 15:30:48 -0300 Subject: Remove useless recalculation of bounding box (mapblock_mesh) --- src/mapblock_mesh.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/src/mapblock_mesh.cpp b/src/mapblock_mesh.cpp index 293d93a4c..be88b1973 100644 --- a/src/mapblock_mesh.cpp +++ b/src/mapblock_mesh.cpp @@ -1199,7 +1199,6 @@ MapBlockMesh::MapBlockMesh(MeshMakeData *data): */ translateMesh(m_mesh, intToFloat(data->m_blockpos * MAP_BLOCKSIZE, BS)); - m_mesh->recalculateBoundingBox(); // translateMesh already does this if(m_mesh) { -- cgit v1.2.3 From c8ed61b2815e9bc32cacc32d8e3dff8bc315831b Mon Sep 17 00:00:00 2001 From: Kahrl Date: Tue, 18 Jun 2013 01:18:54 +0200 Subject: Fix calculation of selected item (for not drawing it) in formspec The previous code did not work when the list did not start at index 0 of the inventory list (issue #779). --- src/guiFormSpecMenu.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/guiFormSpecMenu.cpp b/src/guiFormSpecMenu.cpp index 3e0d7fd46..0cc631332 100644 --- a/src/guiFormSpecMenu.cpp +++ b/src/guiFormSpecMenu.cpp @@ -698,7 +698,7 @@ void GUIFormSpecMenu::drawList(const ListDrawSpec &s, int phase) bool selected = m_selected_item && m_invmgr->getInventory(m_selected_item->inventoryloc) == inv && m_selected_item->listname == s.listname - && m_selected_item->i == i; + && m_selected_item->i == item_i; bool hovering = rect.isPointInside(m_pointer); if(phase == 0) -- cgit v1.2.3 From d74c3773372ff0dc2d79d16ec77877ec8267a5a7 Mon Sep 17 00:00:00 2001 From: Kahrl Date: Tue, 18 Jun 2013 01:32:11 +0200 Subject: Formspec: Don't perform black magic if selected item fits the guess --- src/guiFormSpecMenu.cpp | 96 ++++++++++++++++++++++++------------------------- src/guiFormSpecMenu.h | 1 + 2 files changed, 49 insertions(+), 48 deletions(-) diff --git a/src/guiFormSpecMenu.cpp b/src/guiFormSpecMenu.cpp index 0cc631332..c1b256f08 100644 --- a/src/guiFormSpecMenu.cpp +++ b/src/guiFormSpecMenu.cpp @@ -912,11 +912,20 @@ void GUIFormSpecMenu::drawMenu() void GUIFormSpecMenu::updateSelectedItem() { + // If the selected stack has become empty for some reason, deselect it. + // If the selected stack has become inaccessible, deselect it. + // If the selected stack has become smaller, adjust m_selected_amount. + ItemStack selected = verifySelectedItem(); + // WARNING: BLACK MAGIC // See if there is a stack suited for our current guess. // If such stack does not exist, clear the guess. - if(m_selected_content_guess.name != "") - { + if(m_selected_content_guess.name != "" && + selected.name == m_selected_content_guess.name && + selected.count == m_selected_content_guess.count){ + // Selected item fits the guess. Skip the black magic. + } + else if(m_selected_content_guess.name != ""){ bool found = false; for(u32 i=0; iinventoryloc == s.inventoryloc && - m_selected_item->listname == s.listname && - m_selected_item->i == (s32)item_i && - m_selected_amount == stack.count){ - break; - } - delete m_selected_item; - m_selected_item = NULL; - } infostream<<"Client: Changing selected content guess to " <isValid()) - { - Inventory *inv = m_invmgr->getInventory(m_selected_item->inventoryloc); - if(inv) - { - InventoryList *list = inv->getList(m_selected_item->listname); - if(list && (u32) m_selected_item->i < list->getSize()) - { - ItemStack stack = list->getItem(m_selected_item->i); - if(m_selected_amount > stack.count) - m_selected_amount = stack.count; - if(!stack.empty()) - selection_valid = true; - } - } - } - if(!selection_valid) - { - delete m_selected_item; - m_selected_item = NULL; - m_selected_amount = 0; - m_selected_dragging = false; - } - } // If craftresult is nonempty and nothing else is selected, select it now. if(!m_selected_item) @@ -1017,12 +986,43 @@ void GUIFormSpecMenu::updateSelectedItem() // If craftresult is selected, keep the whole stack selected if(m_selected_item && m_selected_item->listname == "craftresult") { - Inventory *inv = m_invmgr->getInventory(m_selected_item->inventoryloc); - assert(inv); - InventoryList *list = inv->getList(m_selected_item->listname); - assert(list); - m_selected_amount = list->getItem(m_selected_item->i).count; + m_selected_amount = verifySelectedItem().count; + } +} + +ItemStack GUIFormSpecMenu::verifySelectedItem() +{ + // If the selected stack has become empty for some reason, deselect it. + // If the selected stack has become inaccessible, deselect it. + // If the selected stack has become smaller, adjust m_selected_amount. + // Return the selected stack. + + if(m_selected_item) + { + if(m_selected_item->isValid()) + { + Inventory *inv = m_invmgr->getInventory(m_selected_item->inventoryloc); + if(inv) + { + InventoryList *list = inv->getList(m_selected_item->listname); + if(list && (u32) m_selected_item->i < list->getSize()) + { + ItemStack stack = list->getItem(m_selected_item->i); + if(m_selected_amount > stack.count) + m_selected_amount = stack.count; + if(!stack.empty()) + return stack; + } + } + } + + // selection was not valid + delete m_selected_item; + m_selected_item = NULL; + m_selected_amount = 0; + m_selected_dragging = false; } + return ItemStack(); } void GUIFormSpecMenu::acceptInput() diff --git a/src/guiFormSpecMenu.h b/src/guiFormSpecMenu.h index 17b202b18..ae985adde 100644 --- a/src/guiFormSpecMenu.h +++ b/src/guiFormSpecMenu.h @@ -186,6 +186,7 @@ public: void drawSelectedItem(); void drawMenu(); void updateSelectedItem(); + ItemStack verifySelectedItem(); void acceptInput(); bool OnEvent(const SEvent& event); -- cgit v1.2.3 From 261f559339470aae8bebc09a7f45beae0ddcae07 Mon Sep 17 00:00:00 2001 From: Kahrl Date: Tue, 18 Jun 2013 01:49:06 +0200 Subject: Show number of objects in client environment in profiler (F6) --- src/environment.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/environment.cpp b/src/environment.cpp index af05371ca..a97a9bd08 100644 --- a/src/environment.cpp +++ b/src/environment.cpp @@ -2264,6 +2264,7 @@ void ClientEnvironment::step(float dtime) Step active objects and update lighting of them */ + g_profiler->avg("CEnv: num of objects", m_active_objects.size()); bool update_lighting = m_active_object_light_update_interval.step(dtime, 0.21); for(std::map::iterator i = m_active_objects.begin(); @@ -2293,6 +2294,7 @@ void ClientEnvironment::step(float dtime) /* Step and handle simple objects */ + g_profiler->avg("CEnv: num of simple objects", m_simple_objects.size()); for(std::list::iterator i = m_simple_objects.begin(); i != m_simple_objects.end();) { -- cgit v1.2.3 From f18b4872ea7e46b50c9ea0e5e6484baae41b0a44 Mon Sep 17 00:00:00 2001 From: kwolekr Date: Mon, 17 Jun 2013 21:59:42 -0400 Subject: Decoration: Place decorations in mgv6, check if air or cignore before placement --- src/mapgen.cpp | 11 ++++++++--- src/mapgen_v6.cpp | 6 ++++++ 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/src/mapgen.cpp b/src/mapgen.cpp index d2bde0063..72757f4fa 100644 --- a/src/mapgen.cpp +++ b/src/mapgen.cpp @@ -421,17 +421,22 @@ void DecoSimple::generate(Mapgen *mg, PseudoRandom *pr, s16 max_y, s16 start_y, } size_t ndecos = c_decolist.size(); - content_t c = ndecos ? c_decolist[pr->range(0, ndecos - 1)] : c_deco; + content_t c_place = ndecos ? c_decolist[pr->range(0, ndecos - 1)] : c_deco; s16 height = (deco_height_max > 0) ? pr->range(deco_height, deco_height_max) : deco_height; height = MYMIN(height, max_y - p.Y); - + v3s16 em = vm->m_area.getExtent(); for (int i = start_y; i < height; i++) { vm->m_area.add_y(em, vi, 1); - vm->m_data[vi] = MapNode(c); + + content_t c = vm->m_data[vi].getContent(); + if (c != CONTENT_AIR && c != CONTENT_IGNORE) + break; + + vm->m_data[vi] = MapNode(c_place); } } diff --git a/src/mapgen_v6.cpp b/src/mapgen_v6.cpp index a411f966b..d3db00dc2 100644 --- a/src/mapgen_v6.cpp +++ b/src/mapgen_v6.cpp @@ -445,6 +445,12 @@ void MapgenV6::makeChunk(BlockMakeData *data) { // Generate some trees, and add grass, if a jungle if (flags & MG_TREES) placeTreesAndJungleGrass(); + + // Generate the registered decorations + for (unsigned int i = 0; i != emerge->decorations.size(); i++) { + Decoration *deco = emerge->decorations[i]; + deco->placeDeco(this, blockseed + i, node_min, node_max); + } // Generate the registered ores for (unsigned int i = 0; i != emerge->ores.size(); i++) { -- cgit v1.2.3 From 26165453d284b5b4a876722c732bbe95572b52ab Mon Sep 17 00:00:00 2001 From: David Gumberg Date: Mon, 27 May 2013 20:55:01 -0700 Subject: Compress textures --- games/minimal/menu/background.png | Bin 1387 -> 392 bytes games/minimal/menu/icon.png | Bin 397 -> 218 bytes games/minimal/mods/bucket/textures/bucket.png | Bin 329 -> 182 bytes games/minimal/mods/bucket/textures/bucket_lava.png | Bin 363 -> 183 bytes .../minimal/mods/bucket/textures/bucket_water.png | Bin 369 -> 180 bytes .../mods/default/textures/crack_anylength.png | Bin 367 -> 255 bytes .../mods/default/textures/default_apple.png | Bin 203 -> 109 bytes .../minimal/mods/default/textures/default_book.png | Bin 292 -> 157 bytes .../mods/default/textures/default_bookshelf.png | Bin 597 -> 515 bytes .../mods/default/textures/default_brick.png | Bin 604 -> 457 bytes .../mods/default/textures/default_cactus_side.png | Bin 279 -> 144 bytes .../mods/default/textures/default_cactus_top.png | Bin 236 -> 121 bytes .../mods/default/textures/default_chest_front.png | Bin 167 -> 114 bytes .../mods/default/textures/default_chest_lock.png | Bin 224 -> 145 bytes .../mods/default/textures/default_chest_side.png | Bin 151 -> 98 bytes .../mods/default/textures/default_chest_top.png | Bin 142 -> 93 bytes .../minimal/mods/default/textures/default_clay.png | Bin 613 -> 318 bytes .../mods/default/textures/default_clay_brick.png | Bin 249 -> 173 bytes .../mods/default/textures/default_clay_lump.png | Bin 210 -> 140 bytes .../mods/default/textures/default_cloud.png | Bin 118 -> 83 bytes .../mods/default/textures/default_coal_lump.png | Bin 933 -> 138 bytes .../mods/default/textures/default_cobble.png | Bin 830 -> 374 bytes .../mods/default/textures/default_fence.png | Bin 539 -> 480 bytes .../default/textures/default_furnace_fire_bg.png | Bin 313 -> 220 bytes .../default/textures/default_furnace_fire_fg.png | Bin 865 -> 719 bytes .../default/textures/default_furnace_front.png | Bin 246 -> 159 bytes .../textures/default_furnace_front_active.png | Bin 376 -> 283 bytes .../mods/default/textures/default_furnace_side.png | Bin 236 -> 125 bytes .../mods/default/textures/default_glass.png | Bin 978 -> 210 bytes .../mods/default/textures/default_grass.png | Bin 874 -> 782 bytes .../default/textures/default_grass_footsteps.png | Bin 856 -> 771 bytes .../mods/default/textures/default_gravel.png | Bin 591 -> 172 bytes .../mods/default/textures/default_iron_lump.png | Bin 936 -> 140 bytes .../mods/default/textures/default_junglegrass.png | Bin 672 -> 237 bytes .../mods/default/textures/default_jungletree.png | Bin 502 -> 210 bytes .../default/textures/default_jungletree_top.png | Bin 507 -> 205 bytes .../mods/default/textures/default_ladder.png | Bin 395 -> 368 bytes .../minimal/mods/default/textures/default_lava.png | Bin 357 -> 172 bytes .../textures/default_lava_flowing_animated.png | Bin 8715 -> 7818 bytes .../textures/default_lava_source_animated.png | Bin 3481 -> 2902 bytes .../mods/default/textures/default_leaves.png | Bin 1689 -> 1683 bytes .../minimal/mods/default/textures/default_mese.png | Bin 203 -> 129 bytes .../mods/default/textures/default_mineral_coal.png | Bin 952 -> 142 bytes .../mods/default/textures/default_mineral_iron.png | Bin 1614 -> 922 bytes .../mods/default/textures/default_mossycobble.png | Bin 965 -> 603 bytes .../mods/default/textures/default_nc_back.png | Bin 317 -> 186 bytes .../mods/default/textures/default_nc_front.png | Bin 378 -> 204 bytes .../mods/default/textures/default_nc_rb.png | Bin 206 -> 137 bytes .../mods/default/textures/default_nc_side.png | Bin 231 -> 148 bytes .../mods/default/textures/default_paper.png | Bin 242 -> 139 bytes .../mods/default/textures/default_papyrus.png | Bin 366 -> 165 bytes .../minimal/mods/default/textures/default_rail.png | Bin 507 -> 437 bytes .../default/textures/default_rail_crossing.png | Bin 555 -> 388 bytes .../mods/default/textures/default_rail_curved.png | Bin 545 -> 375 bytes .../default/textures/default_rail_t_junction.png | Bin 542 -> 374 bytes .../minimal/mods/default/textures/default_sand.png | Bin 1381 -> 762 bytes .../mods/default/textures/default_sandstone.png | Bin 772 -> 744 bytes .../mods/default/textures/default_sapling.png | Bin 502 -> 328 bytes .../default/textures/default_scorched_stuff.png | Bin 233 -> 164 bytes .../mods/default/textures/default_sign_wall.png | Bin 489 -> 416 bytes .../mods/default/textures/default_steel_block.png | Bin 219 -> 128 bytes .../mods/default/textures/default_steel_ingot.png | Bin 207 -> 144 bytes .../mods/default/textures/default_stick.png | Bin 182 -> 120 bytes .../mods/default/textures/default_stone.png | Bin 806 -> 389 bytes .../mods/default/textures/default_tnt_bottom.png | Bin 161 -> 98 bytes .../mods/default/textures/default_tnt_side.png | Bin 186 -> 129 bytes .../mods/default/textures/default_tnt_top.png | Bin 264 -> 146 bytes .../default/textures/default_tool_mesepick.png | Bin 252 -> 155 bytes .../default/textures/default_tool_steelaxe.png | Bin 927 -> 140 bytes .../default/textures/default_tool_steelpick.png | Bin 271 -> 163 bytes .../default/textures/default_tool_steelshovel.png | Bin 216 -> 144 bytes .../default/textures/default_tool_steelsword.png | Bin 291 -> 169 bytes .../default/textures/default_tool_stoneaxe.png | Bin 931 -> 141 bytes .../default/textures/default_tool_stonepick.png | Bin 262 -> 155 bytes .../default/textures/default_tool_stoneshovel.png | Bin 203 -> 144 bytes .../default/textures/default_tool_stonesword.png | Bin 301 -> 168 bytes .../mods/default/textures/default_tool_woodaxe.png | Bin 927 -> 134 bytes .../default/textures/default_tool_woodpick.png | Bin 245 -> 149 bytes .../default/textures/default_tool_woodshovel.png | Bin 203 -> 135 bytes .../default/textures/default_tool_woodsword.png | Bin 255 -> 147 bytes .../mods/default/textures/default_torch.png | Bin 925 -> 146 bytes .../default/textures/default_torch_on_ceiling.png | Bin 913 -> 137 bytes .../default/textures/default_torch_on_floor.png | Bin 917 -> 138 bytes .../mods/default/textures/default_tree_top.png | Bin 1024 -> 177 bytes .../mods/default/textures/default_water.png | Bin 518 -> 302 bytes games/minimal/mods/default/textures/heart.png | Bin 308 -> 248 bytes games/minimal/mods/default/textures/player.png | Bin 212 -> 157 bytes .../minimal/mods/default/textures/player_back.png | Bin 201 -> 149 bytes games/minimal/mods/default/textures/treeprop.png | Bin 1055 -> 757 bytes games/minimal/mods/default/textures/wieldhand.png | Bin 384 -> 212 bytes .../textures/experimental_dummyball.png | Bin 838 -> 399 bytes .../textures/experimental_tester_tool_1.png | Bin 209 -> 160 bytes games/minimal/mods/legacy/textures/apple_iron.png | Bin 207 -> 119 bytes games/minimal/mods/legacy/textures/cooked_rat.png | Bin 239 -> 145 bytes .../mods/legacy/textures/dungeon_master.png | Bin 6636 -> 3007 bytes games/minimal/mods/legacy/textures/fireball.png | Bin 603 -> 279 bytes games/minimal/mods/legacy/textures/firefly.png | Bin 116 -> 99 bytes games/minimal/mods/legacy/textures/oerkki1.png | Bin 250 -> 165 bytes .../mods/legacy/textures/oerkki1_damaged.png | Bin 341 -> 210 bytes games/minimal/mods/legacy/textures/rat.png | Bin 920 -> 141 bytes misc/minetest-icon-24x24.png | Bin 913 -> 587 bytes textures/base/pack/fontdejavusansmono.png | Bin 9453 -> 8511 bytes textures/base/pack/fontlucida.png | Bin 17284 -> 7719 bytes textures/base/pack/logo.png | Bin 13156 -> 12190 bytes textures/base/pack/menu_header.png | Bin 156026 -> 133115 bytes textures/base/pack/smoke_puff.png | Bin 2182 -> 1334 bytes textures/base/pack/sunrisebg.png | Bin 4652 -> 4587 bytes textures/base/pack/unknown_item.png | Bin 710 -> 294 bytes textures/base/pack/unknown_node.png | Bin 608 -> 193 bytes textures/base/pack/unknown_object.png | Bin 489 -> 254 bytes 110 files changed, 0 insertions(+), 0 deletions(-) diff --git a/games/minimal/menu/background.png b/games/minimal/menu/background.png index e020f909d..ea5fbdce5 100644 Binary files a/games/minimal/menu/background.png and b/games/minimal/menu/background.png differ diff --git a/games/minimal/menu/icon.png b/games/minimal/menu/icon.png index fa8d7cd7f..8ef675023 100644 Binary files a/games/minimal/menu/icon.png and b/games/minimal/menu/icon.png differ diff --git a/games/minimal/mods/bucket/textures/bucket.png b/games/minimal/mods/bucket/textures/bucket.png index f165fd209..b775a9fd3 100644 Binary files a/games/minimal/mods/bucket/textures/bucket.png and b/games/minimal/mods/bucket/textures/bucket.png differ diff --git a/games/minimal/mods/bucket/textures/bucket_lava.png b/games/minimal/mods/bucket/textures/bucket_lava.png index 7cf27cd1f..889ed61d4 100644 Binary files a/games/minimal/mods/bucket/textures/bucket_lava.png and b/games/minimal/mods/bucket/textures/bucket_lava.png differ diff --git a/games/minimal/mods/bucket/textures/bucket_water.png b/games/minimal/mods/bucket/textures/bucket_water.png index f220ec51e..a3c9d72f7 100644 Binary files a/games/minimal/mods/bucket/textures/bucket_water.png and b/games/minimal/mods/bucket/textures/bucket_water.png differ diff --git a/games/minimal/mods/default/textures/crack_anylength.png b/games/minimal/mods/default/textures/crack_anylength.png index 6832c5118..d9b49f911 100644 Binary files a/games/minimal/mods/default/textures/crack_anylength.png and b/games/minimal/mods/default/textures/crack_anylength.png differ diff --git a/games/minimal/mods/default/textures/default_apple.png b/games/minimal/mods/default/textures/default_apple.png index 9593f28f6..4473dca28 100644 Binary files a/games/minimal/mods/default/textures/default_apple.png and b/games/minimal/mods/default/textures/default_apple.png differ diff --git a/games/minimal/mods/default/textures/default_book.png b/games/minimal/mods/default/textures/default_book.png index 176fb6aa9..ea14a372a 100644 Binary files a/games/minimal/mods/default/textures/default_book.png and b/games/minimal/mods/default/textures/default_book.png differ diff --git a/games/minimal/mods/default/textures/default_bookshelf.png b/games/minimal/mods/default/textures/default_bookshelf.png index 5ecc50ff3..f225e3449 100644 Binary files a/games/minimal/mods/default/textures/default_bookshelf.png and b/games/minimal/mods/default/textures/default_bookshelf.png differ diff --git a/games/minimal/mods/default/textures/default_brick.png b/games/minimal/mods/default/textures/default_brick.png index 32d77f347..def1cf0b1 100644 Binary files a/games/minimal/mods/default/textures/default_brick.png and b/games/minimal/mods/default/textures/default_brick.png differ diff --git a/games/minimal/mods/default/textures/default_cactus_side.png b/games/minimal/mods/default/textures/default_cactus_side.png index fc479fde6..128a4d28a 100644 Binary files a/games/minimal/mods/default/textures/default_cactus_side.png and b/games/minimal/mods/default/textures/default_cactus_side.png differ diff --git a/games/minimal/mods/default/textures/default_cactus_top.png b/games/minimal/mods/default/textures/default_cactus_top.png index f9e68df51..eda1a0bb6 100644 Binary files a/games/minimal/mods/default/textures/default_cactus_top.png and b/games/minimal/mods/default/textures/default_cactus_top.png differ diff --git a/games/minimal/mods/default/textures/default_chest_front.png b/games/minimal/mods/default/textures/default_chest_front.png index c5628af94..55b076c35 100644 Binary files a/games/minimal/mods/default/textures/default_chest_front.png and b/games/minimal/mods/default/textures/default_chest_front.png differ diff --git a/games/minimal/mods/default/textures/default_chest_lock.png b/games/minimal/mods/default/textures/default_chest_lock.png index ae038fae5..4b2d1af6c 100644 Binary files a/games/minimal/mods/default/textures/default_chest_lock.png and b/games/minimal/mods/default/textures/default_chest_lock.png differ diff --git a/games/minimal/mods/default/textures/default_chest_side.png b/games/minimal/mods/default/textures/default_chest_side.png index 916dd784d..ae4847cb6 100644 Binary files a/games/minimal/mods/default/textures/default_chest_side.png and b/games/minimal/mods/default/textures/default_chest_side.png differ diff --git a/games/minimal/mods/default/textures/default_chest_top.png b/games/minimal/mods/default/textures/default_chest_top.png index 58c79674d..ac41551b0 100644 Binary files a/games/minimal/mods/default/textures/default_chest_top.png and b/games/minimal/mods/default/textures/default_chest_top.png differ diff --git a/games/minimal/mods/default/textures/default_clay.png b/games/minimal/mods/default/textures/default_clay.png index 3557429d8..070b69e48 100644 Binary files a/games/minimal/mods/default/textures/default_clay.png and b/games/minimal/mods/default/textures/default_clay.png differ diff --git a/games/minimal/mods/default/textures/default_clay_brick.png b/games/minimal/mods/default/textures/default_clay_brick.png index e36648e48..e25633b70 100644 Binary files a/games/minimal/mods/default/textures/default_clay_brick.png and b/games/minimal/mods/default/textures/default_clay_brick.png differ diff --git a/games/minimal/mods/default/textures/default_clay_lump.png b/games/minimal/mods/default/textures/default_clay_lump.png index be0bab9d7..ceed6fa75 100644 Binary files a/games/minimal/mods/default/textures/default_clay_lump.png and b/games/minimal/mods/default/textures/default_clay_lump.png differ diff --git a/games/minimal/mods/default/textures/default_cloud.png b/games/minimal/mods/default/textures/default_cloud.png index 24091a377..faf0ec13d 100644 Binary files a/games/minimal/mods/default/textures/default_cloud.png and b/games/minimal/mods/default/textures/default_cloud.png differ diff --git a/games/minimal/mods/default/textures/default_coal_lump.png b/games/minimal/mods/default/textures/default_coal_lump.png index bad901efa..dae47e342 100644 Binary files a/games/minimal/mods/default/textures/default_coal_lump.png and b/games/minimal/mods/default/textures/default_coal_lump.png differ diff --git a/games/minimal/mods/default/textures/default_cobble.png b/games/minimal/mods/default/textures/default_cobble.png index 7d0447419..2a28d25a5 100644 Binary files a/games/minimal/mods/default/textures/default_cobble.png and b/games/minimal/mods/default/textures/default_cobble.png differ diff --git a/games/minimal/mods/default/textures/default_fence.png b/games/minimal/mods/default/textures/default_fence.png index 0b99f0eb5..e3510c52a 100644 Binary files a/games/minimal/mods/default/textures/default_fence.png and b/games/minimal/mods/default/textures/default_fence.png differ diff --git a/games/minimal/mods/default/textures/default_furnace_fire_bg.png b/games/minimal/mods/default/textures/default_furnace_fire_bg.png index 1272e101e..e3370f438 100644 Binary files a/games/minimal/mods/default/textures/default_furnace_fire_bg.png and b/games/minimal/mods/default/textures/default_furnace_fire_bg.png differ diff --git a/games/minimal/mods/default/textures/default_furnace_fire_fg.png b/games/minimal/mods/default/textures/default_furnace_fire_fg.png index fbb19df74..7a126e325 100644 Binary files a/games/minimal/mods/default/textures/default_furnace_fire_fg.png and b/games/minimal/mods/default/textures/default_furnace_fire_fg.png differ diff --git a/games/minimal/mods/default/textures/default_furnace_front.png b/games/minimal/mods/default/textures/default_furnace_front.png index 1620a27c3..4da398c0a 100644 Binary files a/games/minimal/mods/default/textures/default_furnace_front.png and b/games/minimal/mods/default/textures/default_furnace_front.png differ diff --git a/games/minimal/mods/default/textures/default_furnace_front_active.png b/games/minimal/mods/default/textures/default_furnace_front_active.png index e4d8a5b81..06c4ab3ef 100644 Binary files a/games/minimal/mods/default/textures/default_furnace_front_active.png and b/games/minimal/mods/default/textures/default_furnace_front_active.png differ diff --git a/games/minimal/mods/default/textures/default_furnace_side.png b/games/minimal/mods/default/textures/default_furnace_side.png index 63cb162fe..c729de9bf 100644 Binary files a/games/minimal/mods/default/textures/default_furnace_side.png and b/games/minimal/mods/default/textures/default_furnace_side.png differ diff --git a/games/minimal/mods/default/textures/default_glass.png b/games/minimal/mods/default/textures/default_glass.png index ade0196fe..fd665a40c 100644 Binary files a/games/minimal/mods/default/textures/default_glass.png and b/games/minimal/mods/default/textures/default_glass.png differ diff --git a/games/minimal/mods/default/textures/default_grass.png b/games/minimal/mods/default/textures/default_grass.png index 3610bb2bc..1d76708a0 100644 Binary files a/games/minimal/mods/default/textures/default_grass.png and b/games/minimal/mods/default/textures/default_grass.png differ diff --git a/games/minimal/mods/default/textures/default_grass_footsteps.png b/games/minimal/mods/default/textures/default_grass_footsteps.png index 57e063d8c..8349033d6 100644 Binary files a/games/minimal/mods/default/textures/default_grass_footsteps.png and b/games/minimal/mods/default/textures/default_grass_footsteps.png differ diff --git a/games/minimal/mods/default/textures/default_gravel.png b/games/minimal/mods/default/textures/default_gravel.png index f08666ad9..4b47e2346 100644 Binary files a/games/minimal/mods/default/textures/default_gravel.png and b/games/minimal/mods/default/textures/default_gravel.png differ diff --git a/games/minimal/mods/default/textures/default_iron_lump.png b/games/minimal/mods/default/textures/default_iron_lump.png index edb931018..6b515f66d 100644 Binary files a/games/minimal/mods/default/textures/default_iron_lump.png and b/games/minimal/mods/default/textures/default_iron_lump.png differ diff --git a/games/minimal/mods/default/textures/default_junglegrass.png b/games/minimal/mods/default/textures/default_junglegrass.png index eea87c07c..7066f7dd9 100644 Binary files a/games/minimal/mods/default/textures/default_junglegrass.png and b/games/minimal/mods/default/textures/default_junglegrass.png differ diff --git a/games/minimal/mods/default/textures/default_jungletree.png b/games/minimal/mods/default/textures/default_jungletree.png index ccd20ac74..a1fd36a51 100644 Binary files a/games/minimal/mods/default/textures/default_jungletree.png and b/games/minimal/mods/default/textures/default_jungletree.png differ diff --git a/games/minimal/mods/default/textures/default_jungletree_top.png b/games/minimal/mods/default/textures/default_jungletree_top.png index 2a9b51373..a13fdae4a 100644 Binary files a/games/minimal/mods/default/textures/default_jungletree_top.png and b/games/minimal/mods/default/textures/default_jungletree_top.png differ diff --git a/games/minimal/mods/default/textures/default_ladder.png b/games/minimal/mods/default/textures/default_ladder.png index 11056359d..46757b884 100644 Binary files a/games/minimal/mods/default/textures/default_ladder.png and b/games/minimal/mods/default/textures/default_ladder.png differ diff --git a/games/minimal/mods/default/textures/default_lava.png b/games/minimal/mods/default/textures/default_lava.png index cb02ada13..a4cf649f1 100644 Binary files a/games/minimal/mods/default/textures/default_lava.png and b/games/minimal/mods/default/textures/default_lava.png differ diff --git a/games/minimal/mods/default/textures/default_lava_flowing_animated.png b/games/minimal/mods/default/textures/default_lava_flowing_animated.png index cef8e3611..0bbd13606 100644 Binary files a/games/minimal/mods/default/textures/default_lava_flowing_animated.png and b/games/minimal/mods/default/textures/default_lava_flowing_animated.png differ diff --git a/games/minimal/mods/default/textures/default_lava_source_animated.png b/games/minimal/mods/default/textures/default_lava_source_animated.png index 9339a684e..aa9d57cf1 100644 Binary files a/games/minimal/mods/default/textures/default_lava_source_animated.png and b/games/minimal/mods/default/textures/default_lava_source_animated.png differ diff --git a/games/minimal/mods/default/textures/default_leaves.png b/games/minimal/mods/default/textures/default_leaves.png index 7a25126e9..00ce4471c 100644 Binary files a/games/minimal/mods/default/textures/default_leaves.png and b/games/minimal/mods/default/textures/default_leaves.png differ diff --git a/games/minimal/mods/default/textures/default_mese.png b/games/minimal/mods/default/textures/default_mese.png index 4c876cdc5..123f0f4b9 100644 Binary files a/games/minimal/mods/default/textures/default_mese.png and b/games/minimal/mods/default/textures/default_mese.png differ diff --git a/games/minimal/mods/default/textures/default_mineral_coal.png b/games/minimal/mods/default/textures/default_mineral_coal.png index 3ff9692fb..0f52062af 100644 Binary files a/games/minimal/mods/default/textures/default_mineral_coal.png and b/games/minimal/mods/default/textures/default_mineral_coal.png differ diff --git a/games/minimal/mods/default/textures/default_mineral_iron.png b/games/minimal/mods/default/textures/default_mineral_iron.png index 51b15d95d..6c894ce1c 100644 Binary files a/games/minimal/mods/default/textures/default_mineral_iron.png and b/games/minimal/mods/default/textures/default_mineral_iron.png differ diff --git a/games/minimal/mods/default/textures/default_mossycobble.png b/games/minimal/mods/default/textures/default_mossycobble.png index fad1b33ff..5082953a6 100644 Binary files a/games/minimal/mods/default/textures/default_mossycobble.png and b/games/minimal/mods/default/textures/default_mossycobble.png differ diff --git a/games/minimal/mods/default/textures/default_nc_back.png b/games/minimal/mods/default/textures/default_nc_back.png index febd7384a..e479ace83 100644 Binary files a/games/minimal/mods/default/textures/default_nc_back.png and b/games/minimal/mods/default/textures/default_nc_back.png differ diff --git a/games/minimal/mods/default/textures/default_nc_front.png b/games/minimal/mods/default/textures/default_nc_front.png index 53b02d174..c9dd6a330 100644 Binary files a/games/minimal/mods/default/textures/default_nc_front.png and b/games/minimal/mods/default/textures/default_nc_front.png differ diff --git a/games/minimal/mods/default/textures/default_nc_rb.png b/games/minimal/mods/default/textures/default_nc_rb.png index 7183e6986..685a22ccf 100644 Binary files a/games/minimal/mods/default/textures/default_nc_rb.png and b/games/minimal/mods/default/textures/default_nc_rb.png differ diff --git a/games/minimal/mods/default/textures/default_nc_side.png b/games/minimal/mods/default/textures/default_nc_side.png index 0a34c8bef..bc85427ae 100644 Binary files a/games/minimal/mods/default/textures/default_nc_side.png and b/games/minimal/mods/default/textures/default_nc_side.png differ diff --git a/games/minimal/mods/default/textures/default_paper.png b/games/minimal/mods/default/textures/default_paper.png index ae5c06bc6..3c31f77c2 100644 Binary files a/games/minimal/mods/default/textures/default_paper.png and b/games/minimal/mods/default/textures/default_paper.png differ diff --git a/games/minimal/mods/default/textures/default_papyrus.png b/games/minimal/mods/default/textures/default_papyrus.png index bf0dec7fe..3707e4081 100644 Binary files a/games/minimal/mods/default/textures/default_papyrus.png and b/games/minimal/mods/default/textures/default_papyrus.png differ diff --git a/games/minimal/mods/default/textures/default_rail.png b/games/minimal/mods/default/textures/default_rail.png index 18176d9f3..777e10c00 100644 Binary files a/games/minimal/mods/default/textures/default_rail.png and b/games/minimal/mods/default/textures/default_rail.png differ diff --git a/games/minimal/mods/default/textures/default_rail_crossing.png b/games/minimal/mods/default/textures/default_rail_crossing.png index 984640577..a988c4740 100644 Binary files a/games/minimal/mods/default/textures/default_rail_crossing.png and b/games/minimal/mods/default/textures/default_rail_crossing.png differ diff --git a/games/minimal/mods/default/textures/default_rail_curved.png b/games/minimal/mods/default/textures/default_rail_curved.png index 62afa3d2b..f87e826c9 100644 Binary files a/games/minimal/mods/default/textures/default_rail_curved.png and b/games/minimal/mods/default/textures/default_rail_curved.png differ diff --git a/games/minimal/mods/default/textures/default_rail_t_junction.png b/games/minimal/mods/default/textures/default_rail_t_junction.png index 9985f63cd..fd25b5ba6 100644 Binary files a/games/minimal/mods/default/textures/default_rail_t_junction.png and b/games/minimal/mods/default/textures/default_rail_t_junction.png differ diff --git a/games/minimal/mods/default/textures/default_sand.png b/games/minimal/mods/default/textures/default_sand.png index 15101a7eb..1a56cc737 100644 Binary files a/games/minimal/mods/default/textures/default_sand.png and b/games/minimal/mods/default/textures/default_sand.png differ diff --git a/games/minimal/mods/default/textures/default_sandstone.png b/games/minimal/mods/default/textures/default_sandstone.png index c4759b4d0..bd9cb8692 100644 Binary files a/games/minimal/mods/default/textures/default_sandstone.png and b/games/minimal/mods/default/textures/default_sandstone.png differ diff --git a/games/minimal/mods/default/textures/default_sapling.png b/games/minimal/mods/default/textures/default_sapling.png index 73f502306..93602322c 100644 Binary files a/games/minimal/mods/default/textures/default_sapling.png and b/games/minimal/mods/default/textures/default_sapling.png differ diff --git a/games/minimal/mods/default/textures/default_scorched_stuff.png b/games/minimal/mods/default/textures/default_scorched_stuff.png index 9ced2fbe8..c7efc7e58 100644 Binary files a/games/minimal/mods/default/textures/default_scorched_stuff.png and b/games/minimal/mods/default/textures/default_scorched_stuff.png differ diff --git a/games/minimal/mods/default/textures/default_sign_wall.png b/games/minimal/mods/default/textures/default_sign_wall.png index 06eac1ee9..93c075a2d 100644 Binary files a/games/minimal/mods/default/textures/default_sign_wall.png and b/games/minimal/mods/default/textures/default_sign_wall.png differ diff --git a/games/minimal/mods/default/textures/default_steel_block.png b/games/minimal/mods/default/textures/default_steel_block.png index 8e2020081..9c0a0e248 100644 Binary files a/games/minimal/mods/default/textures/default_steel_block.png and b/games/minimal/mods/default/textures/default_steel_block.png differ diff --git a/games/minimal/mods/default/textures/default_steel_ingot.png b/games/minimal/mods/default/textures/default_steel_ingot.png index f6c9414e7..ad133bc12 100644 Binary files a/games/minimal/mods/default/textures/default_steel_ingot.png and b/games/minimal/mods/default/textures/default_steel_ingot.png differ diff --git a/games/minimal/mods/default/textures/default_stick.png b/games/minimal/mods/default/textures/default_stick.png index 2d31797f0..055a6ac04 100644 Binary files a/games/minimal/mods/default/textures/default_stick.png and b/games/minimal/mods/default/textures/default_stick.png differ diff --git a/games/minimal/mods/default/textures/default_stone.png b/games/minimal/mods/default/textures/default_stone.png index cad0dbe2b..a835fe002 100644 Binary files a/games/minimal/mods/default/textures/default_stone.png and b/games/minimal/mods/default/textures/default_stone.png differ diff --git a/games/minimal/mods/default/textures/default_tnt_bottom.png b/games/minimal/mods/default/textures/default_tnt_bottom.png index 8ba2fca0b..4eda0603f 100644 Binary files a/games/minimal/mods/default/textures/default_tnt_bottom.png and b/games/minimal/mods/default/textures/default_tnt_bottom.png differ diff --git a/games/minimal/mods/default/textures/default_tnt_side.png b/games/minimal/mods/default/textures/default_tnt_side.png index d9a2bc4eb..c259726d6 100644 Binary files a/games/minimal/mods/default/textures/default_tnt_side.png and b/games/minimal/mods/default/textures/default_tnt_side.png differ diff --git a/games/minimal/mods/default/textures/default_tnt_top.png b/games/minimal/mods/default/textures/default_tnt_top.png index a84ffc9af..a031a34ad 100644 Binary files a/games/minimal/mods/default/textures/default_tnt_top.png and b/games/minimal/mods/default/textures/default_tnt_top.png differ diff --git a/games/minimal/mods/default/textures/default_tool_mesepick.png b/games/minimal/mods/default/textures/default_tool_mesepick.png index a1f3812e0..2b5e12cdb 100644 Binary files a/games/minimal/mods/default/textures/default_tool_mesepick.png and b/games/minimal/mods/default/textures/default_tool_mesepick.png differ diff --git a/games/minimal/mods/default/textures/default_tool_steelaxe.png b/games/minimal/mods/default/textures/default_tool_steelaxe.png index 0ad23c93b..fae19dd0d 100644 Binary files a/games/minimal/mods/default/textures/default_tool_steelaxe.png and b/games/minimal/mods/default/textures/default_tool_steelaxe.png differ diff --git a/games/minimal/mods/default/textures/default_tool_steelpick.png b/games/minimal/mods/default/textures/default_tool_steelpick.png index 7982dafeb..3a8f58643 100644 Binary files a/games/minimal/mods/default/textures/default_tool_steelpick.png and b/games/minimal/mods/default/textures/default_tool_steelpick.png differ diff --git a/games/minimal/mods/default/textures/default_tool_steelshovel.png b/games/minimal/mods/default/textures/default_tool_steelshovel.png index ed8413846..d5b1bc6bc 100644 Binary files a/games/minimal/mods/default/textures/default_tool_steelshovel.png and b/games/minimal/mods/default/textures/default_tool_steelshovel.png differ diff --git a/games/minimal/mods/default/textures/default_tool_steelsword.png b/games/minimal/mods/default/textures/default_tool_steelsword.png index a74581238..efc61a0d1 100644 Binary files a/games/minimal/mods/default/textures/default_tool_steelsword.png and b/games/minimal/mods/default/textures/default_tool_steelsword.png differ diff --git a/games/minimal/mods/default/textures/default_tool_stoneaxe.png b/games/minimal/mods/default/textures/default_tool_stoneaxe.png index 698ac918f..532e16fbc 100644 Binary files a/games/minimal/mods/default/textures/default_tool_stoneaxe.png and b/games/minimal/mods/default/textures/default_tool_stoneaxe.png differ diff --git a/games/minimal/mods/default/textures/default_tool_stonepick.png b/games/minimal/mods/default/textures/default_tool_stonepick.png index b34de6f32..d9156ee3a 100644 Binary files a/games/minimal/mods/default/textures/default_tool_stonepick.png and b/games/minimal/mods/default/textures/default_tool_stonepick.png differ diff --git a/games/minimal/mods/default/textures/default_tool_stoneshovel.png b/games/minimal/mods/default/textures/default_tool_stoneshovel.png index ba5243101..7bbd2d407 100644 Binary files a/games/minimal/mods/default/textures/default_tool_stoneshovel.png and b/games/minimal/mods/default/textures/default_tool_stoneshovel.png differ diff --git a/games/minimal/mods/default/textures/default_tool_stonesword.png b/games/minimal/mods/default/textures/default_tool_stonesword.png index 8f8191f92..533b8734f 100644 Binary files a/games/minimal/mods/default/textures/default_tool_stonesword.png and b/games/minimal/mods/default/textures/default_tool_stonesword.png differ diff --git a/games/minimal/mods/default/textures/default_tool_woodaxe.png b/games/minimal/mods/default/textures/default_tool_woodaxe.png index 3daa4af72..6e70f4a21 100644 Binary files a/games/minimal/mods/default/textures/default_tool_woodaxe.png and b/games/minimal/mods/default/textures/default_tool_woodaxe.png differ diff --git a/games/minimal/mods/default/textures/default_tool_woodpick.png b/games/minimal/mods/default/textures/default_tool_woodpick.png index ea728cca3..15c61f408 100644 Binary files a/games/minimal/mods/default/textures/default_tool_woodpick.png and b/games/minimal/mods/default/textures/default_tool_woodpick.png differ diff --git a/games/minimal/mods/default/textures/default_tool_woodshovel.png b/games/minimal/mods/default/textures/default_tool_woodshovel.png index 649ab4c38..e0b3608db 100644 Binary files a/games/minimal/mods/default/textures/default_tool_woodshovel.png and b/games/minimal/mods/default/textures/default_tool_woodshovel.png differ diff --git a/games/minimal/mods/default/textures/default_tool_woodsword.png b/games/minimal/mods/default/textures/default_tool_woodsword.png index d6c6be325..8099af139 100644 Binary files a/games/minimal/mods/default/textures/default_tool_woodsword.png and b/games/minimal/mods/default/textures/default_tool_woodsword.png differ diff --git a/games/minimal/mods/default/textures/default_torch.png b/games/minimal/mods/default/textures/default_torch.png index 7a953c222..21d98bdbb 100644 Binary files a/games/minimal/mods/default/textures/default_torch.png and b/games/minimal/mods/default/textures/default_torch.png differ diff --git a/games/minimal/mods/default/textures/default_torch_on_ceiling.png b/games/minimal/mods/default/textures/default_torch_on_ceiling.png index 6965d380e..dccd380b2 100644 Binary files a/games/minimal/mods/default/textures/default_torch_on_ceiling.png and b/games/minimal/mods/default/textures/default_torch_on_ceiling.png differ diff --git a/games/minimal/mods/default/textures/default_torch_on_floor.png b/games/minimal/mods/default/textures/default_torch_on_floor.png index 76d1dd5ac..c22010750 100644 Binary files a/games/minimal/mods/default/textures/default_torch_on_floor.png and b/games/minimal/mods/default/textures/default_torch_on_floor.png differ diff --git a/games/minimal/mods/default/textures/default_tree_top.png b/games/minimal/mods/default/textures/default_tree_top.png index 2cdd94f80..3e6bd5262 100644 Binary files a/games/minimal/mods/default/textures/default_tree_top.png and b/games/minimal/mods/default/textures/default_tree_top.png differ diff --git a/games/minimal/mods/default/textures/default_water.png b/games/minimal/mods/default/textures/default_water.png index e5f8cdc25..3e385ae8b 100644 Binary files a/games/minimal/mods/default/textures/default_water.png and b/games/minimal/mods/default/textures/default_water.png differ diff --git a/games/minimal/mods/default/textures/heart.png b/games/minimal/mods/default/textures/heart.png index 6bc183e04..c25f43b9a 100644 Binary files a/games/minimal/mods/default/textures/heart.png and b/games/minimal/mods/default/textures/heart.png differ diff --git a/games/minimal/mods/default/textures/player.png b/games/minimal/mods/default/textures/player.png index 90adf9747..cf5d83f10 100644 Binary files a/games/minimal/mods/default/textures/player.png and b/games/minimal/mods/default/textures/player.png differ diff --git a/games/minimal/mods/default/textures/player_back.png b/games/minimal/mods/default/textures/player_back.png index 530aa7519..d498674eb 100644 Binary files a/games/minimal/mods/default/textures/player_back.png and b/games/minimal/mods/default/textures/player_back.png differ diff --git a/games/minimal/mods/default/textures/treeprop.png b/games/minimal/mods/default/textures/treeprop.png index 77ea4d6d4..eb8a8e6c4 100644 Binary files a/games/minimal/mods/default/textures/treeprop.png and b/games/minimal/mods/default/textures/treeprop.png differ diff --git a/games/minimal/mods/default/textures/wieldhand.png b/games/minimal/mods/default/textures/wieldhand.png index c4549e5ed..dbed6ad0c 100644 Binary files a/games/minimal/mods/default/textures/wieldhand.png and b/games/minimal/mods/default/textures/wieldhand.png differ diff --git a/games/minimal/mods/experimental/textures/experimental_dummyball.png b/games/minimal/mods/experimental/textures/experimental_dummyball.png index 084676552..256414f46 100644 Binary files a/games/minimal/mods/experimental/textures/experimental_dummyball.png and b/games/minimal/mods/experimental/textures/experimental_dummyball.png differ diff --git a/games/minimal/mods/experimental/textures/experimental_tester_tool_1.png b/games/minimal/mods/experimental/textures/experimental_tester_tool_1.png index 8b5bc0b41..587923c86 100644 Binary files a/games/minimal/mods/experimental/textures/experimental_tester_tool_1.png and b/games/minimal/mods/experimental/textures/experimental_tester_tool_1.png differ diff --git a/games/minimal/mods/legacy/textures/apple_iron.png b/games/minimal/mods/legacy/textures/apple_iron.png index 2dffdf014..db5945856 100644 Binary files a/games/minimal/mods/legacy/textures/apple_iron.png and b/games/minimal/mods/legacy/textures/apple_iron.png differ diff --git a/games/minimal/mods/legacy/textures/cooked_rat.png b/games/minimal/mods/legacy/textures/cooked_rat.png index daad3be0d..776dc4ee0 100644 Binary files a/games/minimal/mods/legacy/textures/cooked_rat.png and b/games/minimal/mods/legacy/textures/cooked_rat.png differ diff --git a/games/minimal/mods/legacy/textures/dungeon_master.png b/games/minimal/mods/legacy/textures/dungeon_master.png index 3457c8228..d52d8ccd7 100644 Binary files a/games/minimal/mods/legacy/textures/dungeon_master.png and b/games/minimal/mods/legacy/textures/dungeon_master.png differ diff --git a/games/minimal/mods/legacy/textures/fireball.png b/games/minimal/mods/legacy/textures/fireball.png index 523142850..124469ce4 100644 Binary files a/games/minimal/mods/legacy/textures/fireball.png and b/games/minimal/mods/legacy/textures/fireball.png differ diff --git a/games/minimal/mods/legacy/textures/firefly.png b/games/minimal/mods/legacy/textures/firefly.png index 40df7fa1c..ea95a6a84 100644 Binary files a/games/minimal/mods/legacy/textures/firefly.png and b/games/minimal/mods/legacy/textures/firefly.png differ diff --git a/games/minimal/mods/legacy/textures/oerkki1.png b/games/minimal/mods/legacy/textures/oerkki1.png index 33cbac9e7..061709c80 100644 Binary files a/games/minimal/mods/legacy/textures/oerkki1.png and b/games/minimal/mods/legacy/textures/oerkki1.png differ diff --git a/games/minimal/mods/legacy/textures/oerkki1_damaged.png b/games/minimal/mods/legacy/textures/oerkki1_damaged.png index 9b777387c..b2a30337e 100644 Binary files a/games/minimal/mods/legacy/textures/oerkki1_damaged.png and b/games/minimal/mods/legacy/textures/oerkki1_damaged.png differ diff --git a/games/minimal/mods/legacy/textures/rat.png b/games/minimal/mods/legacy/textures/rat.png index d1a0e2ae2..04cf9b865 100644 Binary files a/games/minimal/mods/legacy/textures/rat.png and b/games/minimal/mods/legacy/textures/rat.png differ diff --git a/misc/minetest-icon-24x24.png b/misc/minetest-icon-24x24.png index 4d587c410..334e2f6d6 100644 Binary files a/misc/minetest-icon-24x24.png and b/misc/minetest-icon-24x24.png differ diff --git a/textures/base/pack/fontdejavusansmono.png b/textures/base/pack/fontdejavusansmono.png index 416a74f8a..02ad41352 100644 Binary files a/textures/base/pack/fontdejavusansmono.png and b/textures/base/pack/fontdejavusansmono.png differ diff --git a/textures/base/pack/fontlucida.png b/textures/base/pack/fontlucida.png index c63fa02b7..ab7bb70b8 100644 Binary files a/textures/base/pack/fontlucida.png and b/textures/base/pack/fontlucida.png differ diff --git a/textures/base/pack/logo.png b/textures/base/pack/logo.png index f341e8892..89be884a2 100644 Binary files a/textures/base/pack/logo.png and b/textures/base/pack/logo.png differ diff --git a/textures/base/pack/menu_header.png b/textures/base/pack/menu_header.png index c22192d0f..abf24038e 100644 Binary files a/textures/base/pack/menu_header.png and b/textures/base/pack/menu_header.png differ diff --git a/textures/base/pack/smoke_puff.png b/textures/base/pack/smoke_puff.png index e346d204c..e0f038f0a 100644 Binary files a/textures/base/pack/smoke_puff.png and b/textures/base/pack/smoke_puff.png differ diff --git a/textures/base/pack/sunrisebg.png b/textures/base/pack/sunrisebg.png index d8b010ebb..1d03dd3c3 100644 Binary files a/textures/base/pack/sunrisebg.png and b/textures/base/pack/sunrisebg.png differ diff --git a/textures/base/pack/unknown_item.png b/textures/base/pack/unknown_item.png index 35cabf0ad..27a3450eb 100644 Binary files a/textures/base/pack/unknown_item.png and b/textures/base/pack/unknown_item.png differ diff --git a/textures/base/pack/unknown_node.png b/textures/base/pack/unknown_node.png index 9cae26d5c..cb59ff467 100644 Binary files a/textures/base/pack/unknown_node.png and b/textures/base/pack/unknown_node.png differ diff --git a/textures/base/pack/unknown_object.png b/textures/base/pack/unknown_object.png index 4d6a98d56..c0166c31f 100644 Binary files a/textures/base/pack/unknown_object.png and b/textures/base/pack/unknown_object.png differ -- cgit v1.2.3 From e65ac4d626f69656c57c07e4df1a1113a014f34a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20Mart=C3=ADnez?= Date: Sun, 16 Jun 2013 03:06:41 -0300 Subject: Restore old output format of dump() --- builtin/misc_helpers.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/builtin/misc_helpers.lua b/builtin/misc_helpers.lua index 526be0492..743a9cfd3 100644 --- a/builtin/misc_helpers.lua +++ b/builtin/misc_helpers.lua @@ -57,7 +57,7 @@ function dump(o, dumped) dumped[o] = true local t = {} for k,v in pairs(o) do - t[#t+1] = "" .. dump(k, dumped) .. " = " .. dump(v, dumped) + t[#t+1] = "[" .. dump(k, dumped) .. "] = " .. dump(v, dumped) end return "{" .. table.concat(t, ", ") .. "}" elseif type(o) == "boolean" then -- cgit v1.2.3 From 53066024f6a91d5f83241b379b94d8557d43a646 Mon Sep 17 00:00:00 2001 From: PilzAdam Date: Wed, 19 Jun 2013 14:30:22 +0000 Subject: Add drowning --- doc/lua_api.txt | 1 + games/minimal/mods/default/textures/bubble.png | Bin 0 -> 273 bytes src/client.cpp | 7 +++++ src/client.h | 1 + src/environment.cpp | 40 ++++++++++++++++++++++++- src/environment.h | 2 ++ src/game.cpp | 2 +- src/hud.cpp | 5 +++- src/hud.h | 3 +- src/nodedef.cpp | 3 ++ src/nodedef.h | 1 + src/player.cpp | 4 ++- src/player.h | 1 + src/script/common/c_content.cpp | 1 + src/script/lua_api/l_object.cpp | 1 + 15 files changed, 67 insertions(+), 5 deletions(-) create mode 100644 games/minimal/mods/default/textures/bubble.png diff --git a/doc/lua_api.txt b/doc/lua_api.txt index 85f6ca5a6..d3d427d69 100644 --- a/doc/lua_api.txt +++ b/doc/lua_api.txt @@ -1710,6 +1710,7 @@ Node definition (register_node) liquid_alternative_source = "", -- Source version of flowing liquid liquid_viscosity = 0, -- Higher viscosity = slower flow (max. 7) liquid_renewable = true, -- Can new liquid source be created by placing + drowning = true, -- Player will drown in these two or more sources nearly? light_source = 0, -- Amount of light emitted by node damage_per_second = 0, -- If player is inside node, this damage is caused diff --git a/games/minimal/mods/default/textures/bubble.png b/games/minimal/mods/default/textures/bubble.png new file mode 100644 index 000000000..3bca7e11c Binary files /dev/null and b/games/minimal/mods/default/textures/bubble.png differ diff --git a/src/client.cpp b/src/client.cpp index 6b1789fe0..5f53e14f7 100644 --- a/src/client.cpp +++ b/src/client.cpp @@ -2680,6 +2680,13 @@ u16 Client::getHP() return player->hp; } +u16 Client::getBreath() +{ + Player *player = m_env.getLocalPlayer(); + assert(player != NULL); + return player->breath; +} + bool Client::getChatMessage(std::wstring &message) { if(m_chat_queue.size() == 0) diff --git a/src/client.h b/src/client.h index f0cc55868..1d231a5a3 100644 --- a/src/client.h +++ b/src/client.h @@ -349,6 +349,7 @@ public: void setCrack(int level, v3s16 pos); u16 getHP(); + u16 getBreath(); bool checkPrivilege(const std::string &priv) { return (m_privileges.count(priv) != 0); } diff --git a/src/environment.cpp b/src/environment.cpp index a97a9bd08..99da5190c 100644 --- a/src/environment.cpp +++ b/src/environment.cpp @@ -2227,7 +2227,45 @@ void ClientEnvironment::step(float dtime) damageLocalPlayer(damage_per_second, true); } } - + + /* + Drowning + */ + if(m_drowning_interval.step(dtime, 2.0)) + { + v3f pf = lplayer->getPosition(); + + // head + v3s16 p = floatToInt(pf + v3f(0, BS*1.6, 0), BS); + MapNode n = m_map->getNodeNoEx(p); + ContentFeatures c = m_gamedef->ndef()->get(n); + + if(c.isLiquid() && c.drowning){ + if(lplayer->breath > 10) + lplayer->breath = 11; + if(lplayer->breath > 0) + lplayer->breath -= 1; + } + + if(lplayer->breath == 0){ + damageLocalPlayer(1, true); + } + } + if(m_breathing_interval.step(dtime, 0.5)) + { + v3f pf = lplayer->getPosition(); + + // head + v3s16 p = floatToInt(pf + v3f(0, BS*1.6, 0), BS); + MapNode n = m_map->getNodeNoEx(p); + ContentFeatures c = m_gamedef->ndef()->get(n); + + if(!c.isLiquid() || !c.drowning){ + if(lplayer->breath <= 10) + lplayer->breath += 1; + } + } + /* Stuff that can be done in an arbitarily large dtime */ diff --git a/src/environment.h b/src/environment.h index a62173a11..ac479999c 100644 --- a/src/environment.h +++ b/src/environment.h @@ -494,6 +494,8 @@ private: Queue m_client_event_queue; IntervalLimiter m_active_object_light_update_interval; IntervalLimiter m_lava_hurt_interval; + IntervalLimiter m_drowning_interval; + IntervalLimiter m_breathing_interval; std::list m_player_names; }; diff --git a/src/game.cpp b/src/game.cpp index 30d9c7faf..88be47b39 100644 --- a/src/game.cpp +++ b/src/game.cpp @@ -3310,7 +3310,7 @@ void the_game( if (show_hud) { hud.drawHotbar(v2s32(displaycenter.X, screensize.Y), - client.getHP(), client.getPlayerItem()); + client.getHP(), client.getPlayerItem(), client.getBreath()); } /* diff --git a/src/hud.cpp b/src/hud.cpp index a3ae38bcb..9404ed997 100644 --- a/src/hud.cpp +++ b/src/hud.cpp @@ -278,7 +278,7 @@ void Hud::drawStatbar(v2s32 pos, u16 corner, u16 drawdir, std::string texture, s } -void Hud::drawHotbar(v2s32 centerlowerpos, s32 halfheartcount, u16 playeritem) { +void Hud::drawHotbar(v2s32 centerlowerpos, s32 halfheartcount, u16 playeritem, s32 breath) { InventoryList *mainlist = inventory->getList("main"); if (mainlist == NULL) { errorstream << "draw_hotbar(): mainlist == NULL" << std::endl; @@ -295,6 +295,9 @@ void Hud::drawHotbar(v2s32 centerlowerpos, s32 halfheartcount, u16 playeritem) { if (player->hud_flags & HUD_FLAG_HEALTHBAR_VISIBLE) drawStatbar(pos - v2s32(0, 4), HUD_CORNER_LOWER, HUD_DIR_LEFT_RIGHT, "heart.png", halfheartcount, v2s32(0, 0)); + if (player->hud_flags & HUD_FLAG_BREATHBAR_VISIBLE && breath <= 10) + drawStatbar(pos - v2s32(-180, 4), HUD_CORNER_LOWER, HUD_DIR_LEFT_RIGHT, + "bubble.png", breath*2, v2s32(0, 0)); } diff --git a/src/hud.h b/src/hud.h index fa9d33f8b..c7289f7c4 100644 --- a/src/hud.h +++ b/src/hud.h @@ -35,6 +35,7 @@ with this program; if not, write to the Free Software Foundation, Inc., #define HUD_FLAG_HEALTHBAR_VISIBLE (1 << 1) #define HUD_FLAG_CROSSHAIR_VISIBLE (1 << 2) #define HUD_FLAG_WIELDITEM_VISIBLE (1 << 3) +#define HUD_FLAG_BREATHBAR_VISIBLE (1 << 4) #define HUD_PARAM_HOTBAR_ITEMCOUNT 1 @@ -122,7 +123,7 @@ public: void drawStatbar(v2s32 pos, u16 corner, u16 drawdir, std::string texture, s32 count, v2s32 offset); - void drawHotbar(v2s32 centerlowerpos, s32 halfheartcount, u16 playeritem); + void drawHotbar(v2s32 centerlowerpos, s32 halfheartcount, u16 playeritem, s32 breath); void resizeHotbar(); void drawCrosshair(); diff --git a/src/nodedef.cpp b/src/nodedef.cpp index ba3e42e98..7d8ce70d3 100644 --- a/src/nodedef.cpp +++ b/src/nodedef.cpp @@ -211,6 +211,7 @@ void ContentFeatures::reset() liquid_alternative_source = ""; liquid_viscosity = 0; liquid_renewable = true; + drowning = true; light_source = 0; damage_per_second = 0; node_box = NodeBox(); @@ -279,6 +280,7 @@ void ContentFeatures::serialize(std::ostream &os, u16 protocol_version) writeU8(os, rightclickable); // Stuff below should be moved to correct place in a version that otherwise changes // the protocol version + writeU8(os, drowning); } void ContentFeatures::deSerialize(std::istream &is) @@ -343,6 +345,7 @@ void ContentFeatures::deSerialize(std::istream &is) try{ // Stuff below should be moved to correct place in a version that // otherwise changes the protocol version + drowning = readU8(is); }catch(SerializationError &e) {}; } diff --git a/src/nodedef.h b/src/nodedef.h index 2691aca33..e397d20e0 100644 --- a/src/nodedef.h +++ b/src/nodedef.h @@ -219,6 +219,7 @@ struct ContentFeatures u8 liquid_viscosity; // Is liquid renewable (new liquid source will be created between 2 existing) bool liquid_renewable; + bool drowning; // Amount of light the node emits u8 light_source; u32 damage_per_second; diff --git a/src/player.cpp b/src/player.cpp index 4eb5955c0..a199c9a6c 100644 --- a/src/player.cpp +++ b/src/player.cpp @@ -36,6 +36,7 @@ Player::Player(IGameDef *gamedef): camera_barely_in_ceiling(false), inventory(gamedef->idef()), hp(PLAYER_MAX_HP), + breath(-1), peer_id(PEER_ID_INEXISTENT), // protected m_gamedef(gamedef), @@ -80,7 +81,8 @@ Player::Player(IGameDef *gamedef): physics_override_gravity = 1; hud_flags = HUD_FLAG_HOTBAR_VISIBLE | HUD_FLAG_HEALTHBAR_VISIBLE | - HUD_FLAG_CROSSHAIR_VISIBLE | HUD_FLAG_WIELDITEM_VISIBLE; + HUD_FLAG_CROSSHAIR_VISIBLE | HUD_FLAG_WIELDITEM_VISIBLE | + HUD_FLAG_BREATHBAR_VISIBLE; hud_hotbar_itemcount = HUD_HOTBAR_ITEMCOUNT_DEFAULT; } diff --git a/src/player.h b/src/player.h index d3738fd52..517bd354d 100644 --- a/src/player.h +++ b/src/player.h @@ -232,6 +232,7 @@ public: float physics_override_gravity; u16 hp; + u16 breath; float hurt_tilt_timer; float hurt_tilt_strength; diff --git a/src/script/common/c_content.cpp b/src/script/common/c_content.cpp index c7966a0be..64c76ef7c 100644 --- a/src/script/common/c_content.cpp +++ b/src/script/common/c_content.cpp @@ -389,6 +389,7 @@ ContentFeatures read_content_features(lua_State *L, int index) f.liquid_viscosity = getintfield_default(L, index, "liquid_viscosity", f.liquid_viscosity); getboolfield(L, index, "liquid_renewable", f.liquid_renewable); + getboolfield(L, index, "drowning", f.drowning); // Amount of light the node emits f.light_source = getintfield_default(L, index, "light_source", f.light_source); diff --git a/src/script/lua_api/l_object.cpp b/src/script/lua_api/l_object.cpp index 1e45610a6..f90b59285 100644 --- a/src/script/lua_api/l_object.cpp +++ b/src/script/lua_api/l_object.cpp @@ -62,6 +62,7 @@ struct EnumString es_HudBuiltinElement[] = {HUD_FLAG_HEALTHBAR_VISIBLE, "healthbar"}, {HUD_FLAG_CROSSHAIR_VISIBLE, "crosshair"}, {HUD_FLAG_WIELDITEM_VISIBLE, "wielditem"}, + {HUD_FLAG_BREATHBAR_VISIBLE, "breathbar"}, {0, NULL}, }; -- cgit v1.2.3 From 9b6f1d647c612bddbc994357b9e9fc8348868234 Mon Sep 17 00:00:00 2001 From: PilzAdam Date: Wed, 19 Jun 2013 21:00:14 +0000 Subject: Dont dig or place nodes if interact priv is missing (clientside) --- src/game.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/game.cpp b/src/game.cpp index 88be47b39..f00e4c949 100644 --- a/src/game.cpp +++ b/src/game.cpp @@ -2589,7 +2589,8 @@ void the_game( Handle digging */ - if(nodig_delay_timer <= 0.0 && input->getLeftState()) + if(nodig_delay_timer <= 0.0 && input->getLeftState() + && client.checkPrivilege("interact")) { if(!digging) { @@ -2716,8 +2717,10 @@ void the_game( camera.setDigging(0); // left click animation } - if(input->getRightClicked() || - repeat_rightclick_timer >= g_settings->getFloat("repeat_rightclick_time")) + if((input->getRightClicked() || + repeat_rightclick_timer >= + g_settings->getFloat("repeat_rightclick_time")) && + client.checkPrivilege("interact")) { repeat_rightclick_timer = 0; infostream<<"Ground right-clicked"< Date: Wed, 19 Jun 2013 21:09:18 +0000 Subject: Play placing sound only if place prediction was successful --- src/game.cpp | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/src/game.cpp b/src/game.cpp index f00e4c949..833117959 100644 --- a/src/game.cpp +++ b/src/game.cpp @@ -834,7 +834,7 @@ public: } }; -void nodePlacementPrediction(Client &client, +bool nodePlacementPrediction(Client &client, const ItemDefinition &playeritem_def, v3s16 nodepos, v3s16 neighbourpos) { @@ -854,7 +854,7 @@ void nodePlacementPrediction(Client &client, if(nodedef->get(n_under).buildable_to) p = nodepos; else if (!nodedef->get(map.getNode(p)).buildable_to) - return; + return false; }catch(InvalidPositionException &e){} // Find id of predicted node content_t id; @@ -864,7 +864,7 @@ void nodePlacementPrediction(Client &client, <get(map.getNode(pp)).walkable) - return; + return false; } // Add node to client map MapNode n(id, 0, param2); try{ // This triggers the required mesh update too client.addNode(p, n); + return true; }catch(InvalidPositionException &e){ errorstream<<"Node placement prediction failed for " < Date: Thu, 20 Jun 2013 07:52:04 +0200 Subject: Remove deprecated functions that don't work anymore from lua_api.txt --- doc/lua_api.txt | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/doc/lua_api.txt b/doc/lua_api.txt index d3d427d69..a19174548 100644 --- a/doc/lua_api.txt +++ b/doc/lua_api.txt @@ -1018,7 +1018,6 @@ minetest.setting_get(name) -> string or nil minetest.setting_getbool(name) -> boolean value or nil minetest.setting_get_pos(name) -> position or nil minetest.setting_save() -> nil, save all settings to config file -minetest.add_to_creative_inventory(itemstring) Authentication: minetest.notify_authentication_modified(name) @@ -1293,15 +1292,6 @@ minetest.object_refs minetest.luaentities ^ List of lua entities, indexed by active object id -Deprecated but defined for backwards compatibility: -minetest.digprop_constanttime(time) -minetest.digprop_stonelike(toughness) -minetest.digprop_dirtlike(toughness) -minetest.digprop_gravellike(toughness) -minetest.digprop_woodlike(toughness) -minetest.digprop_leaveslike(toughness) -minetest.digprop_glasslike(toughness) - Class reference ---------------- NodeMetaRef: Node metadata - reference extra data and functionality stored -- cgit v1.2.3 From c2cdaceed0d43317d8e8d431052854fe72d8fddf Mon Sep 17 00:00:00 2001 From: Kahrl Date: Fri, 21 Jun 2013 00:04:18 +0200 Subject: Make minetest.debug accept multiple parameters; convert them to string --- src/script/lua_api/luaapi.cpp | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/src/script/lua_api/luaapi.cpp b/src/script/lua_api/luaapi.cpp index 667a3afcf..e19c90952 100644 --- a/src/script/lua_api/luaapi.cpp +++ b/src/script/lua_api/luaapi.cpp @@ -105,13 +105,31 @@ bool ModApiBasic::Initialize(lua_State* L,int top) { return retval; } -// debug(text) +// debug(...) // Writes a line to dstream int ModApiBasic::l_debug(lua_State *L) { NO_MAP_LOCK_REQUIRED; - std::string text = lua_tostring(L, 1); - dstream << text << std::endl; + // Handle multiple parameters to behave like standard lua print() + int n = lua_gettop(L); + lua_getglobal(L, "tostring"); + for(int i = 1; i <= n; i++){ + /* + Call tostring(i-th argument). + This is what print() does, and it behaves a bit + differently from directly calling lua_tostring. + */ + lua_pushvalue(L, -1); /* function to be called */ + lua_pushvalue(L, i); /* value to print */ + lua_call(L, 1, 1); + const char *s = lua_tostring(L, -1); + if(i>1) + dstream << "\t"; + if(s) + dstream << s; + lua_pop(L, 1); + } + dstream << std::endl; return 0; } -- cgit v1.2.3 From b1ebd9f79c63cf78b0e0fb2ea6f52d82cdfb95b6 Mon Sep 17 00:00:00 2001 From: PilzAdam Date: Sat, 8 Jun 2013 23:42:46 +0000 Subject: Add a setting for max loop count per step in liquid update --- minetest.conf.example | 8 +++++++- src/defaultsettings.cpp | 1 + src/map.cpp | 8 ++++++-- 3 files changed, 14 insertions(+), 3 deletions(-) diff --git a/minetest.conf.example b/minetest.conf.example index 4fd443db7..4306740e9 100644 --- a/minetest.conf.example +++ b/minetest.conf.example @@ -93,11 +93,17 @@ #new_style_water = false # Constant volume liquids #liquid_finite = false +# Max liquids processed per step +#liquid_loop_max = 1000 # Update liquids every .. recommend for finite: 0.2 #liquid_update = 1.0 -# When finite liquid: relax flowing blocks to source if level near max and N nearby source blocks, more realistic, but not true constant. values: 0,1,2,3,4 : 0 - disable, 1 - most aggresive +# Relax flowing blocks to source if level near max and N nearby +# source blocks, more realistic, but not true constant. +# values: 0,1,2,3,4 : 0 - disable, 1 - most aggresive +# (for finite liquids) #liquid_relax = 2 # Optimization: faster cave flood (and not true constant) +# (for finite liquids) #liquid_fast_flood = 1 # Underground water and lava springs, its infnity sources if liquid_finite enabled #underground_springs = 1 diff --git a/src/defaultsettings.cpp b/src/defaultsettings.cpp index 71c283241..ffaa7a3c7 100644 --- a/src/defaultsettings.cpp +++ b/src/defaultsettings.cpp @@ -209,6 +209,7 @@ void set_default_settings(Settings *settings) //liquid stuff settings->setDefault("liquid_finite", "false"); + settings->setDefault("liquid_loop_max", "1000"); settings->setDefault("liquid_update", "1.0"); settings->setDefault("liquid_relax", "2"); settings->setDefault("liquid_fast_flood", "1"); diff --git a/src/map.cpp b/src/map.cpp index 7439076d3..001ae1609 100644 --- a/src/map.cpp +++ b/src/map.cpp @@ -1651,10 +1651,12 @@ void Map::transformLiquidsFinite(std::map & modified_blocks) // List of MapBlocks that will require a lighting update (due to lava) std::map lighting_modified_blocks; + u16 loop_max = g_settings->getU16("liquid_loop_max"); + while (m_transforming_liquid.size() > 0) { // This should be done here so that it is done when continue is used - if (loopcount >= initial_size || loopcount >= 1000) + if (loopcount >= initial_size || loopcount >= loop_max) break; loopcount++; /* @@ -1993,10 +1995,12 @@ void Map::transformLiquids(std::map & modified_blocks) // List of MapBlocks that will require a lighting update (due to lava) std::map lighting_modified_blocks; + u16 loop_max = g_settings->getU16("liquid_loop_max"); + while(m_transforming_liquid.size() != 0) { // This should be done here so that it is done when continue is used - if(loopcount >= initial_size || loopcount >= 10000) + if(loopcount >= initial_size || loopcount >= loop_max) break; loopcount++; -- cgit v1.2.3