aboutsummaryrefslogtreecommitdiff
path: root/src/server.cpp
AgeCommit message (Collapse)Author
2019-04-28Force send a mapblock to a player (#8140)sofar
* Force send a mapblock to a player. Send a single mapblock to a specific remote player. This is badly needed for mods and games where players are teleported into terrain which may be not generated, loaded, or modified significantly since the last player visit. In all these cases, the player currently ends up in void, air, or inside blocks which not only looks bad, but has the effect that the player might end up falling and then the server needs to correct for the player position again later, which is a hack. The best solution is to send at least the single mapblock that the player will be teleported to. I've tested this with ITB which does this all the time, and I can see it functioning as expected (it even shows a half loaded entry hallway, as the further blocks aren't loaded yet). The parameter is a blockpos (table of x, y, z), not a regular pos. The function may return false if the call failed. This is most likely due to the target position not being generated or emerged yet, or another internal failure, such as the player not being initialized. * Always send mapblock on teleport or respawn. This avoids the need for mods to send a mapblock on teleport or respawn, since any call to `player:set_pos()` will pass this code.
2019-03-31Create ServerThread earlier in the startup processLoïc Blot
2019-03-26Prevent multi-line chat messages server-side (#8420)rubenwardy
2019-03-10Fix serialization of std::time_t by casting to u64 first (#8353)rubenwardy
Fixes #8332
2019-03-07Fix detach inventory serialisation (#8331)rubenwardy
2019-02-10Consistent HP and damage types (#8167)SmallJoker
Remove deprecated HUDs and chat message handling. Remove unused m_damage variable (compat break). HP: s32 for setter/calculations, u16 for getter.
2019-02-03Force player save before kicking on player shutdown (#8157)Loïc Blot
2019-01-21Fix randomly rejected form field submits (#8091)Jozef Behran
If a formspec is submitted from a form fields handling callback of another form (or "formspec shown from another formspec"), the fields submitted for it can get rejected by the form exploit mitigation subsystem with a message like "'zorman2000' submitted formspec ('formspec_error:form2') but server hasn't sent formspec to client, possible exploitation attempt" being sent to logs. This was already reported as #7374 and a change was made that fixed the simple testcase included with that bug report but the bug still kept lurking around and popping out in more complicated scenarios like the advtrains TSS route programming UI. Deep investigation of the problem revealed that this sequence of events is entirely possible and leads to the bug: 1. Server: show form1 2. Client *shows form1* 3. Client: submits form1 4. Server: show form2 5. Client: says form1 closed 6. Client *shows form2* 7. Client: submits form2 What happens inside the code is that when the server in step 4 sends form2, the registry of opened forms is updated to reflect the fact that form2 is now the valid form for the client to submit. Then when in step 5 client says "form1 was closed", the exploit mitigation subsystem code deletes the registry entry for the client without bothering to check whether the form client says was closed just now is indeed the form that is recorded in that entry as the valid form. Then later, in step 7 the client tries to submit its valid form fields, these will be rejected because the entry is missing. It turns out the procedure where the broken code resides already gets the form name so a simple "if" around the offending piece of code fixes the whole thing. And advtrains TSS agrees with that.
2018-12-04Send only changed node metadata to clients instead of whole mapblock (#5268)SmallJoker
Includes newer style changes and fixes by est31 Improve the block position de-serialization Add type NodeMetadataMap
2018-12-04Fix uninitialized variable peer_idLoïc Blot
Reported by GCC ``` minetest/src/server.cpp:996:42: warning: ‘peer_id’ may be used uninitialized in this function [-Wmaybe-uninitialized] errorstream << "ProcessData: peer=" << peer_id << e.what() << std::endl; ```
2018-11-28Add Lua methods 'set_rotation()' and 'get_rotation()' (#7395)CoderForTheBetter
* Adds Lua methods 'set_rotation()' and 'get_rotation'. Also changed some method names to be more clear. Instead of an f32 being sent over network for yaw, now a v3f is sent for rotation on xyz axes. Perserved Lua method set_yaw/setyaw so that old mods still work, other wise to set yaw they would need to switch to set_rotation(0, yaw, 0).
2018-11-12Fix get_server_status() segfault due to uninitialized m_envrubenwardy
Fixes #7857
2018-10-10 Add core.remove_detached_inventory (#7684)SmallJoker
Breaks backwards compatibility for good Bump protocol version
2018-09-08Particles: Make collision with objects optional (#7682)Paramat
Also set it to false for node dig particles, as they are often created and high in number. Improve particle documentation.
2018-08-16Check node updates whether the blocks are known (#7568)SmallJoker
* Remove unused ignore_id
2018-07-28Log server shutdown using actionstream (#7589)ClobberXD
2018-07-01Make the server status message customizable (#7357)SmallJoker
Remove now redundant setting show_statusline_on_connect Improve documentation of `minetest.get_server_status`
2018-06-26Rename CSM flavours to restrictionsSmallJoker
& Satisfy LINT
2018-06-15Remove Server::m_ignore_map_edit_events (noop)Loic Blot
2018-06-13Server: move shutdown parts to a specific shutdown state object (#7437)Loïc Blot
* Server: move shutdown parts to a specific shutdown state object
2018-06-11Fix the /shutdown command (#7431)SmallJoker
2018-05-12Run detach callbacks on player leaveSmallJoker
Correct docs regarding non-nil detaching children
2018-05-05Fix builtin inventory list crash when size = 0 (#7297)SmallJoker
2018-04-30Allow damage for attached objects, add attach/detach callbacks (#6786)SmallJoker
* Allow right-clicking on attached LuaEntities
2018-04-23Move ASCII art to std::cerr, to remove it from logsrubenwardy
2018-04-19Add online content repositoryrubenwardy
Replaces mods and texture pack tabs with a single content tab
2018-04-04Fix 5 issues reported by PVS studioLoic Blot
* src/sky.cpp 146 warn V519 The 'suncolor_f.r' variable is assigned values twice successively. Perhaps this is a mistake. Check lines: 142, 146. * src/sky.cpp 147 warn V519 The 'suncolor_f.g' variable is assigned values twice successively. Perhaps this is a mistake. Check lines: 143, 147. * src/sky.cpp 148 warn V519 The 'suncolor_f.b' variable is assigned values twice successively. Perhaps this is a mistake. Check lines: 144, 148. * src/threading/thread.cpp 63 err V730 Not all members of a class are initialized inside the constructor. Consider inspecting: m_thread_obj. * src/server.cpp 3243 err V595 The 'log' pointer was utilized before it was verified against nullptr. Check lines: 3243, 3258.
2018-03-30Client eventmanager refactor (#7179)Loïc Blot
* Drop EventManager from GameDef & do some client cleanups * EventManager is only used by Client. Don't expose it on Server & GameDef for nothing * Drop Client::event() in favor of direct calls to getEventManager * Cleanup some event put from new + put to put(new) * MtEvent: add Type(u8) enum * This will enhance event performance & ensure stricter type * Drop MtEvent::checkIs (unused) * clang-tidy reported fixes * Code style * Move event_manager.h to the client directory as it's only used by client Add EventManager unittests + switch to unordered_map as order is not important here Drop a unused function
2018-03-28Add reasons to on_dieplayer and on_hpchangeAndrew Ward
2018-03-28Add formspec theming using prepended stringsAndrew Ward
2018-03-21Minetest ASCII art: Move from actionstream to rawstreamparamat
2018-03-16Drop Server::m_enable_rollback_recording it's only used in server constructorLoic Blot
2018-03-16ServerEnvironment::loadDefaultMeta: Loading default meta is only possible ↵Loic Blot
for ServerEnv itself
2018-03-16Forgot to remove obsolete Server::m_modsLoic Blot
2018-03-16Server: delegate mod management & config to ServerModConfiguration (#7131)Loïc Blot
* Server: delegate mod management & config to ServerModConfiguration (rename it to ServerModManager) * Use c++11 range based loops * Add unittests + experimental/default mod as a test case to permit testing mod loading in future tests
2018-03-09Drop less performant Server::setBlockNotSent for ↵Loic Blot
ClientInterface::markBlockposAsNotSent
2018-03-08Cleanup & bugfixLoic Blot
* ObjectRef::set_local_animation: fix wrong lua return (should push a boolean, currently returns nil) * ObjectRef::set_eye_offset: fix wrong lua return (should push a boolean, currently returns nil) * Fix various Server functions which depends on RemotePlayer objet and return true/false when player object is nil whereas it's a caller implementation error. Change those bool functions to void and add sanitize_check call instead. Current callers are always checking player object validity * Optimize Server::setClouds : use CloudParams object ref instead of attribute deserialization from structure & perform RemotePlayer::setCloudParams directly in server class like many other calls * Optimize Server::SendCloudParams: use CloudParams object ref instead of deserialized attributes
2018-03-08Cleanup: drop Server::hudGetHotbarSelectedImage()Loic Blot
Call directly accessible RemotePlayer::getHotbarSelectedImage() from server api
2018-03-08Cleanup: drop Server::hudGetHotbarImage()Loic Blot
Call directly accessible RemotePlayer::getHotbarImage() from server api & make it const ref
2018-03-08Cleanup: drop Server::hudGetHotbarItemcount()Loic Blot
Call directly accessible RemotePlayer::getHotbarItemcount() from server api
2018-02-18Mitigate formspec exploits by verifying that the formspec was shown to the ↵red-001
user by the server. (#6878) This doesn't check the fields in anyway whatsoever so it should only be seen as a way to mitigate exploits, a last line of defense to make it harder to exploit bugs in mods, not as a reason to not do all the usually checks.
2018-02-10Node definition manager refactor (#7016)Dániel Juhász
* Rename IWritableNodeDefManager to NodeDefManager * Make INodeDefManager functions const * Use "const *NodeDefManager" instead of "*INodeDefManager" * Remove unused INodeDefManager class * Merge NodeDefManager and CNodeDefManager * Document NodeDefManager
2018-01-16Load a texturepack from the 'textures' subfolder of a gamered-001
2017-12-03Shut down mapgen threads before other shutdown tasks (#6689)raymoo
Solves some issues with ModStorage functionality in mapgen threads that occurred when mapgen threads continued to run after the main server thread had stopped. Also shuts down mapgen threads before shutdown callbacks are called.
2017-11-17Load files from subfolders in texturepacksnumber Zero
Updated and rebased version of a PR by red-001
2017-11-08Move files to subdirectories (#6599)Vitaliy
* Move files around
2017-09-30Make Player::peer_id server-side only and add getters and setters (#6478)Loïc Blot
* Make Player::peer_id server-side only and add getters and setters Player::peer_id has no sense client side, move it to server, make it private and add setter and getter Also add some PEER_ID_INEXISTENT instead of harcoded 0
2017-09-28Server: affect bind_addr on constructor instead of start() (#6474)Loïc Blot
bind_addr is already ready when using constructor as we read is.IPv6 from it, instead pass the whole address
2017-09-27Fix some forgotten u16 -> session_t in ad7daf7b52348e1b71aa803be10de5b2134cba11Loic Blot
2017-09-27Add session_t typedef + remove unused functions (#6470)Loïc Blot
* Add session_t typedef + remove unused functions u16 peer_id is used everywhere, to be more consistent and permit some evolutions on this type in the future (i'm working on a PoC), uniformize u16 peer_id to SessionId peer_id