Files
wwdpublic/Content.Server/Singularity/Components/GravityWellComponent.cs
VMSolidus 6754cae17d Revert Newtonian Singularity (#1865)
Please merge this immediately.

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit

- **New Features**
- Added automatic pausing for certain gravity effects, enhancing
responsiveness.

- **Refactor**
- Streamlined gravitational pulse mechanics for more consistent
interactions.
- Removed legacy behaviors such as momentum inheritance, counterforces,
and static attraction to simplify physics.

- **Chores**
- Increased the density of singularity entities to alter their physical
impact.
- Updated configuration values for gravity-related components to improve
overall stability and balance in gameplay.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->

(cherry picked from commit 6fa56a63a34a02fa121aa175a9738186d3d2be94)
2025-03-08 14:31:06 +03:00

66 lines
2.3 KiB
C#

using Content.Shared.Singularity.Components;
using Content.Server.Singularity.EntitySystems;
namespace Content.Server.Singularity.Components;
/// <summary>
/// The server-side version of <see cref="SharedGravityWellComponent"/>.
/// Primarily managed by <see cref="GravityWellSystem"/>.
/// </summary>
[RegisterComponent, AutoGenerateComponentPause]
public sealed partial class GravityWellComponent : Component
{
/// <summary>
/// The maximum range at which the gravity well can push/pull entities.
/// </summary>
[DataField]
public float MaxRange;
/// <summary>
/// The minimum range at which the gravity well can push/pull entities.
/// This is effectively hardfloored at <see cref="GravityWellSystem.MinGravPulseRange"/>.
/// </summary>
[DataField]
public float MinRange = 0f;
/// <summary>
/// The acceleration entities will experience towards the gravity well at a distance of 1m.
/// Negative values accelerate entities away from the gravity well.
/// Actual acceleration scales with the inverse of the distance to the singularity.
/// </summary>
[DataField]
public float BaseRadialAcceleration = 0.0f;
/// <summary>
/// The acceleration entities will experience tangent to the gravity well at a distance of 1m.
/// Positive tangential acceleration is counter-clockwise.
/// Actual acceleration scales with the inverse of the distance to the singularity.
/// </summary>
[DataField]
public float BaseTangentialAcceleration = 0.0f;
#region Update Timing
/// <summary>
/// The amount of time that should elapse between automated updates to this gravity well.
/// </summary>
[DataField("gravPulsePeriod")]
[ViewVariables(VVAccess.ReadOnly)]
[Access(typeof(GravityWellSystem))]
public TimeSpan TargetPulsePeriod { get; internal set; } = TimeSpan.FromSeconds(0.5);
/// <summary>
/// The next time at which this gravity well should pulse.
/// </summary>
[DataField, Access(typeof(GravityWellSystem)), AutoPausedField]
public TimeSpan NextPulseTime { get; internal set; } = default!;
/// <summary>
/// The last time this gravity well pulsed.
/// </summary>
[ViewVariables(VVAccess.ReadOnly)]
public TimeSpan LastPulseTime => NextPulseTime - TargetPulsePeriod;
#endregion Update Timing
}