summaryrefslogtreecommitdiff
path: root/src/server.cpp
Commit message (Collapse)AuthorAge
* PlayerSAO saving fix (#4734)Ner'zhul2016-11-05
| | | | | 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...
* PlayerSAO/LocalPlayer refactor: (#4612)Ner'zhul2016-10-30
| | | | | | | | | | | | | | | | | * 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
* Attached particle spawnersraymoo2016-10-13
|
* Move RemotePlayer code to its own cpp/headerLoic Blot2016-10-08
|
* RemotePlayer/LocalPlayer Player base class proper separation (code cleanup) ↵Loic Blot2016-10-08
| | | | | | | | | | | | (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
* Optimize ClientIface::getPlayerNames(): return const ref instead a copy of ↵Loic Blot2016-10-08
| | | | all names
* More code cleanup (UNORDERED + RemotePlayer/LocalPlayer)Loic Blot2016-10-08
| | | | | | | * 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
* Player/LocalPlayer/RemotePlayer inheritance cleanup (part 2 on X)Loic Blot2016-10-08
| | | | | | | * 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())
* Remove some unused attributes/class functions in server.cpp/hLoic Blot2016-10-08
|
* Player/LocalPlayer/RemotePlayer inheritance cleanup (part 1 on X)Loic Blot2016-10-08
| | | | | | | | | | | * 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
* use unordered containers where possible (patch 4 on X)Loic Blot2016-10-06
| | | | Also remove some unused parameters/functions
* Fix narrow string compiling issue on MSVC2010SmallJoker2016-10-06
|
* Use more unordered_maps to improve performance in c++11 buildsLoic Blot2016-10-06
|
* Fix crash regression when chatting in the ncurses consoleest312016-10-06
| | | | | | Fixes #4579, a regression introduced by commit d4c76258e37337ea585cf24d8e05b50a30fa307d "Chat: new settings to prevent spam"
* Replace various std::map with UNORDERED_MAP + various cleanupsLoic Blot2016-10-05
| | | | | | | | | | | | 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
* Chat: new settings to prevent spamLoic Blot2016-10-05
| | | | | | | | | | | 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
* Move on join and on leave messages to lua (#4460)Xunto2016-08-22
|
* Add MapSettingsManager and new mapgen setting script API functionskwolekr2016-07-03
| | | | | | | | | | | | | | | 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.
* Server: Add reason for leave to `on_leaveplayer` callbacksDiego Martinez2016-06-11
|
* Particles: Add option to remove particles on collisionAuke Kok2016-05-28
| | | | | | | | | | | | | | | | | | | | | | | | | Adds the particle option `collision_removal = bool` Some particles are hard to use right now since they either go through solid blocks (without collision detection), and with collision detection enabled they (e.g. raindrops) would just stop dead on the floor and sit there until they expire, or worse, scrape along a wall or ceiling. We can solve the problem by adding a boolean flag that tells the particle to be removed if it ever collides with something. This will make it easier to add rain that doesn't fall through your roof or stick on the top of it. Or clouds and smoke that don't go through trees. Particles that collide with this flag are marked expired unconditionally, causing them to be treated like normal expired particles and cleaned up normally. Documentation is adjusted accordingly. An added bonus of this patch is that particles can potentially collide many times with nodes, and this reduces the amount of collisions to 1 (max), which may end up reducing particle load on the client.
* Fixes #4098 ce8a9ed didn't quite go far enough, and left this bug ingregorycu2016-05-08
|
* Handle particle spawners in env and delete expired idsobneq2016-04-28
| | | | Rebased by Zeno (2016-04-2016)
* Nodebox: Allow nodeboxes to "connect"Auke Kok2016-03-12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We introduce a new nodebox type "connected", and allow these nodes to have optional nodeboxes that connect it to other connecting nodeboxes. This is all done at scenedraw time in the client. The client will inspect the surrounding nodes and if they are to be connected to, it will draw the appropriate connecting nodeboxes to make those connections. In the node_box definition, we have to specify separate nodeboxes for each valid connection. This allows us to make nodes that connect only horizontally (the common case) by providing optional nodeboxes for +x, -x, +z, -z directions. Or this allows us to make wires that can connect up and down, by providing nodeboxes that connect it up and down (+y, -y) as well. The optional nodeboxes can be arrays. They are named "connect_top, "connect_bottom", "connect_front", "connect_left", "connect_back" and "connect_right". Here, "front" means the south facing side of the node that has facedir = 0. Additionally, a "fixed" nodebox list present will always be drawn, so one can make a central post, for instance. This "fixed" nodebox can be omitted, or it can be an array of nodeboxes. Collision boxes are also updated in exactly the same fashion, which allows you to walk over the upper extremities of the individual node boxes, or stand really close to them. You can also walk up node noxes that are small in height, all as expected, and unlike the NDT_FENCELIKE nodes. I've posted a screenshot demonstrating the flexibility at http://i.imgur.com/zaJq8jo.png In the screenshot, all connecting nodes are of this new subtype. Transparent textures render incorrectly, Which I don't think is related to this text, as other nodeboxes also have issues with this. A protocol bump is performed in order to be able to send older clients a nodeblock that is usable for them. In order to avoid abuse of users we send older clients a "full-size" node, so that it's impossible for them to try and walk through a fence or wall that's created in this fashion. This was tested with a pre-bump client connected against a server running the new protocol. These nodes connect to other nodes, and you can select which ones those are by specifying node names (or group names) in the connects_to string array: connects_to = { "group:fence", "default:wood" } By default, nodes do not connect to anything, allowing you to create nodes that always have to be paired in order to connect. lua_api.txt is updated to reflect the extension to the node_box API. Example lua code needed to generate these nodes can be found here: https://gist.github.com/sofar/b381c8c192c8e53e6062
* Fix ask_reconnect_on_crash option being ignoredorwell962016-03-11
| | | | | | | | | | | | | | Since commit 3b50b2766aeb09c9fc0ad0ea07426bb2187df3d7 "Optional reconnect functionality" there is a config option named ask_reconnect_on_crash. It asks the client to reconnect to the server if the server crashed. It has been implemeted and works, but due to a function parameter not being passed it never showed effect. This patch adds the parameter and fixes the bug. Also fixes the `reconnect` option of minetest.request_shutdown being ignored.
* Add minetest.register_lbm() to run code on block load onlyest312016-03-07
|
* Cache some settingsrubenwardy2016-02-26
|
* FindSpawnPos: Let mapgens decide what spawn altitude is suitableparamat2016-02-09
| | | | | | | | | | | | To avoid spawn search failing in new specialised mapgens Increase spawn search range to 4000 nodes Add getSpawnLevelAtPoint() functions to EmergeManager, class Mapgen and all mapgens Remove getGroundLevelAtPoint() functions from all mapgens except mgv6 (possibly to be re-added later in the correct form to return actual ground level) Make mgvalleys flag names consistent with other mapgens Remove now unused 'vertical spawn range' setting
* Update HUD flags on server like on clientest312015-11-22
| | | | | | | | | | | | | Fixes bug for which commit 6c37e89f08f962eaba788a31f5d3c798ceaa65e6 "Fix old client showing duplicated health bar on new server" by @sapier laid the groundwork, where the server has updated its copy of the hud flags without respecting the mask. Fixes #3395.
* Only allow players with shout to chatest312015-11-13
| | | | | | | | | | Fix regression of commit 5e507c9829942c434a6f1ae7a4f3a488c7e50bef "Add server side ncurses terminal" which allowed all players, even those without a shout priv, to chat. Fixes #3362.
* Put ChatEvent handler into own functionest312015-11-09
| | | | Comply with line limit.
* Write new line character sequence at end of print()est312015-11-08
| | | | | | | | | | | Fix regression of commit 5e507c9829942c434a6f1ae7a4f3a488c7e50bef "Add server side ncurses terminal" where no line termination character was printed after a lua print outside of terminal mode. Fixes #3350.
* Add server side ncurses terminalest312015-11-06
| | | | | | | | | | | | | | | | | | | | | | | | This adds a chat console the server owner can use for administration or to talk with players. It runs in its own thread, which makes the user interface immune to the server's lag, behaving just like a client, except timeout. As it uses the same console code as the f10 console, things like nick completion or a scroll buffer basically come for free. The terminal itself is written in a general way so that adding a client version later on is just about implementing an interface. Fatal errors are printed after the console exists and the ncurses terminal buffer gets cleaned up with endwin(), so that the error still remains visible. The server owner can chose their username their entered text will have in chat and where players can send PMs to. Once the username is secured with a password to prevent anybody to take over the server, the owner can execute admin tasks over the console. This change includes a contribution by @kahrl who has improved ncurses library detection.
* Time: Remove serverside getter, and use atomic operationsest312015-11-03
| | | | | | | | It isn't possible to use atomic operations for floats, so don't use them there. Having a lock is good out of other reasons too, because this way the float time and the integer time both match, and can't get different values in a race, e.g. when two setTimeofDay() get executed simultaneously.
* Fix server crashing on Lua errorsShadowNinja2015-10-31
| | | | | | | | Previously, the server called FATAL_ERROR when a Lua error occured. This caused a (mostly useless) core dump. The server now simply throws an exception, which is caught and printed before exiting with a non-zero return value. This also fixes a number of instances where errors were logged multiple times.
* findSpawnPos: Add setting for max height above water levelparamat2015-10-29
| | | | | | | | Increase default from 6 to 16 to help with mgv7 and mgfractal Large-scale or alternative mapgens can result in a lowland spawn point not being found, causing a spawn at (0, 0, 0) possibly buried underground The max height is now settable to allow correct player spawn in any mapgen or when using custom noise parameters
* Environment: Time of day fixes and add serverside getterest312015-10-27
| | | | | | | | -> Put access to time variables under the time lock. -> Merge both time locks, there is no point to have two locks. -> Fix the lock being released too early in Environment::setTimeOfDay -> Add serverside getter so that you don't have to get the environment if you only have the server
* Rename macros with two leading underscoresShadowNinja2015-10-14
| | | | These names are reserved for the compiler/library implementations.
* Always use errorstream for DEBUG_EXCEPTION_HANDLERShadowNinja2015-10-14
|
* Use warningstream for log messages with WARNINGShadowNinja2015-10-14
| | | | Remove DTIME macro and its uses, too
* Define and use limit constants for Irrlicht fixed-width typeskwolekr2015-10-04
|
* Some map border related fixesest312015-09-29
| | | | | | | | | | | | | 1. Check for entity addition success in spawn_item implementation 2. Check for success in item_drop callback, so that the player doesn't lose the item if they are outside bounds and try to drop it. 3. When existing player joins game, check that their position is inside map bounds. If not, set their position to the return value of findSpawnPos(). 4. Make findSpawnPos() respect the border 2 fixes a lua crash if a player drops an item outside map bounds. 3 fixes an assertion crash if a player leaves when being outside map bounds, and then rejoins.
* Little optimization on getAdded/Removed activeobjects per player loop.Loic Blot2015-09-19
| | | | | Use std::queue instead of std::set, we don't need such a heavy container. Don't convert position to int to convert it back to float in the next function.
* Send proper block to old clients for swap_node callsest312015-09-17
| | | | | | | | | | | The legacy code added in commit d879a539cd19ddd1ee34afec2512fb2238de2822 - "Add minetest.swap_node" for sending the whole mapblock to older clients on the case of a node modification with swap_node, had the problem that the block chosen to be sent to the client was referenced with node coordinates and not with block coordinates, resulting in getting the wrong block sent to the client.
* Change i++ to ++iDavid Jones2015-08-25
|
* Clean up threadingShadowNinja2015-08-23
| | | | | | | | | | | | | | | | | | | | * Rename everything. * Strip J prefix. * Change UpperCamelCase functions to lowerCamelCase. * Remove global (!) semaphore count mutex on OSX. * Remove semaphore count getter (unused, unsafe, depended on internal API functions on Windows, and used a hack on OSX). * Add `Atomic<type>`. * Make `Thread` handle thread names. * Add support for C++11 multi-threading. * Combine pthread and win32 sources. * Remove `ThreadStarted` (unused, unneeded). * Move some includes from the headers to the sources. * Move all of `Event` into its header (allows inlining with no new includes). * Make `Event` use `Semaphore` (except on Windows). * Move some porting functions into `Thread`. * Integrate logging with `Thread`. * Add threading test.
* Add count based unload limit for mapblocksest312015-08-13
|
* Fix segfaults caused by the Environment not being initialized yetrubenwardy2015-08-09
|
* Prepend "Lua: " before lua exceptionsBřetislav Štec2015-08-02
| | | | | src/server.cpp src/emerge.cpp
* Small SendableMediaAnnouncement cleanupLoic Blot2015-07-31
| | | | | | -> Remove the SendableMediaAnnouncement struct -> Forge the packet directly in the m_media loop, spare one loop and the construction of a vector -> Use preincrement to spare iterator copies
* Cleanup server addparticle(spawner) by merge two identical functions.Loic Blot2015-07-25
|