aboutsummaryrefslogtreecommitdiff
path: root/src
Commit message (Expand)AuthorAge
* F5 debug info: Use full words for NSEW directions for readability (#7461)Paramat2018-10-06
* Player hand list: require init by modsSmallJoker2018-10-04
* Dig particles: Various improvements (#7714)Paramat2018-10-04
* Fix Mapgen Valleys getSpawnLevelAtPoint() (#7756)Treer2018-10-03
* Night clouds: Boost brightness for a moonlit appearence (#7748)Paramat2018-10-01
* Remove settings properly (#7676)SmallJoker2018-09-30
* Software inventorycube (#7651)Vitaliy2018-09-29
* Fix temporary path crash in TestAuthDatabase (#7753)SmallJoker2018-09-28
* Fix stretched stars bug, change render orderAspen2018-09-27
* Fix various code issues found by cppcheck (#7741)Paramat2018-09-23
* Make OpenGL preference configurable, default to LEGACY (#7666)SmallJoker2018-09-22
* Light curve: Simplify and improve code, fix darkened daytime sky (#7693)Vitaliy2018-09-16
* Inv deSerialize(): Prevent infinite loop, error on failure (#7711)SmallJoker2018-09-14
* markAliasDeprecated: Fix MSVC buildSmallJoker2018-09-11
* Particles: Make collision with objects optional (#7682)Paramat2018-09-08
* Damage flash/hurt tilt: Make shorter to reduce player blindness (#7399)Paramat2018-08-29
* Play damage sound on player death (#7679)Paramat2018-08-28
* Change mapgen order to ores > dungeons > decorations (#7656)Paramat2018-08-20
* Formspecs: Fix invalid background warningrubenwardy2018-08-20
* Set OpenGL preference to GLVNDShadowNinja2018-08-18
* Really delete things in fs::RecursiveDelete (#7433)Vitaliy2018-08-18
* Mgv5: Change tunnel parameters to those of other mapgens (#7641)Paramat2018-08-16
* Check node updates whether the blocks are known (#7568)SmallJoker2018-08-16
* Raycast: export exact pointing location (#6304)Dániel Juhász2018-08-16
* Formspecs: Fix missing trim() when checking for no_prepend[]rubenwardy2018-08-15
* Save debug.txt to build dir for RUN_IN_PLACE build (#7615)pauloue2018-08-15
* Some minor Fastface optimizations. (#7628)lhofhansl2018-08-08
* Fix debug and info text being the wrong colorrubenwardy2018-08-05
* Prevent objects from colliding with own child attachments (#7610)SmallJoker2018-08-05
* Formspecs: Add tooltip element for arearubenwardy2018-08-05
* Replace auth.txt with SQLite auth database (#7279)Ben Deutsch2018-08-05
* Fix tooltip colors specified by formspec partrubenwardy2018-08-04
* Fix sky objects not rendering with ogles (#7598)stujones112018-08-04
* guiFormspecMenu: Allow fraction values for container[] (#7497)SmallJoker2018-08-04
* Smoothed yaw rotation for objects (#6825)SmallJoker2018-08-02
* LuaVoxelManip: Throw warning or error instead of silently doing nothing (#7567)HybridDog2018-08-02
* Add protocol_version and supported package types to ContentDB urlsrubenwardy2018-07-29
* Allow enter to select items from combobox's list (#7351)Rob Blanckaert2018-07-28
* Log server shutdown using actionstream (#7589)ClobberXD2018-07-28
* Fix build on gcc 5.0 (#7586)zeuner2018-07-26
* Settings: Fix indents, chat_message_*. Update translations (#7580)SmallJoker2018-07-25
* Allow an optional readonly base database (#7544)lhofhansl2018-07-25
* Add a MSVC / Windows compatible snprintf function (#7353)nOOb31672018-07-22
* Update Android defaults for modern H/W. (#7572)lhofhansl2018-07-22
* Optimize ABM checks.Lars Hofhansl2018-07-21
* CSM: Disallow exploitable clientside mod functions by default (#7547)Paramat2018-07-19
* Mgvalleys: Make river depth variation and humidity drop optional (#7532)Paramat2018-07-18
* Remove legacy client handling code.Lars Hofhansl2018-07-14
* Make player liquid speed independent of FPS (#7543)Paramat2018-07-14
* Adjust some settings to modern environments and networks. (#7549)lhofhansl2018-07-13
ed_jump = g_settings->getFloat("movement_speed_jump") * BS; movement_liquid_fluidity = g_settings->getFloat("movement_liquid_fluidity") * BS; movement_liquid_fluidity_smooth = g_settings->getFloat("movement_liquid_fluidity_smooth") * BS; movement_liquid_sink = g_settings->getFloat("movement_liquid_sink") * BS; movement_gravity = g_settings->getFloat("movement_gravity") * BS; // copy defaults m_cloud_params.density = 0.4f; m_cloud_params.color_bright = video::SColor(229, 240, 240, 255); m_cloud_params.color_ambient = video::SColor(255, 0, 0, 0); m_cloud_params.height = 120.0f; m_cloud_params.thickness = 16.0f; 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); m_sao->getMeta().setModified(false); } 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.getS32("hp")); } catch(SettingNotFoundException &e) { sao->setHPRaw(PLAYER_MAX_HP_DEFAULT); } try { sao->setBasePosition(args.getV3F("position")); } catch (SettingNotFoundException &e) {} try { sao->setPitch(args.getFloat("pitch")); } catch (SettingNotFoundException &e) {} try { sao->setYaw(args.getFloat("yaw")); } catch (SettingNotFoundException &e) {} try { sao->setBreath(args.getS32("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) {} } inventory.deSerialize(is); 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.setS32("hp", m_sao->getHP()); args.setV3F("position", m_sao->getBasePosition()); args.setFloat("pitch", m_sao->getPitch()); args.setFloat("yaw", m_sao->getYaw()); args.setS32("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; }