Move SleepingSystem to Shared & cleanup (#28672)

* Move SleepingSystem to Shared & cleanup

* Remove empty OnShutdown handler
This commit is contained in:
Tayrtahn
2024-06-13 22:15:29 -04:00
committed by GitHub
parent c79849ae29
commit 6c343ddae2
8 changed files with 339 additions and 366 deletions

View File

@@ -1,31 +1,42 @@
using Content.Shared.FixedPoint;
using Robust.Shared.Audio;
using Robust.Shared.GameStates;
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom;
namespace Content.Shared.Bed.Sleep;
/// <summary>
/// Added to entities when they go to sleep.
/// </summary>
[NetworkedComponent, RegisterComponent, AutoGenerateComponentPause(Dirty = true)]
[NetworkedComponent, RegisterComponent]
[AutoGenerateComponentState, AutoGenerateComponentPause(Dirty = true)]
public sealed partial class SleepingComponent : Component
{
/// <summary>
/// How much damage of any type it takes to wake this entity.
/// </summary>
[DataField("wakeThreshold")]
[DataField]
public FixedPoint2 WakeThreshold = FixedPoint2.New(2);
/// <summary>
/// Cooldown time between users hand interaction.
/// </summary>
[DataField("cooldown")]
[ViewVariables(VVAccess.ReadWrite)]
[DataField]
public TimeSpan Cooldown = TimeSpan.FromSeconds(1f);
[DataField("cooldownEnd", customTypeSerializer:typeof(TimeOffsetSerializer))]
[AutoPausedField]
public TimeSpan CoolDownEnd;
[DataField]
[AutoNetworkedField, AutoPausedField]
public TimeSpan CooldownEnd;
[DataField("wakeAction")] public EntityUid? WakeAction;
[DataField]
[AutoNetworkedField]
public EntityUid? WakeAction;
/// <summary>
/// Sound to play when another player attempts to wake this entity.
/// </summary>
[DataField]
public SoundSpecifier WakeAttemptSound = new SoundPathSpecifier("/Audio/Effects/thudswoosh.ogg")
{
Params = AudioParams.Default.WithVariation(0.05f)
};
}