summaryrefslogtreecommitdiff
path: root/src/localplayer.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/localplayer.cpp')
-rw-r--r--src/localplayer.cpp20
1 files changed, 18 insertions, 2 deletions
diff --git a/src/localplayer.cpp b/src/localplayer.cpp
index 4b5e53fea..17c4cdeb9 100644
--- a/src/localplayer.cpp
+++ b/src/localplayer.cpp
@@ -34,6 +34,8 @@ with this program; if not, write to the Free Software Foundation, Inc.,
LocalPlayer::LocalPlayer(IGameDef *gamedef):
Player(gamedef),
+ isAttached(false),
+ overridePosition(v3f(0,0,0)),
m_sneak_node(32767,32767,32767),
m_sneak_node_exists(false),
m_old_node_below(32767,32767,32767),
@@ -59,6 +61,13 @@ void LocalPlayer::move(f32 dtime, Map &map, f32 pos_max_d,
v3f old_speed = m_speed;
+ // Copy parent position if local player is attached
+ if(isAttached)
+ {
+ setPosition(overridePosition);
+ return;
+ }
+
// Skip collision detection if a special movement mode is used
bool fly_allowed = m_gamedef->checkLocalPrivilege("fly");
bool free_move = fly_allowed && g_settings->getBool("free_move");
@@ -314,7 +323,7 @@ void LocalPlayer::move(f32 dtime, Map &map, f32 pos_max_d,
v3s16 camera_np = floatToInt(getEyePosition(), BS);
MapNode n = map.getNodeNoEx(camera_np);
if(n.getContent() != CONTENT_IGNORE){
- if(nodemgr->get(n).walkable){
+ if(nodemgr->get(n).walkable && nodemgr->get(n).solidness == 2){
camera_barely_in_ceiling = true;
}
}
@@ -352,7 +361,14 @@ void LocalPlayer::applyControl(float dtime)
setPitch(control.pitch);
setYaw(control.yaw);
-
+
+ // Nullify speed and don't run positioning code if the player is attached
+ if(isAttached)
+ {
+ setSpeed(v3f(0,0,0));
+ return;
+ }
+
v3f move_direction = v3f(0,0,1);
move_direction.rotateXZBy(getYaw());