2024-11-19 08:11:10 +06:00
|
|
|
using Robust.Shared.Prototypes;
|
2022-12-19 18:47:15 -08:00
|
|
|
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype;
|
|
|
|
|
|
2024-11-17 03:58:15 +06:00
|
|
|
using Content.Shared.Physics;
|
|
|
|
|
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom;
|
2024-11-20 09:32:50 +06:00
|
|
|
using Robust.Shared.GameStates;
|
2021-12-08 17:32:32 +01:00
|
|
|
|
2024-11-20 07:49:45 +06:00
|
|
|
namespace Content.Shared.Singularity.Components;
|
2022-12-19 18:47:15 -08:00
|
|
|
|
2024-11-20 09:32:50 +06:00
|
|
|
[RegisterComponent, AutoGenerateComponentPause, NetworkedComponent, AutoGenerateComponentState]
|
2023-08-22 18:14:33 -07:00
|
|
|
public sealed partial class SingularityGeneratorComponent : Component
|
2022-12-19 18:47:15 -08:00
|
|
|
{
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// The amount of power this generator has accumulated.
|
|
|
|
|
/// If you want to set this use <see cref="SingularityGeneratorSystem.SetPower"/>
|
|
|
|
|
/// </summary>
|
2024-11-17 03:58:15 +06:00
|
|
|
[DataField]
|
2022-12-19 18:47:15 -08:00
|
|
|
public float Power = 0;
|
2020-10-28 19:19:47 +01:00
|
|
|
|
2022-12-19 18:47:15 -08:00
|
|
|
/// <summary>
|
|
|
|
|
/// The power threshold at which this generator will spawn a singularity.
|
|
|
|
|
/// If you want to set this use <see cref="SingularityGeneratorSystem.SetThreshold"/>
|
|
|
|
|
/// </summary>
|
2024-11-17 03:58:15 +06:00
|
|
|
[DataField]
|
2022-12-19 18:47:15 -08:00
|
|
|
public float Threshold = 16;
|
2020-10-28 19:19:47 +01:00
|
|
|
|
2024-11-17 03:58:15 +06:00
|
|
|
/// <summary>
|
|
|
|
|
/// Allows the generator to ignore all the failsafe stuff, e.g. when emagged
|
|
|
|
|
/// </summary>
|
2024-11-20 07:49:45 +06:00
|
|
|
[DataField, AutoNetworkedField]
|
2024-11-17 03:58:15 +06:00
|
|
|
public bool FailsafeDisabled = false;
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Maximum distance at which the generator will check for a field at
|
|
|
|
|
/// </summary>
|
|
|
|
|
[DataField]
|
|
|
|
|
public float FailsafeDistance = 16;
|
|
|
|
|
|
2022-12-19 18:47:15 -08:00
|
|
|
/// <summary>
|
|
|
|
|
/// The prototype ID used to spawn a singularity.
|
|
|
|
|
/// </summary>
|
|
|
|
|
[DataField("spawnId", customTypeSerializer: typeof(PrototypeIdSerializer<EntityPrototype>))]
|
|
|
|
|
public string? SpawnPrototype = "Singularity";
|
2024-11-17 03:58:15 +06:00
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// The masks the raycast should not go through
|
|
|
|
|
/// </summary>
|
|
|
|
|
[DataField]
|
|
|
|
|
public int CollisionMask = (int)CollisionGroup.FullTileMask;
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Message to use when there's no containment field on cardinal directions
|
|
|
|
|
/// </summary>
|
|
|
|
|
[DataField]
|
2024-11-17 04:31:34 +06:00
|
|
|
public LocId ContainmentFailsafeMessage = "comp-generator-failsafe";
|
2024-11-17 03:58:15 +06:00
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// For how long the failsafe will cause the generator to stop working and not issue a failsafe warning
|
|
|
|
|
/// </summary>
|
|
|
|
|
[DataField]
|
2024-11-19 08:11:10 +06:00
|
|
|
public TimeSpan FailsafeCooldown = TimeSpan.FromSeconds(10);
|
2024-11-17 03:58:15 +06:00
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// How long until the generator can issue a failsafe warning again
|
|
|
|
|
/// </summary>
|
|
|
|
|
[DataField(customTypeSerializer: typeof(TimeOffsetSerializer))]
|
|
|
|
|
[AutoPausedField]
|
2024-11-17 04:31:34 +06:00
|
|
|
public TimeSpan NextFailsafe = TimeSpan.Zero;
|
2020-10-28 19:19:47 +01:00
|
|
|
}
|