aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorparamat <paramat@users.noreply.github.com>2019-04-10 20:33:54 +0100
committerParamat <paramat@users.noreply.github.com>2019-04-14 22:21:51 +0100
commit38b94f248ad2473b8c49e9832215071e8a79944f (patch)
tree68f1cfa65998e356ccb0060e6121809d36b8b125 /src
parent12a63021d01abd7395be3614767648d0b39f42a3 (diff)
downloadminetest-38b94f248ad2473b8c49e9832215071e8a79944f.tar.gz
minetest-38b94f248ad2473b8c49e9832215071e8a79944f.tar.bz2
minetest-38b94f248ad2473b8c49e9832215071e8a79944f.zip
Attend to review, re-arrange blank lines, update lua_api.txt
Diffstat (limited to 'src')
-rw-r--r--src/client/content_cao.cpp13
-rw-r--r--src/content_sao.cpp12
2 files changed, 12 insertions, 13 deletions
diff --git a/src/client/content_cao.cpp b/src/client/content_cao.cpp
index 22f62e6c3..b169ba75f 100644
--- a/src/client/content_cao.cpp
+++ b/src/client/content_cao.cpp
@@ -997,21 +997,20 @@ void GenericCAO::step(float dtime, ClientEnvironment *env)
if (!getParent() && m_prop.automatic_face_movement_dir &&
(fabs(m_velocity.Z) > 0.001 || fabs(m_velocity.X) > 0.001)) {
-
float target_yaw = atan2(m_velocity.Z, m_velocity.X) * 180 / M_PI
+ m_prop.automatic_face_movement_dir_offset;
float max_rotation_per_sec =
m_prop.automatic_face_movement_max_rotation_per_sec;
- if (max_rotation_per_sec > 0) {
- float max_rotation_delta = dtime * max_rotation_per_sec;
- wrappedApproachShortest(m_rotation.Y, target_yaw, max_rotation_delta, 360.f);
- } else
- // Negative values of ...max_rotation_per_sec mean disabled.
+ if (max_rotation_per_sec > 0) {
+ wrappedApproachShortest(m_rotation.Y, target_yaw,
+ dtime * max_rotation_per_sec, 360.f);
+ } else {
+ // Negative values of max_rotation_per_sec mean disabled.
m_rotation.Y = target_yaw;
+ }
rot_translator.val_current = m_rotation;
-
updateNodePos();
}
}
diff --git a/src/content_sao.cpp b/src/content_sao.cpp
index 1fd890044..f0d7fbf5d 100644
--- a/src/content_sao.cpp
+++ b/src/content_sao.cpp
@@ -454,19 +454,19 @@ void LuaEntitySAO::step(float dtime, bool send_recommended)
if (m_prop.automatic_face_movement_dir &&
(fabs(m_velocity.Z) > 0.001 || fabs(m_velocity.X) > 0.001)) {
-
float target_yaw = atan2(m_velocity.Z, m_velocity.X) * 180 / M_PI
+ m_prop.automatic_face_movement_dir_offset;
-
float max_rotation_per_sec =
m_prop.automatic_face_movement_max_rotation_per_sec;
+
if (max_rotation_per_sec > 0) {
- float max_rotation_delta = dtime * max_rotation_per_sec;
m_rotation.Y = wrapDegrees_0_360(m_rotation.Y);
- wrappedApproachShortest(m_rotation.Y, target_yaw, max_rotation_delta, 360.f);
- } else
- // Negative values of ...max_rotation_per_sec mean disabled.
+ wrappedApproachShortest(m_rotation.Y, target_yaw,
+ dtime * max_rotation_per_sec, 360.f);
+ } else {
+ // Negative values of max_rotation_per_sec mean disabled.
m_rotation.Y = target_yaw;
+ }
}
}