Skip to content

Commit 38b94f2

Browse files
committedApr 14, 2019
Attend to review, re-arrange blank lines, update lua_api.txt
1 parent 12a6302 commit 38b94f2

File tree

3 files changed

+13
-14
lines changed

3 files changed

+13
-14
lines changed
 

Diff for: ‎doc/lua_api.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -5680,7 +5680,7 @@ Used by `ObjectRef` methods. Part of an Entity definition.
56805680

56815681
automatic_face_movement_max_rotation_per_sec = -1,
56825682
-- Limit automatic rotation to this value in degrees per second.
5683-
-- No limit if value < 0.
5683+
-- No limit if value <= 0.
56845684

56855685
backface_culling = true,
56865686
-- Set to false to disable backface_culling for model

Diff for: ‎src/client/content_cao.cpp

+6-7
Original file line numberDiff line numberDiff line change
@@ -997,21 +997,20 @@ void GenericCAO::step(float dtime, ClientEnvironment *env)
997997

998998
if (!getParent() && m_prop.automatic_face_movement_dir &&
999999
(fabs(m_velocity.Z) > 0.001 || fabs(m_velocity.X) > 0.001)) {
1000-
10011000
float target_yaw = atan2(m_velocity.Z, m_velocity.X) * 180 / M_PI
10021001
+ m_prop.automatic_face_movement_dir_offset;
10031002
float max_rotation_per_sec =
10041003
m_prop.automatic_face_movement_max_rotation_per_sec;
1005-
if (max_rotation_per_sec > 0) {
1006-
float max_rotation_delta = dtime * max_rotation_per_sec;
10071004

1008-
wrappedApproachShortest(m_rotation.Y, target_yaw, max_rotation_delta, 360.f);
1009-
} else
1010-
// Negative values of ...max_rotation_per_sec mean disabled.
1005+
if (max_rotation_per_sec > 0) {
1006+
wrappedApproachShortest(m_rotation.Y, target_yaw,
1007+
dtime * max_rotation_per_sec, 360.f);
1008+
} else {
1009+
// Negative values of max_rotation_per_sec mean disabled.
10111010
m_rotation.Y = target_yaw;
1011+
}
10121012

10131013
rot_translator.val_current = m_rotation;
1014-
10151014
updateNodePos();
10161015
}
10171016
}

Diff for: ‎src/content_sao.cpp

+6-6
Original file line numberDiff line numberDiff line change
@@ -454,19 +454,19 @@ void LuaEntitySAO::step(float dtime, bool send_recommended)
454454

455455
if (m_prop.automatic_face_movement_dir &&
456456
(fabs(m_velocity.Z) > 0.001 || fabs(m_velocity.X) > 0.001)) {
457-
458457
float target_yaw = atan2(m_velocity.Z, m_velocity.X) * 180 / M_PI
459458
+ m_prop.automatic_face_movement_dir_offset;
460-
461459
float max_rotation_per_sec =
462460
m_prop.automatic_face_movement_max_rotation_per_sec;
461+
463462
if (max_rotation_per_sec > 0) {
464-
float max_rotation_delta = dtime * max_rotation_per_sec;
465463
m_rotation.Y = wrapDegrees_0_360(m_rotation.Y);
466-
wrappedApproachShortest(m_rotation.Y, target_yaw, max_rotation_delta, 360.f);
467-
} else
468-
// Negative values of ...max_rotation_per_sec mean disabled.
464+
wrappedApproachShortest(m_rotation.Y, target_yaw,
465+
dtime * max_rotation_per_sec, 360.f);
466+
} else {
467+
// Negative values of max_rotation_per_sec mean disabled.
469468
m_rotation.Y = target_yaw;
469+
}
470470
}
471471
}
472472

0 commit comments

Comments
 (0)
Please sign in to comment.