Files
wwdpublic/Content.Shared/Singularity/Components/EventHorizonComponent.cs
VMSolidus 16e54f8300 Newtonian Singularity (#1619)
# Description

By request from the very same person who assisted with
https://github.com/Simple-Station/Einstein-Engines/pull/1618
This PR ports(and fixes)
https://github.com/space-wizards/space-station-14/pull/23372 such that
it works on modern Robust Toolbox.

This PR essentially makes it so that the Singularity (And Tesla by
extension) inherit some of the momentum of objects thrown into them. Im
practice it means that they now work more like they do in SS13, whereby
if a traitor does not actively intervene in a Singuloose(such as by
using a Singularity Beacon), the singularity will usually be "Blown back
into space" by space wind throwing objects at it in retaliation to it
eating engineering.

<details><summary><h1>Media</h1></summary>
<p>

https://github.com/user-attachments/assets/04e9e5b9-d873-4425-b19a-b854b57db486

</p>
</details>

# Changelog

🆑
- add: Singularity and Tesla are now affected by objects thrown into
them, causing them to change directions. Unless a traitor intervenes
(with a Singularity Beacon), a "Singuloose" is extremely likely to be
blown out to space.

---------

Signed-off-by: VMSolidus <evilexecutive@gmail.com>
Co-authored-by: DEATHB4DEFEAT <77995199+DEATHB4DEFEAT@users.noreply.github.com>
(cherry picked from commit 34b55e14f51d562510b1d9954999fbb3085bdf02)
2025-01-23 08:00:49 +03:00

92 lines
3.6 KiB
C#

using Robust.Shared.GameStates;
using Content.Shared.Singularity.EntitySystems;
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom;
namespace Content.Shared.Singularity.Components;
/// <summary>
/// A component that makes the associated entity destroy other within some distance of itself.
/// Also makes the associated entity destroy other entities upon contact.
/// Primarily managed by <see cref="SharedEventHorizonSystem"/> and its server/client versions.
/// </summary>
[Access(friends: typeof(SharedEventHorizonSystem))]
[RegisterComponent, NetworkedComponent, AutoGenerateComponentPause]
public sealed partial class EventHorizonComponent : Component
{
/// <summary>
/// The radius of the event horizon within which it will destroy all entities and tiles.
/// If &lt; 0.0 this behavior will not be active.
/// If you want to set this go through <see cref="SharedEventHorizonSystem.SetRadius"/>.
/// </summary>
[DataField("radius")]
public float Radius;
/// <summary>
/// involves periodically destroying tiles within a specified radius
/// </summary>
[DataField]
public bool ConsumeTiles = true;
/// <summary>
/// involves periodically destroying entities within a specified radius. Does not affect collide destruction of entities.
/// </summary>
[DataField]
public bool ConsumeEntities = true;
/// <summary>
/// Whether the event horizon can consume/destroy the devices built to contain it.
/// If you want to set this go through <see cref="SharedEventHorizonSystem.SetCanBreachContainment"/>.
/// </summary>
[DataField("canBreachContainment")]
[ViewVariables(VVAccess.ReadWrite)]
public bool CanBreachContainment = false;
/// <summary>
/// The ID of the fixture used to detect if the event horizon has collided with any physics objects.
/// Can be set to null, in which case no such fixture is used.
/// If you want to set this go through <see cref="SharedEventHorizonSystem.SetHorizonFixtureId"/>.
/// </summary>
[DataField("consumerFixtureId")]
[ViewVariables(VVAccess.ReadWrite)]
public string? ConsumerFixtureId = "EventHorizonConsumer";
/// <summary>
/// The ID of the fixture used to detect if the event horizon has collided with any physics objects.
/// Can be set to null, in which case no such fixture is used.
/// If you want to set this go through <see cref="SharedEventHorizonSystem.SetHorizonFixtureId"/>.
/// </summary>
[DataField("colliderFixtureId")]
[ViewVariables(VVAccess.ReadWrite)]
public string? ColliderFixtureId = "EventHorizonCollider";
/// <summary>
/// Whether the entity this event horizon is attached to is being consumed by another event horizon.
/// </summary>
[ViewVariables(VVAccess.ReadOnly)]
public bool BeingConsumedByAnotherEventHorizon = false;
#region Update Timing
/// <summary>
/// The amount of time that should elapse between this event horizon consuming everything it overlaps with.
/// </summary>
[DataField("consumePeriod")]
[ViewVariables(VVAccess.ReadWrite)]
public TimeSpan TargetConsumePeriod = TimeSpan.FromSeconds(0.5);
/// <summary>
/// The next time at which this consumed everything it overlapped with.
/// </summary>
[ViewVariables(VVAccess.ReadOnly), DataField("nextConsumeWaveTime", customTypeSerializer:typeof(TimeOffsetSerializer))]
[AutoPausedField]
public TimeSpan NextConsumeWaveTime;
/// <summary>
/// Whether to inherit the momentum of consumed objects.
/// </summary>
[DataField]
public bool InheritMomentum;
#endregion Update Timing
}