aboutsummaryrefslogtreecommitdiff
path: root/src/treegen.cpp
Commit message (Collapse)AuthorAge
* L-system: Fix leaves cutting through stemsHybrid Dog2017-08-14
|
* Treegen: Fix s16 overflow warning (#6082)Vincent Glize2017-07-04
|
* Remove SharedPtr, it's not used and will be never used, we use C++11Loic Blot2017-06-05
|
* Fix various variables passed by copy instead of const ref (#5610)Loïc Blot2017-04-19
| | | Pointed by cppcheck
* Light calculation: New bulk node lighting codeDániel Juhász2017-03-11
| | | | | | | | | | | This commit introduces a new bulk node lighting algorithm to minimize lighting bugs during l-system tree generation, schematic placement and non-mapgen-object lua voxelmanip light calculation. If the block above the changed area is not loaded, it gets loaded to avoid lighting bugs. Light is updated as soon as write_to_map is called on a voxel manipulator, therefore update_map does nothing.
* Remove `mathconstants.h` and use the correct way to get `M_PI` in MSVC. (#5072)red-0012017-01-20
|
* Fix MSVC build Build broken by 98e36d7SmallJoker2017-01-19
|
* Move ServerEnvironment to dedicated cpp/header filesLoic Blot2017-01-08
| | | | * also cleanup some unneeded inclusions
* Treegen: Improve use of signed vs. unsigned integersparamat2016-07-12
| | | | | | To fix GCC 6.1.1 compilation warning: 'assuming signed overflow does not occur when assuming that (X - c) > X is always false'
* Change internal type for seeds to s32kwolekr2016-06-04
| | | | | This fixes value truncation (and therefore incompatibility) on platforms with an LP32 data model, such as VAX or MS-DOS.
* Treegen: Rename pine tree mapgen aliasparamat2015-08-10
|
* Mgv6/treegen: (Re)Add fallback nodes for compatibility with subgamesparamat2015-07-13
|
* Minimal: Add snow biome and jungleleaves nodes. Add mapgen aliasesparamat2015-06-12
| | | | Treegen: Remove alias checks from jungletree generation for speed
* Treegen: Add pine tree. Force place trunksparamat2015-04-01
| | | | | | Speed-optimise leaves blits Use MMVManip for make_jungletree Use correct code style
* Shorten ManualMapVoxelManipulator to MMVManipkwolekr2015-01-05
|
* Fix seg fault if popping from empty stack (L-system trees)Craig Robbins2014-08-23
| | | | | | | | | | | | | | | | | | See: https://github.com/minetest/minetest/issues/1525 Background Wuzzy2: If you attempt to spawn a L-system tree with minetest.spawn_tree, you can make Minetest crash if it is attempted to pop an empty stack. ShadowNinja: This shouldn't cause a segmentation fault, but it should throw a Lua error Commit Description This commit throws a Lua error instead of causing a segmentation fault. The server will still "crash" but will include a Lua backtrace. L-Systems fix randomness Unless a random seed is provided (via Lua treedef) seed the PRNG with a different seed for each tree Resolves: https://github.com/minetest/minetest/issues/1469 Fix l-system crash when treedef random_level not set by Lua
* L-systems treegen code tweaks.RealBadAngel2014-06-17
|
* Move the sapling growing and grass adding/removing ABMs to LuaNovatux2013-11-02
|
* Omnicleanup: header cleanup, add ModApiUtil shared between game and mainmenuKahrl2013-08-14
|
* Make saplings only grow on dirt or grass, make jungle tree trunks only ↵kwolekr2013-03-16
| | | | replace air
* Re-add jungles, apple treeskwolekr2013-03-16
|
* Clean up Mapgenkwolekr2013-03-11
|
* Migrate to STL containers/algorithms.Ilya Zhuravlev2013-03-11
|
* Update Copyright YearsSfan52013-02-24
|
* Change Minetest-c55 to MinetestPilzAdam2013-02-24
|
* Add seed parameter for default and L-system treesRealBadAngel2013-02-24
|
* Treegen update. Some new symbols. Speed up code a bit.RealBadAngel2013-01-23
|
* L-Systems treegen update.RealBadAngel2013-01-07
|
* Fixed compile issues on windowsdannydark2012-12-30
| | | | With latest upstream L-Systems treegen.
* L-System treegenRealBadAngel2012-12-30
"hl opt">; m_cloud_params.speed = v2f(0.0f, -2.0f); } void RemotePlayer::serializeExtraAttributes(std::string &output) { assert(m_sao); Json::Value json_root; const StringMap &attrs = m_sao->getMeta().getStrings(); for (const auto &attr : attrs) { json_root[attr.first] = attr.second; } output = fastWriteJson(json_root); } void RemotePlayer::deSerialize(std::istream &is, const std::string &playername, PlayerSAO *sao) { Settings args; if (!args.parseConfigLines(is, "PlayerArgsEnd")) { throw SerializationError("PlayerArgsEnd of player " + playername + " not found!"); } m_dirty = true; //args.getS32("version"); // Version field value not used const std::string &name = args.get("name"); strlcpy(m_name, name.c_str(), PLAYERNAME_SIZE); if (sao) { try { sao->setHPRaw(args.getU16("hp")); } catch(SettingNotFoundException &e) { sao->setHPRaw(PLAYER_MAX_HP_DEFAULT); } try { sao->setBasePosition(args.getV3F("position")); } catch (SettingNotFoundException &e) {} try { sao->setLookPitch(args.getFloat("pitch")); } catch (SettingNotFoundException &e) {} try { sao->setPlayerYaw(args.getFloat("yaw")); } catch (SettingNotFoundException &e) {} try { sao->setBreath(args.getU16("breath"), false); } catch (SettingNotFoundException &e) {} try { const std::string &extended_attributes = args.get("extended_attributes"); std::istringstream iss(extended_attributes); Json::CharReaderBuilder builder; builder.settings_["collectComments"] = false; std::string errs; Json::Value attr_root; Json::parseFromStream(builder, iss, &attr_root, &errs); const Json::Value::Members attr_list = attr_root.getMemberNames(); for (const auto &it : attr_list) { Json::Value attr_value = attr_root[it]; sao->getMeta().setString(it, attr_value.asString()); } sao->getMeta().setModified(false); } catch (SettingNotFoundException &e) {} } try { inventory.deSerialize(is); } catch (SerializationError &e) { errorstream << "Failed to deserialize player inventory. player_name=" << name << " " << e.what() << std::endl; } if (!inventory.getList("craftpreview") && inventory.getList("craftresult")) { // Convert players without craftpreview inventory.addList("craftpreview", 1); bool craftresult_is_preview = true; if(args.exists("craftresult_is_preview")) craftresult_is_preview = args.getBool("craftresult_is_preview"); if(craftresult_is_preview) { // Clear craftresult inventory.getList("craftresult")->changeItem(0, ItemStack()); } } } void RemotePlayer::serialize(std::ostream &os) { // Utilize a Settings object for storing values Settings args; args.setS32("version", 1); args.set("name", m_name); // This should not happen assert(m_sao); args.setU16("hp", m_sao->getHP()); args.setV3F("position", m_sao->getBasePosition()); args.setFloat("pitch", m_sao->getLookPitch()); args.setFloat("yaw", m_sao->getRotation().Y); args.setU16("breath", m_sao->getBreath()); std::string extended_attrs; serializeExtraAttributes(extended_attrs); args.set("extended_attributes", extended_attrs); args.writeLines(os); os<<"PlayerArgsEnd\n"; inventory.serialize(os); } const RemotePlayerChatResult RemotePlayer::canSendChatMessage() { // Rate limit messages u32 now = time(NULL); float time_passed = now - m_last_chat_message_sent; m_last_chat_message_sent = now; // If this feature is disabled if (m_setting_chat_message_limit_per_10sec <= 0.0) { return RPLAYER_CHATRESULT_OK; } m_chat_message_allowance += time_passed * (m_setting_chat_message_limit_per_10sec / 8.0f); if (m_chat_message_allowance > m_setting_chat_message_limit_per_10sec) { m_chat_message_allowance = m_setting_chat_message_limit_per_10sec; } if (m_chat_message_allowance < 1.0f) { infostream << "Player " << m_name << " chat limited due to excessive message amount." << std::endl; // Kick player if flooding is too intensive m_message_rate_overhead++; if (m_message_rate_overhead > RemotePlayer::m_setting_chat_message_limit_trigger_kick) { return RPLAYER_CHATRESULT_KICK; } return RPLAYER_CHATRESULT_FLOODING; } // Reinit message overhead if (m_message_rate_overhead > 0) { m_message_rate_overhead = 0; } m_chat_message_allowance -= 1.0f; return RPLAYER_CHATRESULT_OK; } void RemotePlayer::onSuccessfulSave() { setModified(false); if (m_sao) m_sao->getMeta().setModified(false); }