Attend to review, re-arrange blank lines, update lua_api.txt

This commit is contained in:
paramat 2019-04-10 20:33:54 +01:00 committed by Paramat
parent 12a63021d0
commit 38b94f248a
3 changed files with 13 additions and 14 deletions

@ -5680,7 +5680,7 @@ Used by `ObjectRef` methods. Part of an Entity definition.
automatic_face_movement_max_rotation_per_sec = -1, automatic_face_movement_max_rotation_per_sec = -1,
-- Limit automatic rotation to this value in degrees per second. -- Limit automatic rotation to this value in degrees per second.
-- No limit if value < 0. -- No limit if value <= 0.
backface_culling = true, backface_culling = true,
-- Set to false to disable backface_culling for model -- Set to false to disable backface_culling for model

@ -997,21 +997,20 @@ void GenericCAO::step(float dtime, ClientEnvironment *env)
if (!getParent() && m_prop.automatic_face_movement_dir && if (!getParent() && m_prop.automatic_face_movement_dir &&
(fabs(m_velocity.Z) > 0.001 || fabs(m_velocity.X) > 0.001)) { (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 float target_yaw = atan2(m_velocity.Z, m_velocity.X) * 180 / M_PI
+ m_prop.automatic_face_movement_dir_offset; + m_prop.automatic_face_movement_dir_offset;
float max_rotation_per_sec = float max_rotation_per_sec =
m_prop.automatic_face_movement_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); if (max_rotation_per_sec > 0) {
} else wrappedApproachShortest(m_rotation.Y, target_yaw,
// Negative values of ...max_rotation_per_sec mean disabled. dtime * max_rotation_per_sec, 360.f);
} else {
// Negative values of max_rotation_per_sec mean disabled.
m_rotation.Y = target_yaw; m_rotation.Y = target_yaw;
}
rot_translator.val_current = m_rotation; rot_translator.val_current = m_rotation;
updateNodePos(); updateNodePos();
} }
} }

@ -454,19 +454,19 @@ void LuaEntitySAO::step(float dtime, bool send_recommended)
if (m_prop.automatic_face_movement_dir && if (m_prop.automatic_face_movement_dir &&
(fabs(m_velocity.Z) > 0.001 || fabs(m_velocity.X) > 0.001)) { (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 float target_yaw = atan2(m_velocity.Z, m_velocity.X) * 180 / M_PI
+ m_prop.automatic_face_movement_dir_offset; + m_prop.automatic_face_movement_dir_offset;
float max_rotation_per_sec = float max_rotation_per_sec =
m_prop.automatic_face_movement_max_rotation_per_sec; m_prop.automatic_face_movement_max_rotation_per_sec;
if (max_rotation_per_sec > 0) { if (max_rotation_per_sec > 0) {
float max_rotation_delta = dtime * max_rotation_per_sec;
m_rotation.Y = wrapDegrees_0_360(m_rotation.Y); m_rotation.Y = wrapDegrees_0_360(m_rotation.Y);
wrappedApproachShortest(m_rotation.Y, target_yaw, max_rotation_delta, 360.f); wrappedApproachShortest(m_rotation.Y, target_yaw,
} else dtime * max_rotation_per_sec, 360.f);
// Negative values of ...max_rotation_per_sec mean disabled. } else {
// Negative values of max_rotation_per_sec mean disabled.
m_rotation.Y = target_yaw; m_rotation.Y = target_yaw;
}
} }
} }