Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[PORT] Smooth Light #977

Merged
merged 1 commit into from
Dec 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions Content.Shared/CombatMode/CombatModeComponent.cs
Original file line number Diff line number Diff line change
Expand Up @@ -51,5 +51,19 @@ public sealed partial class CombatModeComponent : Component
/// </summary>
[DataField, AutoNetworkedField]
public bool ToggleMouseRotator = true;

// BACKMEN START
/// <summary>
/// If true, sets <see cref="MouseRotatorComponent.AngleTolerance"/> to 1 degree and <see cref="MouseRotatorComponent.Simple4DirMode"/>
/// to false when the owner enters combatmode. This is currently being tested as of 06.12.24,
/// so a simple bool switch should suffice.
/// Leaving AutoNetworking just in case shitmins need to disable it for someone. Will only take effect when re-enabling combat mode.
/// </summary>
/// <remarks>
/// No effect if <see cref="ToggleMouseRotator"/> is false.
/// </remarks>
[DataField, AutoNetworkedField]
public bool SmoothRotation = true;
// BACKMEN END
Comment on lines +54 to +67
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Рассмотрите значение по умолчанию для SmoothRotation

Установка SmoothRotation = true по умолчанию может неожиданно изменить поведение для существующих сущностей. Рекомендуется:

  1. Установить значение по умолчанию в false для обратной совместимости
  2. Включать новое поведение только для новых сущностей или через явную конфигурацию
-public bool SmoothRotation = true;
+public bool SmoothRotation = false;
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
// BACKMEN START
/// <summary>
/// If true, sets <see cref="MouseRotatorComponent.AngleTolerance"/> to 1 degree and <see cref="MouseRotatorComponent.Simple4DirMode"/>
/// to false when the owner enters combatmode. This is currently being tested as of 06.12.24,
/// so a simple bool switch should suffice.
/// Leaving AutoNetworking just in case shitmins need to disable it for someone. Will only take effect when re-enabling combat mode.
/// </summary>
/// <remarks>
/// No effect if <see cref="ToggleMouseRotator"/> is false.
/// </remarks>
[DataField, AutoNetworkedField]
public bool SmoothRotation = true;
// BACKMEN END
// BACKMEN START
/// <summary>
/// If true, sets <see cref="MouseRotatorComponent.AngleTolerance"/> to 1 degree and <see cref="MouseRotatorComponent.Simple4DirMode"/>
/// to false when the owner enters combatmode. This is currently being tested as of 06.12.24,
/// so a simple bool switch should suffice.
/// Leaving AutoNetworking just in case shitmins need to disable it for someone. Will only take effect when re-enabling combat mode.
/// </summary>
/// <remarks>
/// No effect if <see cref="ToggleMouseRotator"/> is false.
/// </remarks>
[DataField, AutoNetworkedField]
public bool SmoothRotation = false;
// BACKMEN END

}
}
9 changes: 8 additions & 1 deletion Content.Shared/CombatMode/SharedCombatModeSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,14 @@ private void SetMouseRotatorComponents(EntityUid uid, bool value)
{
if (value)
{
EnsureComp<MouseRotatorComponent>(uid);
var rot = EnsureComp<MouseRotatorComponent>(uid);
// BACKMEN EDIT START
if (TryComp<CombatModeComponent>(uid, out var comp) && comp.SmoothRotation) // no idea under which (intended) circumstances this can fail (if any), so i'll avoid Comp<>().
{
rot.AngleTolerance = Angle.FromDegrees(1); // arbitrary
rot.Simple4DirMode = false;
}
// BACKMEN EDIT END
EnsureComp<NoRotateOnMoveComponent>(uid);
}
else
Expand Down
Loading