aboutsummaryrefslogtreecommitdiff
path: root/src/server.cpp
AgeCommit message (Collapse)Author
2017-04-22Add on_flood() callback.Auke Kok
This callback is called if a liquid definitely floods a non-air node on the map. The callback arguments are (pos, oldnode, newnode) and can return a `bool` value indicating whether flooding the node should be cancelled (`return true` will prevent the node from flooding). Documentation is added, the callback function was tested with a modified minetest_game. Note that `return true` will likely cause the node's `on_flood()` callback to be called every second until the node gets removed, so care must be taken to prevent many callbacks from using this return value. The current default liquid update interval is 1.0 seconds, which isn't unmanageable. The larger aim of this patch is to remove the lava cooling ABM, which is a significant cost to idle servers that have lava on their map. This callback will be much more efficient.
2017-04-21Fix #5617 - respect message and reconnect parameters when shutting down ↵orwell96
immediately (#5621)
2017-04-17Fix MSVC build broken by 34d32ceSmallJoker
`round` -> `myround` Remove superflous `floor` calls
2017-04-15Implement delayed server shutdown with cancelation (#4664)Loïc Blot
2017-04-14ClientIface::sendToAll: honor packet configuration (#5590)Loïc Blot
2017-04-08Move chat command handling code from C++ to Lua (#5528)red-001
2017-04-06Fix multiple death messages (#5305)presstabstart
Fix multiple death messages (#3565) and damage server logs after death.
2017-03-19Fix /shutdown or ^C no longer causing server exitsfan5
Broken since b8484ef24e8e1ec90a2967372808ab2bea538c7c
2017-03-19Update server min protocol version to v24 (#5411)Loïc Blot
* Update server min protocol version to v24 It's based on @sfan5 stats. See https://kitsunemimi.pw/tmp/serverlist_stats_2017-03-17.txt v24 was bumped 25/08/14 and 0.4.11 was released 25/12/14 * Drop protocol v23 and lesser code
2017-03-18Server list cleanupShadowNinja
This removes the hacky server_dedicated pseudo-setting.
2017-03-13[CSM] storage + fixesLoic Blot
2017-03-13[CSM] implement client side mod loading (#5123)Loïc Blot
* client side mods are located in clientmods/ * move builtin/preview.lua to clientmods/preview/init.lua as a preview mod * refactor ModConfiguration class to work properly with client and server using child objects * move some Server constructor mod load code to ModConfiguration to reduce code duplication between client and server * remove mods.{cpp,h} unused functions * use UNORDERED_SET instead of std::set in some modspec storages
2017-03-13[CSM] Client side moddingLoic Blot
* rename GameScripting to ServerScripting * Make getBuiltinLuaPath static serverside * Add on_shutdown callback * Add on_receiving_chat_message & on_sending_chat_message callbacks * ScriptApiBase: use IGameDef instead of Server This permits to share common attribute between client & server * Enable mod security in client side modding without conditions
2017-02-08Add ModMetadata API (#5131)Loïc Blot
* mod can create a ModMetadata object where store its values and retrieve it. * Modmetadata object can only be fetched at mod loading * Save when modified using same time as map interval or at server stop * add helper function to get mod storage path * ModMetadata has exactly same calls than all every other Metadata
2017-01-25Block spam messages before calling on_chatmessage callbacks (#4805)rubenwardy
Fixes #4799
2017-01-22Fix potential crash in chat handling (since ↵sfan5
2f56a00d9eef82052614e5854a07b39b087efd0b)
2017-01-21Add show_statusline_on_connect setting (#5084)Loïc Blot
Add show_statusline_on_connect setting
2017-01-21Revert "Detach the player from entities on death." (#5087)Loïc Blot
2017-01-21Detach the player from entities on death. (#5077)red-001
2017-01-20Remove `mathconstants.h` and use the correct way to get `M_PI` in MSVC. (#5072)red-001
2017-01-18Add particle animation, glowsfan5
This is implemented by reusing and extending the TileAnimation code for the methods used by particles.
2017-01-17Remove client-side chat prediction. (#5055)red-001
Network lag isn't really a big issue with chat and chat prediction makes writing mods harder.
2017-01-15Added lua tracebacks to some errors where you have been blind to what… (#5043)sapier
* Added lua tracebacks to some errors where you have been blind to what actually went wrong
2017-01-09Environment & IGameDef code refactoring (#4985)Ner'zhul
* Environment code refactoring * Cleanup includes & class declarations in client & server environment to improve build speed * ServerEnvironment::m_gamedef is now a pointer to Server instead of IGameDef, permitting to cleanup many casts. * Cleanup IGameDef * Move ITextureSource* IGameDef::getTextureSource() to Client only. * Also move ITextureSource *IGameDef::tsrc() helper * drop getShaderSource, getSceneManager, getSoundManager & getCamera abstract call * drop unused emerge() call * cleanup server unused functions (mentionned before) * Drop one unused parameter from ContentFeatures::updateTextures * move checkLocalPrivilege to Client * Remove some unnecessary casts * create_formspec_menu: remove IWritableTextureSource pointer, as client already knows it * Fix some comments * Change required IGameDef to Server/Client pointers * Previous change that game.cpp sometimes calls functions with Client + InventoryManager + IGameDef in same functions but it's the same objects * Remove duplicate Client pointer in GUIFormSpecMenu::GUIFormSpecMenu * drop ClientMap::sectorWasDrawn which is unused
2017-01-01Breath cheat fix: server sideLoic Blot
Breath is now handled server side. Changing this behaviour required some modifications to core: * Ignore TOSERVER_BREATH package, marking it as obsolete * Clients doesn't send the breath to server anymore * Use PlayerSAO pointer instead of peer_id in Server::SendPlayerBreath to prevent a useless lookup (little perf gain) * drop a useless static_cast in emergePlayer
2016-12-26Various anticheat improvementssfan5
* Calculate maximum interact distance from wielded tool * New "interacted_while_dead" cheat_type for the Lua API * Disallow dropping items while dead * Move player to spawn before resurrecting them
2016-11-30Optimize/adjust blocks/ActiveObjects sent at the server based on client ↵lhofhansl
settings. (#4811) Optimize/adjust blocks and active blocks sent at the server based on client settings.
2016-11-28Allow restricting detached inventories to one playersfan5
This combats the problem of sending the hundreds of "creative" / "armor" or whatever detached invs that exist on popular servers to each and every player on join or on change of said invs.
2016-11-23Make supplying empty formspec strings close the formspec (#4737)orwell96
This will only happen if the formname matches or if formname is "".
2016-11-14Revert "Adding particle blend, glow and animation (#4705)"sfan5
This reverts commit 93e3555eae2deaeca69ee252cfa9cc9c3e0e49ef.
2016-11-15Adding particle blend, glow and animation (#4705)Foghrye4
2016-11-05PlayerSAO saving fix (#4734)Ner'zhul
PlayerSAO::disconnected() function was historical and remove the link between SAO and RemotePlayer session. With previous attributes linked to RemotePlayer saving was working. But now attributes are read from SAO not RemotePlayer and the current serialize function verify SAO exists to save the player attributes. Because PlayerSAO::disconnected marks playersao for removal, only mark playerSAO for removal and let PlayerSAO::removingFromEnvironment do the correct saving behaviour and all the disconnection process instead of doing a partial removal and let the server loop doing the RemotePlayer cleanup and remove some saved attributes...
2016-10-30PlayerSAO/LocalPlayer refactor: (#4612)Ner'zhul
* Create UnitSAO, a common part between PlayerSAO & LuaEntitySAO * Move breath to PlayerSAO & LocalPlayer * Migrate m_yaw from (Remote)Player & LuaEntitySAO to UnitSAO * Migrate m_yaw from Player to LocalPlayer for client * Move some functions outside of player class to PlayerSAO/RemotePlayer or LocalPlayer depending on which class needs it * Move pitch to LocalPlayer & PlayerSAO * Move m_position from Player to LocalPlayer * Move camera_barely_in_ceiling to LocalPlayer as it's used only there * use PlayerSAO::m_base_position for Server side positions * remove a unused variable * ServerActiveObject::setPos now uses const ref * use ServerEnv::loadPlayer unconditionnaly as it creates RemotePlayer only if it's not already loaded * Move hp from Player to LocalPlayer * Move m_hp from LuaEntitySAO to UnitSAO * Use m_hp from PlayerSAO/UnitSAO instead of RemotePlayer
2016-10-13Attached particle spawnersraymoo
2016-10-08Move RemotePlayer code to its own cpp/headerLoic Blot
2016-10-08RemotePlayer/LocalPlayer Player base class proper separation (code cleanup) ↵Loic Blot
(patch 3 of X) * remove IGameDef from Player class, only LocalPlayer has it now * move many attributes/functions only used by LocalPlayer from Player to LocalPlayer * move many attributes/functions only used by RemotePlayer from Player to RemotePlayer * make some functions const * hudGetHotbarSelectedImage now returns const ref * RemotePlayer getHotbarSelectedImage now returns const ref * various code style fixes
2016-10-08Optimize ClientIface::getPlayerNames(): return const ref instead a copy of ↵Loic Blot
all names
2016-10-08More code cleanup (UNORDERED + RemotePlayer/LocalPlayer)Loic Blot
* ClientEnvironment now uses UNORDERED MAP for active objects * Use RemotePlayer and LocalPlayer everywhere it's possible * Minor code style fixes * Drop Client::getBreath() unused function
2016-10-08Player/LocalPlayer/RemotePlayer inheritance cleanup (part 2 on X)Loic Blot
* Server/Client Environments now have an helper to cast Player object in the right type to use it * Server: use RemotePlayer everywhere and remove previous added casts * Client: use LocalPlayer where needed * Environment: remove unused functions (getPlayers(), getRandomConnectedPlayer(), getNearestConnectedPlayer())
2016-10-08Remove some unused attributes/class functions in server.cpp/hLoic Blot
2016-10-08Player/LocalPlayer/RemotePlayer inheritance cleanup (part 1 on X)Loic Blot
* LocalPlayer take ownership of maxHudId as it's the only caller * RemotePlayer take ownership of day night ratio as it's the only user * Pass getPlayerControl as const reference to prevent object copy on each call (perf improvement in ObjectRef::l_get_player_control call) * getPlayerSAO is now only RemotePlayer call * get/setHotbarItemCount is now RemotePlayer owned * Server: Use RemotePlayer instead of Player object on concerned call to properly fix the object type * PlayerSAO now uses RemotePlayer instead of Player because it's only server side * ObjectRef::getplayer also returns RemotePlayer as it's linked with PlayerSAO
2016-10-06use unordered containers where possible (patch 4 on X)Loic Blot
Also remove some unused parameters/functions
2016-10-06Fix narrow string compiling issue on MSVC2010SmallJoker
2016-10-06Use more unordered_maps to improve performance in c++11 buildsLoic Blot
2016-10-06Fix crash regression when chatting in the ncurses consoleest31
Fixes #4579, a regression introduced by commit d4c76258e37337ea585cf24d8e05b50a30fa307d "Chat: new settings to prevent spam"
2016-10-05Replace various std::map with UNORDERED_MAP + various cleanupsLoic Blot
This is part 2 for 5f084cd98d7b3326b51320455364337539710efd Other improvements: * Use the defined ItemGroupList when used * make Client::checkPrivilege const * inline some trivial functions * Add ActiveObjectMap typedef * Add SettingsEntries typedef
2016-10-05Chat: new settings to prevent spamLoic Blot
Added the following chat coreside features * Chat messages length limit * Message rate limiting * Message rate kicking Note: * handleChat now takes RemotePlayer pointer instead of u16 to remove useless lookups
2016-08-22Move on join and on leave messages to lua (#4460)Xunto
2016-07-03Add MapSettingsManager and new mapgen setting script API functionskwolekr
This commit refactors the majority of the Mapgen settings system. - MapgenParams is now owned by MapSettingsManager, itself a part of ServerMap, instead of the EmergeManager. - New Script API functions added: core.get_mapgen_setting core.get_mapgen_setting_noiseparams, core.set_mapgen_setting, and core.set_mapgen_setting_noiseparams. - minetest.get/set_mapgen_params are deprecated by the above new functions. - It is now possible to view and modify any arbitrary mapgen setting from a mod, rather than the base MapgenParams structure. - MapgenSpecificParams has been removed.
2016-06-11Server: Add reason for leave to `on_leaveplayer` callbacksDiego Martinez