2021-07-10 17:35:33 +02:00
|
|
|
using Content.Shared.Sound;
|
2021-02-06 14:31:44 +01:00
|
|
|
using JetBrains.Annotations;
|
2019-11-12 08:20:03 +11:00
|
|
|
using Robust.Shared.GameObjects;
|
2021-03-05 01:08:38 +01:00
|
|
|
using Robust.Shared.Serialization.Manager.Attributes;
|
2020-05-29 15:50:23 -05:00
|
|
|
using Robust.Shared.ViewVariables;
|
2021-11-02 11:40:55 +11:00
|
|
|
using Content.Server.Nutrition.EntitySystems;
|
2021-11-03 16:48:03 -07:00
|
|
|
using Content.Shared.FixedPoint;
|
2021-11-02 11:40:55 +11:00
|
|
|
using Robust.Shared.Analyzers;
|
2021-12-07 19:19:26 +13:00
|
|
|
using System.Threading;
|
2019-11-12 08:20:03 +11:00
|
|
|
|
2021-06-09 22:19:39 +02:00
|
|
|
namespace Content.Server.Nutrition.Components
|
2019-11-12 08:20:03 +11:00
|
|
|
{
|
|
|
|
|
[RegisterComponent]
|
2021-11-02 11:40:55 +11:00
|
|
|
[Friend(typeof(DrinkSystem))]
|
2022-02-07 00:37:38 +11:00
|
|
|
public sealed class DrinkComponent : Component
|
2019-11-12 08:20:03 +11:00
|
|
|
{
|
2021-09-06 15:49:44 +02:00
|
|
|
[DataField("solution")]
|
|
|
|
|
public string SolutionName { get; set; } = DefaultSolutionName;
|
|
|
|
|
public const string DefaultSolutionName = "drink";
|
|
|
|
|
|
2019-11-12 08:20:03 +11:00
|
|
|
[ViewVariables]
|
2021-03-05 01:08:38 +01:00
|
|
|
[DataField("useSound")]
|
2021-11-02 11:40:55 +11:00
|
|
|
public SoundSpecifier UseSound = new SoundPathSpecifier("/Audio/Items/drink.ogg");
|
2021-02-06 14:31:44 +01:00
|
|
|
|
2019-11-12 08:20:03 +11:00
|
|
|
[ViewVariables]
|
2021-03-05 01:08:38 +01:00
|
|
|
[DataField("isOpen")]
|
2021-09-06 15:49:44 +02:00
|
|
|
internal bool DefaultToOpened;
|
2021-02-06 14:31:44 +01:00
|
|
|
|
2020-09-08 13:30:22 +02:00
|
|
|
[ViewVariables(VVAccess.ReadWrite)]
|
2021-11-03 16:48:03 -07:00
|
|
|
public FixedPoint2 TransferAmount { get; [UsedImplicitly] private set; } = FixedPoint2.New(5);
|
2021-02-06 14:31:44 +01:00
|
|
|
|
2020-09-08 13:30:22 +02:00
|
|
|
[ViewVariables(VVAccess.ReadWrite)]
|
2021-11-02 11:40:55 +11:00
|
|
|
public bool Opened;
|
2019-11-12 08:20:03 +11:00
|
|
|
|
2021-03-05 01:08:38 +01:00
|
|
|
[DataField("openSounds")]
|
2021-11-02 11:40:55 +11:00
|
|
|
public SoundSpecifier OpenSounds = new SoundCollectionSpecifier("canOpenSounds");
|
2020-05-29 15:50:23 -05:00
|
|
|
|
2021-11-02 11:40:55 +11:00
|
|
|
[DataField("pressurized")]
|
|
|
|
|
public bool Pressurized;
|
2020-10-10 15:25:13 +02:00
|
|
|
|
2021-11-02 11:40:55 +11:00
|
|
|
[DataField("burstSound")]
|
|
|
|
|
public SoundSpecifier BurstSound = new SoundPathSpecifier("/Audio/Effects/flash_bang.ogg");
|
2021-11-29 16:27:15 +13:00
|
|
|
|
2022-02-07 00:37:38 +11:00
|
|
|
/// <summary>
|
|
|
|
|
/// How long it takes to drink this yourself.
|
|
|
|
|
/// </summary>
|
|
|
|
|
[DataField("delay")]
|
|
|
|
|
public float Delay = 1;
|
|
|
|
|
|
2021-11-29 16:27:15 +13:00
|
|
|
/// <summary>
|
|
|
|
|
/// This is how many seconds it takes to force feed someone this drink.
|
|
|
|
|
/// </summary>
|
|
|
|
|
[DataField("forceFeedDelay")]
|
|
|
|
|
public float ForceFeedDelay = 3;
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
2021-12-07 19:19:26 +13:00
|
|
|
/// Token for interrupting a do-after action (e.g., force feeding). If not null, implies component is
|
|
|
|
|
/// currently "in use".
|
2021-11-29 16:27:15 +13:00
|
|
|
/// </summary>
|
2021-12-07 19:19:26 +13:00
|
|
|
public CancellationTokenSource? CancelToken;
|
2019-11-12 08:20:03 +11:00
|
|
|
}
|
|
|
|
|
}
|