Files
wwdpublic/Content.Shared/Timing/UseDelayComponent.cs
AJCM-git 6b7e8b4f5b UseDelay + ItemCooldown merge (#22502)
(cherry picked from commit 9c522c8b19f7a6f6b396c66342413572a22d7845)
2024-01-26 21:32:09 +01:00

37 lines
1.4 KiB
C#

using Robust.Shared.GameStates;
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom;
namespace Content.Shared.Timing;
/// <summary>
/// Timer that creates a cooldown each time an object is activated/used
/// </summary>
/// <remarks>
/// Currently it only supports a single delay per entity, this means that for things that have two delay interactions they will share one timer, so this can cause issues. For example, the bible has a delay when opening the storage UI and when applying it's interaction effect, and they share the same delay.
/// </remarks>
[RegisterComponent]
[NetworkedComponent, AutoGenerateComponentState]
[Access(typeof(UseDelaySystem))]
public sealed partial class UseDelayComponent : Component
{
/// <summary>
/// When the delay starts.
/// </summary>
[ViewVariables(VVAccess.ReadWrite), DataField(customTypeSerializer: typeof(TimeOffsetSerializer)), AutoNetworkedField]
public TimeSpan DelayStartTime;
/// <summary>
/// When the delay ends.
/// </summary>
[ViewVariables(VVAccess.ReadWrite), DataField(customTypeSerializer: typeof(TimeOffsetSerializer)), AutoNetworkedField]
public TimeSpan DelayEndTime;
/// <summary>
/// Default delay time
/// </summary>
[DataField]
[ViewVariables(VVAccess.ReadWrite)]
[AutoNetworkedField]
public TimeSpan Delay = TimeSpan.FromSeconds(1);
}