Fix more things I forgot for attached players. Such players will now properly see...
authorMirceaKitsune <sonichedgehog_hyperblast00@yahoo.com>
Fri, 9 Nov 2012 14:45:29 +0000 (16:45 +0200)
committerPerttu Ahola <celeron55@gmail.com>
Sun, 25 Nov 2012 17:14:24 +0000 (19:14 +0200)
Fix attached players being able to bob their view and generate foostep sounds by pressing a movement key (running in place)

src/content_cao.cpp
src/localplayer.cpp
src/nodedef.cpp

index 821862c9be40340ba7e2f5b36e936b7562e57618..c3575af1f1b0646cb8bf6260909886713282f5c6 100644 (file)
@@ -1538,7 +1538,6 @@ public:
                        {
                                LocalPlayer *player = m_env->getLocalPlayer();
                                player->isAttached = true;
-                               player->overridePosition = m_attachment_position;
                        }
                }
        }
index ecfa4467c8f12bc1d7d4539c0782c726e000049c..63400cc298cd156d60151488ff3f7b78f95d4c47 100644 (file)
@@ -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),
@@ -53,6 +55,12 @@ LocalPlayer::~LocalPlayer()
 void LocalPlayer::move(f32 dtime, Map &map, f32 pos_max_d,
                core::list<CollisionInfo> *collision_info)
 {
+       INodeDefManager *nodemgr = m_gamedef->ndef();
+
+       v3f position = getPosition();
+
+       v3f old_speed = m_speed;
+
        // Copy parent position if local player is attached
        if(isAttached)
        {
@@ -60,12 +68,6 @@ void LocalPlayer::move(f32 dtime, Map &map, f32 pos_max_d,
                return;
        }
 
-       INodeDefManager *nodemgr = m_gamedef->ndef();
-
-       v3f position = getPosition();
-
-       v3f old_speed = m_speed;
-
        // 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");
@@ -359,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());
        
index 53deea11b7940500be3f3b00616afdb9f50e6531..180219ba854f1c0dd8a17b732d74994c4958666c 100644 (file)
@@ -254,7 +254,6 @@ void ContentFeatures::serialize(std::ostream &os)
        os<<serializeString(liquid_alternative_flowing);
        os<<serializeString(liquid_alternative_source);
        writeU8(os, liquid_viscosity);
-       writeU8(os, liquid_renewable);
        writeU8(os, light_source);
        writeU32(os, damage_per_second);
        node_box.serialize(os);
@@ -312,7 +311,6 @@ void ContentFeatures::deSerialize(std::istream &is)
        liquid_alternative_flowing = deSerializeString(is);
        liquid_alternative_source = deSerializeString(is);
        liquid_viscosity = readU8(is);
-       liquid_renewable = readU8(is);
        light_source = readU8(is);
        damage_per_second = readU32(is);
        node_box.deSerialize(is);