aboutsummaryrefslogtreecommitdiff
path: root/builtin/game/deprecated.lua
Commit message (Collapse)AuthorAge
* Removed some obsolete code (#10562)Zughy2021-01-21
| | | Co-authored-by: Zughy <4279489-marco_a@users.noreply.gitlab.com>
* Add on_authplayer callback and 'last_login' to on_joinplayer (#9574)sorcerykid2020-05-23
| | | | | | Replace on_auth_fail callback with more versatile on_authplayer Better clarify account login process in Lua API documentation Change initial timestamp for newly registered accounts to -1
* Change some usages of "deprecated" to "obsolete" (#9062)random-geek2019-10-29
| | | | "Deprecated" means that something is still in use, but is unsupported and needs to be removed. "Obsolete" means it is already out of use.
* Use a settings object for the main settingsShadowNinja2017-05-06
| | | | | | | This unifies the settings APIs. This also unifies the sync and async registration APIs, since the async registration API did not support adding non-functions to the API table.
* Refactor loggingShadowNinja2015-10-14
| | | | | | | | | - Add warning log level - Change debug_log_level setting to enumeration string - Map Irrlicht log events to MT log events - Encapsulate log_* functions and global variables into a class, Logger - Unify dstream with standard logging mechanism - Unify core.debug() with standard core.log() script API
* Localize digprop_err functionRui2015-10-12
|
* Use "core" namespace internallyShadowNinja2014-05-08
|
* Organize builtin into subdirectoriesShadowNinja2014-05-07
"hl ppc"> #include "porting.h" // strlcpy #include "server.h" #include "settings.h" #include "convert_json.h" #include "server/player_sao.h" /* RemotePlayer */ // static config cache for remoteplayer bool RemotePlayer::m_setting_cache_loaded = false; float RemotePlayer::m_setting_chat_message_limit_per_10sec = 0.0f; u16 RemotePlayer::m_setting_chat_message_limit_trigger_kick = 0; RemotePlayer::RemotePlayer(const char *name, IItemDefManager *idef): Player(name, idef) { if (!RemotePlayer::m_setting_cache_loaded) { RemotePlayer::m_setting_chat_message_limit_per_10sec = g_settings->getFloat("chat_message_limit_per_10sec"); RemotePlayer::m_setting_chat_message_limit_trigger_kick = g_settings->getU16("chat_message_limit_trigger_kick"); RemotePlayer::m_setting_cache_loaded = true; } movement_acceleration_default = g_settings->getFloat("movement_acceleration_default") * BS; movement_acceleration_air = g_settings->getFloat("movement_acceleration_air") * BS; movement_acceleration_fast = g_settings->getFloat("movement_acceleration_fast") * BS; movement_speed_walk = g_settings->getFloat("movement_speed_walk") * BS; movement_speed_crouch = g_settings->getFloat("movement_speed_crouch") * BS; movement_speed_fast = g_settings->getFloat("movement_speed_fast") * BS; movement_speed_climb = g_settings->getFloat("movement_speed_climb") * BS; movement_speed_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); // Skybox defaults: SkyboxDefaults sky_defaults; m_skybox_params.sky_color = sky_defaults.getSkyColorDefaults(); m_skybox_params.type = "regular"; m_skybox_params.clouds = true; m_skybox_params.fog_sun_tint = video::SColor(255, 244, 125, 29); m_skybox_params.fog_moon_tint = video::SColorf(0.5, 0.6, 0.8, 1).toSColor(); m_skybox_params.fog_tint_type = "default"; m_sun_params = sky_defaults.getSunDefaults(); m_moon_params = sky_defaults.getMoonDefaults(); m_star_params = sky_defaults.getStarDefaults(); } 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); }