diff options
Diffstat (limited to 'src/content_sao.h')
-rw-r--r-- | src/content_sao.h | 28 |
1 files changed, 15 insertions, 13 deletions
diff --git a/src/content_sao.h b/src/content_sao.h index e45a4028e..6d2f55b70 100644 --- a/src/content_sao.h +++ b/src/content_sao.h @@ -32,11 +32,12 @@ public: UnitSAO(ServerEnvironment *env, v3f pos); virtual ~UnitSAO() = default; - virtual void setYaw(const float yaw) { m_yaw = yaw; } - float getYaw() const { return m_yaw; }; - f32 getRadYaw() const { return m_yaw * core::DEGTORAD; } + void setRotation(v3f rotation) { m_rotation = rotation; } + const v3f &getRotation() const { return m_rotation; } + v3f getRadRotation() { return m_rotation * core::DEGTORAD; } + // Deprecated - f32 getRadYawDep() const { return (m_yaw + 90.) * core::DEGTORAD; } + f32 getRadYawDep() const { return (m_rotation.Y + 90.) * core::DEGTORAD; } s16 getHP() const { return m_hp; } // Use a function, if isDead can be defined by other conditions @@ -64,7 +65,8 @@ public: void notifyObjectPropertiesModified(); protected: s16 m_hp = -1; - float m_yaw = 0.0f; + + v3f m_rotation; bool m_properties_sent = true; ObjectProperties m_prop; @@ -156,9 +158,9 @@ private: v3f m_velocity; v3f m_acceleration; - float m_last_sent_yaw = 0.0f; v3f m_last_sent_position; v3f m_last_sent_velocity; + v3f m_last_sent_rotation; float m_last_sent_position_timer = 0.0f; float m_last_sent_move_precision = 0.0f; std::string m_current_texture_modifier = ""; @@ -232,16 +234,16 @@ public: void setBasePosition(const v3f &position); void setPos(const v3f &pos); void moveTo(v3f pos, bool continuous); - void setYaw(const float yaw); + void setPlayerYaw(const float yaw); // Data should not be sent at player initialization - void setYawAndSend(const float yaw); - void setPitch(const float pitch); + void setPlayerYawAndSend(const float yaw); + void setLookPitch(const float pitch); // Data should not be sent at player initialization - void setPitchAndSend(const float pitch); - f32 getPitch() const { return m_pitch; } - f32 getRadPitch() const { return m_pitch * core::DEGTORAD; } + void setLookPitchAndSend(const float pitch); + f32 getLookPitch() const { return m_pitch; } + f32 getRadLookPitch() const { return m_pitch * core::DEGTORAD; } // Deprecated - f32 getRadPitchDep() const { return -1.0 * m_pitch * core::DEGTORAD; } + f32 getRadLookPitchDep() const { return -1.0 * m_pitch * core::DEGTORAD; } void setFov(const float pitch); f32 getFov() const { return m_fov; } void setWantedRange(const s16 range); |