aboutsummaryrefslogtreecommitdiff
path: root/src/localplayer.cpp
AgeCommit message (Collapse)Author
2018-11-28Move client-specific files to 'src/client' (#7902)Quentin Bazin
Update Android.mk Remove 'src/client' from include_directories
2018-11-22Client-side autojump. Remove Android-only stepheight autojump (#7228)Ben Deutsch
Works by detecting a collision while moving forward and then simulating a jump. If the simulated jump is more successful, an artificial jump key press is injected in the client. Includes setting and key change GUI element for enabling and disabling this feature.
2018-11-08New sneak: Smoothen the climb up event (#7727)SmallJoker
2018-04-18PlayerSettings struct for player movement code (#7243)Ben Deutsch
Instead of calling g_settings->getBool("flag") multiple times during each movement step, the current settings are cached in a new player object member. Updated via registered callbacks.
2018-04-03Fix more clang-tidy reported problems for performance-type-promotion-in-math-fnLoic Blot
Based on https://travis-ci.org/minetest/minetest/jobs/361714253 output
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-03Slippery: Simplify, make more efficient (#7086)SmallJoker
Use already existing collision results for the nearest colliding node Fix slippery effect in free_move mode
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
2017-11-06Player eye height: Make this a settable player object propertyparamat
2017-09-28Localplayer: Fix disable_jump effect and getStandingNodePos()SmallJoker
Leave the old move code untouched.
2017-08-26Alternative code for slipping (#6256)Ben Deutsch
* Alternative code for slipping - does not depend on frame rate - controllable via environment variables for now * Adjust slipping speed for item entities too. * Final version of framerate-independent slippery code * Remove dead code and fix formatting * getStandingNodePos should only look 0.05 nodes downwards This ensures that, even if the player is standing on a partially filled node, this node is used as the standing node and not the node below it. Specific use: enables slippery slabs * Exchange global getStandingPosNode change for local inline change Reverts previous commit * Revert the item movement changes * Slippery nodes now slip over cliffs and edges Players no longer suddenly stop before falling off. Also refactored slippery code into getSlipFactor method. * Slipping over an edge gated by player's is_slipping state A new flag for just this case, to reduce costly node lookups in the normal case of leaning over a non-slippery edge. Public access for consistency and potential future uses. * Minor code tweaks / cosmetics * Add temp variable to improve readability and fix indentation issues
2017-08-26Android stepheight: Only increase if 'touching ground' (#6313)Paramat
2017-08-18Modernize various files (src/k*, src/l*)Loic Blot
* range-based for loops * code style * C++ headers instead of C headers * Default operators
2017-08-13LocalPlayer::accelerateHorizontal: cleanupsLoic Blot
* Properly use v3f default constructor * v3f d_wanted = target_speed - m_speed; and d_wanted = target_speed * 0.1f - m_speed * 0.1f; can be factorized to d_wanted = (target_speed - m_speed) * 0.1f; => d_wanted *= 0.1f;
2017-08-13Cleanup LocalPlayer::applyControlLoic Blot
* Use Environment interface instead of ClientEnvironemnt * Don't create slippery variable and then re-affect it * itemgroup_get return a int, properly test != 0 to be clearer
2017-08-13Add slippery group for nodes (players/items slide)Wuzzy
2017-08-09Step height: Add as a player object propertyparamat
Add settable player step height using the existing object property. Breaks compatibility with old clients, add to protocol version 35.
2017-07-15Sneak: Stripped down versionSmallJoker
Fix taking damage caused by sneaking over a nodebox gap. Fix strange behaviour on stair nodeboxes. Enable jumping from node edges while sneaking. Enable movement around corners while sneaking on a 1-node-high groove in a wall.
2017-06-24Emit liquid sound if the player walks in liquid (#6040)Dániel Juhász
2017-06-17Cpp11 initializers 2 (#5999)Loïc Blot
* C++11 patchset 10: continue cleanup on constructors * Drop obsolete bool MainMenuData::enable_public (setting is called with cURL in server loop) * More classes cleanup * More classes cleanup + change NULL tests to boolean tests
2017-05-09Revert custom player collision box and step height commitsparamat
These caused inability to pass through 2 node high spaces or step up onto slabs or steps when a new client connected to an older server.
2017-05-08Custom step height: Fix implementationparamat
Recent commit 45ab62d6a3d90ab3b97aec88251a766cb5dd1899 had a coding error that made climbing out of water difficult due to an incorrect value of the step height when not 'touching ground'. It also incorrectly multiplied the custom stepheight by BS, resulting in being able to step-up 2 nodes if set to the default of 0.6, or even 0.3. Also the implementation was wrong because it customised the step height when not 'touching ground', this step height is for a slight rise when catching the edge of a node during a jump, and should always remain at 0.2 * BS.
2017-05-06Use stepheight from CAO instead of hardcoded valueSapier
2017-05-06Make players respect makes_footstep_sound in the object propertiesTeTpaAka
2017-05-03Sneak: Improve and fix various thingsSmallJoker
Remove useless `got_teleported`. Fix jitter when walking against the sneak limits. Fix damage evading on sneak ladders.
2017-04-22Sneak glitch: Set default to falseparamat
The 'sneak glitch' physics override now controls whether a player can use the new move code replications of the old sneak side-effects: sneak ladders and 2 node sneak jump. This completes our intention to replicate the old sneak side-effects in new code and provide them as an option that is disabled by default.
2017-04-17Sneak: Add option for old move codeparamat
Temporary option for the old move code for specific old sneak behaviour. Enabled by setting the added 'new move' physics override to false. By default 'new move' is true.
2017-04-11Sneak glitch: Detect ledge for 2-node climb-upparamat
Re-creates the old sneak-jump behaviour in new code. Enabled by the 'sneak glitch' physics override. When a ledge is detected the jump speed modifier is set to the larger of 'physics override jump' and 1.3 to allow a 2-node climb-up. An unexpected side-effect is the simple sneak ladder working smoothly.
2017-03-29Sneak: Fix sneaking on free-floating lower-half slabssfan5
2017-03-29Sneak: Fix stair lower step bug and ladder in 1x1 hole bugssfan5
2017-03-26Sneak: Replicate sneak ladder in new code, is optionalsfan5
Enabled using the existing 'sneak_glitch' physics override.
2017-03-16Sneak: Fix various problems with sneakingsfan5
Sneaking won't actually hover you in the air, releasing shift guarantees not falling down (same as in MC). Sneak-jump no longer goes higher than a normal jump (^ was required for this). Sneaking no longer avoids fall damage. You can sneak on partial nodes (slabs, sideways slabs) correctly. Sneaking doesn't "go out" as far anymore (0.29 instead of 0.4). Can't jump when sneaking out as far as possible (breaks the sneak ladder).
2017-02-12Footsteps: Fix offset footstep and shallow water sound bugsparamat
Fix footstep sounds coming from nodes to either side when walking on a 1 node wide row of nodebox slabs such as default:snow. Fix sand footsteps when swimming in 1 node deep water. Use a new function 'getFootstepNodePos()' instead of 'getStandingNodePos()' to avoid using a horizontally-offset 'sneak node' for sounds. Sound is selected from the node BS * 0.05 below the player's feet, so that 1/16th slabs will play the slab sound but 1/32nd slabs will not. If the player is not 'touching ground' the node detection position is changed to BS * 0.5 below to preserve footstep sounds when landing after a jump or fall.
2017-01-11Cleanup some header inclusions to improve compilation timesLoic Blot
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
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-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-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-06-03Initial Gamepad supportest31
Adds initial ingame gamepad support to minetest. Full Formspec support is not implemented yet and can be added by a later change.
2016-05-06Android: Increase player_stepheight for thicker snow nodeboxMaksim Gamarnik
2016-03-14Fix player teleportation bug whilst sneakingHybridDog
Only set back position when sneaking if player wasn't teleported by adding and using a bool "got_teleported" to player it fixes #2876
2016-03-12Nodebox: Allow nodeboxes to "connect"Auke Kok
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
2016-02-14Player::accelerateHorizontal/Vertical should be member of LocalPlayerLoic Blot
2016-01-29Don't pass non-const references to collision methodsest31
Non const references cause a lot of confusion with behaviour of code, and are disallowed by minetest style guide.
2015-11-08Fix misc. MinGW and Valgrind warningskwolekr
2015-11-03Only go fast in autorun if fast move is enabledest31
2015-10-26Fix jittering sounds on entities (fixes #2974)BlockMen
2015-08-15Fix sneaking (fixes #665 and #3045)BlockMen
2015-08-06Fix detection of sneaking nodegregorycu
This fixes bug 1551
2015-08-02Fix "bouncy" blocksMiner59
Before players "bounced" too high. Now, while still allowing to bounce, higher speed bounces are throttled.